Menu

Unable to find a suitable driver

Help
Ionna
2014-04-26
2014-04-28
  • Ionna

    Ionna - 2014-04-26

    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!

     
  • Marco Amadei

    Marco Amadei - 2014-04-26

    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
    • Ionna

      Ionna - 2014-04-27

      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?

       
  • Marco Amadei

    Marco Amadei - 2014-04-28

    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

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.