I might sound stupid with my question but my desire is to learn and understand. I have found out that JDBC ODBC Bridge is no longer available starting with JDK 8 so I downloaded Ucanaccess in order to establish my Java-MsAccess connection. I am using NetBeans. Now I am not sure I am installing/configuring this new driver correctly. So please tell me what I should do. This is what I have done so far:
- In the Services tab in NetBeans I set a New Driver
- In Driver Files I imported all the 5 jar files in the Ucanaccess zip
- In File Class I found: net.ucanaccess.jdbc.UcanaccessDriver
- In Name I wrote: Ucanaccess
Then I tested connection using the following JDBC URL: "jdbc:ucanaccess:C:\Users\Vasilica\Desktop\reper.accdb", but it failed and this is the error:
Cannot establish a connection to jdbc:ucanaccess:C:\Users\Vasilica\Desktop\reper.accdb using net.ucanaccess.jdbc.UcanaccessDriver (Unable to find a suitable driver)
Which may be the reason?
Thank you!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Ionna,
the reason is that the jdbc url is wrong:
NOT
jdbc:ucanaccess:C:\Users\Vasilica\Desktop\reper.accdb
BUT
jdbc:ucanaccess://C:\Users\Vasilica\Desktop\reper.accdb
You lost a //.
Also, with NetBeans you to set to true the connection parameter showschema:
Thank you very much! I've corrected the url. Now I get another problem:
I get a ClassNotFoundException when I am seting the following connection in code :
You're establishing a connection in a different way.
You still have to add ucanaccess.jar and all related dependencies in the classpath of your project. You could create a ucanaccess library to do this.
In this case you don't need showschema=true setting.
Cheers Marco
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I might sound stupid with my question but my desire is to learn and understand. I have found out that JDBC ODBC Bridge is no longer available starting with JDK 8 so I downloaded Ucanaccess in order to establish my Java-MsAccess connection. I am using NetBeans. Now I am not sure I am installing/configuring this new driver correctly. So please tell me what I should do. This is what I have done so far:
- In the Services tab in NetBeans I set a New Driver
- In Driver Files I imported all the 5 jar files in the Ucanaccess zip
- In File Class I found: net.ucanaccess.jdbc.UcanaccessDriver
- In Name I wrote: Ucanaccess
Then I tested connection using the following JDBC URL: "jdbc:ucanaccess:C:\Users\Vasilica\Desktop\reper.accdb", but it failed and this is the error:
Cannot establish a connection to jdbc:ucanaccess:C:\Users\Vasilica\Desktop\reper.accdb using net.ucanaccess.jdbc.UcanaccessDriver (Unable to find a suitable driver)
Which may be the reason?
Thank you!
Hi Ionna,
the reason is that the jdbc url is wrong:
NOT
jdbc:ucanaccess:C:\Users\Vasilica\Desktop\reper.accdb
BUT
jdbc:ucanaccess://C:\Users\Vasilica\Desktop\reper.accdb
You lost a //.
Also, with NetBeans you to set to true the connection parameter showschema:
jdbc:ucanaccess://C:\Users\Vasilica\Desktop\reper.accdb;showschema=true
Notice that you must use UCanAccess 2.0.4.1 with NetBeans, as explained in the UCanAccess web site, tab "JDBC Client tools".
Cheers Marco
Last edit: Marco Amadei 2014-04-26
Thank you very much! I've corrected the url. Now I get another problem:
I get a ClassNotFoundException when I am seting the following connection in code :
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
connection= DriverManager.getConnection ("jdbc:ucanaccess://C:\Licenta\April_SR\Database\reper.accdb;showschema=true","", "");
Could you please tell me why is that?
You're establishing a connection in a different way.
You still have to add ucanaccess.jar and all related dependencies in the classpath of your project. You could create a ucanaccess library to do this.
In this case you don't need showschema=true setting.
Cheers Marco