2

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

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

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.

EDIT:

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>

EDIT:

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;";
Brandon Wilson
  • 4,462
  • 7
  • 60
  • 90

1 Answers1

0

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.

rdmcfee
  • 540
  • 6
  • 13