Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't connect to MS Access DB with Windows-64bit
    text
    copied!<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/13776320/microsoft-access-and-java-jdbc-odbc-error">Microsoft Access and Java JDBC-ODBC Error</a> </p> </blockquote> <p>I had issues with creating my DB to begin with. I have a 64bit version of Windows 7 and found out the error was with Microsoft Office being 32bit. I was able to create my Access database by using the odbcad32.exe found in c:\Windows\sysWOW64\odbcad32.exe</p> <p>Now in my Java code I am simply trying to get connected but am running into issues again that seem to be related, and make me feel like at the most I just didn't set up the database correctly. JavaDB is the name of my data source I created in the ODBC:DSA as you can see here: <a href="https://i.imgur.com/9n19x.png" rel="nofollow noreferrer">http://i.imgur.com/9n19x.png</a></p> <p>I've been searching all over the internet but can't really find a solid definite answer. Could really use the help, thanks in advanced! </p> <p>EDIT: I cleaned up my code and now my error is different. I have my physical database file in my project folder at C:\Eclipse\project1\src - I have set it up as well like I said in the ODBC to be the same.</p> <p>EDIT EDIT: Well, after hours and hours of research I ended up just figuring it out finally. The issues wasn't as much my code, as it was compatibility issues with Windows x64BIT and 32 bit drivers in Office. This article helped me fix it, and now it works! <a href="http://www.selikoff.net/2011/07/26/connecting-to-ms-access-file-via-jdbc-in-64-bit-java/" rel="nofollow noreferrer">http://www.selikoff.net/2011/07/26/connecting-to-ms-access-file-via-jdbc-in-64-bit-java/</a></p> <pre><code>import java.sql.*; public class DBTester { public static void main(String[] args) throws SQLException, ClassNotFoundException { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String fileName = "C:/Eclipse/school/bin/RegistrationDB.mdb"; String dB = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ="+fileName; Connection connection = DriverManager.getConnection(dB,"",""); System.out.println("connected"); Statement s = connection.createStatement(); s.close(); connection.close(); } catch(Exception ex) { ex.printStackTrace(); } } // end main } // end class </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload