Windows 8.1. - Java - ODBC Driver - NetBeans -
this question has answer here:
- removal of jdbc odbc bridge in java 8 6 answers
i trying connect java app msaccess in netbeans ide (pls don't tell me not use access, because using in classes, , that's :)). didn't have problem on windows 7, , couldn't find answer using google, decided post question. so, it's this, have:
- windows 8.1 (64-bit)
- java jdk1.8.0 (32-bit)
- netbeans ide 8.0, , netbeans jdk home (from netbeans.conf) is: "c:\program files (x86)\java\jdk1.8.0", it's using 32-bit jdk.
code loading driver:
public void loaddriver() throws runtimeexception { try { class.forname("sun.jdbc.odbc.jdbcodbcdriver"); } catch (exception e) { throw new runtimeexception("could not load driver!"); } }
code opening connection:
public void openconnection() throws runtimeexception { try { connection = drivermanager.getconnection("jdbc:odbc:db"); connection.setautocommit(false); } catch (exception e) { throw new runtimeexception("could not connect!"); } }
of course, there's attribute: private connection connection; (and import java.sql.connection;)
there problem @ loading driver - it says "could not load driver". if have post more code or change in i've posted, please tell me , will.
i went to: syswow64 - odbcad32.exe - add... - microsoft access driver (*.mdb, *.accdb), , data source name i've put of course "db" (like in code above) , selected database (.accdb file) use. , don't know if windows 8 issue or i'm forgetting something, have no clue how make work.
the jdbc-odbc bridge has been removed java 8. alternative, see related question here:
Comments
Post a Comment