与64位Windows中的Access数据库的ODBC连接 [英] ODBC connection to Access database in 64-bit Windows

查看:679
本文介绍了与64位Windows中的Access数据库的ODBC连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用本教程来创建从Java应用程序到Microsoft Access 2010数据库.本教程在Windows中创建一个系统dsn,然后使用以下Java代码行连接到该系统dsn:

I am using this tutorial to create a database connection from a java application to a Microsoft Access 2010 database. The tutorial creates a system dsn in windows, and then connects to that system dsn using the following line of java code:

Connection conn = DriverManager.getConnection("jdbc:odbc:DSN_NAME");   

问题在于,当我单击链接以在以下位置添加新系统dsn时:

The problem is that, when I click the link to add a new system dsn at:

Control Panel --> System and Security --> Administrative Tools --> Data Sources (ODBC) --> (System DSN Tab) --> (Add.. button)  

它没有提供选择Microsoft Access作为数据库类型的选项.而是,给定的选项显示在以下打印屏幕中:

It does not give me an option to choose Microsoft Access as the database type. Instead, the options given are shown in the following printscreen:

我想知道这是否是驱动程序问题,我需要在此下载一些内容.或者,如果这是配置问题.我正在使用Windows7.有人可以教我如何解决此问题,以便我可以创建完成本教程所需的System dsn吗?或者至少告诉我从Java连接到Microsoft Access数据库的另一种简单方法?

I am wondering if this is a driver issue, where I need to download something. Or if it is a configuration issue. I am using Windows 7. Can anyone show me how to fix this so that I can create the System dsn required to complete this tutorial? Or at least show me another easy way to connect to a Microsoft Access database from java?

推荐答案

64位Windows计算机具有两个单独的"ODBC数据源管理器"控制面板:一个用于为64位应用程序创建64位DSN.一种为32位应用程序创建32位DSN的程序.在64位Windows计算机上,

64-bit Windows machines have two separate "ODBC Data Source Administrator" control panels: one that creates 64-bit DSNs for 64-bit applications, and a separate one that creates 32-bit DSNs for 32-bit applications. On a 64-bit Windows machine,

控制面板>管理工具>数据源(ODBC)

Control Panel > Administrative Tools > Data Sources (ODBC)

将打开64位ODBC数据源管理器.要打开32位副本,您需要运行

will open the 64-bit ODBC Data Source Administrator. To open the 32-bit counterpart you need to run

C:\ Windows \ SysWOW64 \ odbcad32.exe

C:\Windows\SysWOW64\odbcad32.exe

您没有看到Access数据库驱动程序,因为您正在运行Windows的64位版本,并且Windows没有附带64位的Access驱动程序. Windows 确实附带了32位Jet驱动程序(仅.mdb文件).

You don't see an Access database driver because you are running a 64-bit version of Windows and there is no 64-bit Access driver included with Windows. Windows does ship with a 32-bit Jet driver (.mdb files only).

因此,您需要执行以下一项操作:

So, you will need to do one of the following:

  • 如果您正在运行Java的32位版本,并且要连接到.mdb文件,则需要如上所述启动32位ODBC数据源管理器.

  • If you are running a 32-bit version of Java and you want to connect to an .mdb file then you need to launch the 32-bit ODBC Data Source Administrator as described above.

如果您正在运行Java的32位版本,并且希望能够同时连接到.accdb.mdb文件,则需要下载并安装Access的32位版本从此处中启动数据库引擎,然后启动32位如上所述的ODBC数据源管理员.

If you are running a 32-bit version of Java and you want to be able to connect to both .accdb and .mdb files then you need to download and install the 32-bit version of the Access Database Engine from here and then launch the 32-bit ODBC Data Source Administrator as described above.

如果您正在运行Java的64位版本,则需要从

If you are running a 64-bit version of Java then you need to download and install the 64-bit version of the Access Database Engine from here.

这篇关于与64位Windows中的Access数据库的ODBC连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆