Windows 8.1. - Java - ODBC Driver - NetBeans -


this question has answer here:

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:

manipulating access database java without odbc


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -