创建与.accdb访问文件的连接 [英] Create Connection to .accdb Access File

查看:105
本文介绍了创建与.accdb访问文件的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我上这堂课已有几天了,现在在网上搜索以寻求解决方案.我要在这里执行的操作是连接到扩展名为.accdb的Access 2010数据库我已经成功连接到扩展名为.mdb而不是.accdb

I've been on this class for a few days now searching the web trying to find a solution. What I am trying to do here is connect to a Access 2010 database with an extension .accdb I have been successful connecting to older databases with extensions of .mdb but not .accdb

我尝试卸载Office并针对x64版本重新安装它,然后安装Access x64工具.使用以下代码时收到的错误如下:

I have tried uninstalling Office and re-installing it for x64 versions and then installing the Access x64 tools. The error I received when I use the below code is as follows:

java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

在这一点上,我不知道是什么原因造成的.要指出的是,我需要在未指定DSN的情况下进行此设置,因为它可以在多台计算机上运行,​​并且我不想在每台计算机上都设置和维护DSN.

At this point I have no idea what could be causing this. To point out, I need to have this setup with no DSN specified because this may run on multiple machines and I do not want to have to setup and maintain a DSN on each.

String database = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\\Users\\Brandon\\Dropbox\\Work\\Angent Profiles\\Database1.accdb;";
Connection conn = null;

    try {
        conn = DriverManager.getConnection(database, "", "");
    } catch (SQLException SQLE) {
        System.out.println("ERROR: " + SQLE);
    } 

任何对此的建议将不胜感激.

Any advice on this would be grateful.

C:\Windows\system32>java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

C:\Windows\system32>

Provider=Microsoft.ACE.OLEDB.15.0;Data Source=C:\Users\Brandon\Dropbox\Work\Angent Profiles\Database1.accdb;Persist Security Info=False



String database = "jdbc:odbc:DRIVER={Microsoft.ACE.OLEDB.15.0 (*.mdb, *.accdb)};Data Source=C:\\Users\\Brandon\\Dropbox\\Work\\Angent Profiles\\Database1.accdb;";

推荐答案

我相信您需要运行32位JRE才能连接到Access数据库.据我了解,目前没有可用的64位访问ODBC驱动程序.

I believe you need to run a 32 bit JRE to connect to access databases. From my understanding there is currently no 64 bit access ODBC driver available.

这篇关于创建与.accdb访问文件的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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