I want to link my MS access file with a Java GUI program, but I have a connection problem ....
I have Windows 7 64b and ms office 2007. When I opened the ODBC driver manager in the control panel, I did not find the driver for Microsoft Access (maybe when I started ODBC, I started working with 64-bit ODBC, now I think that 32 works -bit ODBC. I read this and I understood: "jdbc-odbc connection for window 7 of a 64-bit machine .. 1. Right-click the data source (ODBC) .. go to properties, change the following thing
target [% SystemRoot% \ SysWOW64 \ odbcad32.exe] start with: [% SystemRoot% \ System32]
press enter and continue as administrator source: source link ") Now, when I start in the ODBC control panel, I see the screenshoot driver
My program code (I tried two ways, but I have the same error):
public void Connect() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // String DatabaseFile = "D:java/Invertory.mdb"; // String DATABASE = // "jdbc:odbc:Driver=" // + "{Microsoft Access Driver (*.mdb, *.accdb)};" // + "DBQ=" + DatabaseFile;`enter code here` String DATABASE ="jdbc:odbc:Driver= Microsoft Access Driver (*.mdb, *.accdb);DBQ=Invertory.mdb"; CONEX = DriverManager.getConnection(DATABASE); } catch (Exception X) { X.printStackTrace(); //JOptionPane.showMessageDialog(null,e); } }
Mistake
java.sql.SQLException: [Microsoft] [ODBC driver manager] Data source name not found and specified default driver not specified
artiny
source share