Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Problems connecting to database using Java.

Discussion in 'Information Technology' started by questionmarc420@msn.com, Jul 28, 2006.

  1. questionmarc420@msn.com

    questionmarc420@msn.com
    Expand Collapse
    Guest

    hi,
    im having toruble connecting to MS Access DB using Java.
    This is the code i used:

    public void connect(){

    try {
    Class.forName("sun.jdbc.odbc.JbdcOdbcDriver");
    } catch (ClassNotFoundException e) {
    e.printStackTrace();
    }


    String databaseName = "invent";
    String url = "jdbc:eek:dbc:" + databaseName;
    String loginName = "Admin";
    String password = "lace";


    try {
    conn01 = DriverManager.getConnection(url,
    loginName, password);
    } catch (SQLException e) {
    e.printStackTrace();
    }
    }



    this is the error i get:

    java.lang.ClassNotFoundException: sun.jdbc.odbc.JbdcOdbcDriver
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at allm.test.DBaccess.connect(DBaccess.java:18)
    at allm.test.test.main(test.java:17)
    java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at allm.test.DBaccess.connect(DBaccess.java:29)
    at allm.test.test.main(test.java:17)


    can somebody please pooint me in the right direction.
    do i need to configure somethign in access? is there any thing i have
    to do in the ODBC configurations?

    any help is appreciated.
    thanks in advance
    -morc
     
  2. Loading...

    Similar Threads Forum Date
    Sikh News Sikhs Face Problems While Carrying Kirpans In Khyber-Pakhtunkhwa - SikhSiyasat.Net Breaking News Jul 29, 2016
    "Dasam" Granth - A Look At The Core Problems Dasam Granth Oct 21, 2015
    Problems In Life Sikh Sikhi Sikhism Apr 13, 2015
    Muslim Girl-Sikh Boy Marriage Problems- Please Help! Love & Marriage Oct 12, 2012
    Problems with Sikh Historiography-prof Jagdish Singh Sikh Video Aug 31, 2012

  3. Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    Sorry, but I think you're going to need to ask in a Java-related newsgroup.

    Realistically, you're not using Access: you're attempting to connect to a
    Jet database.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no private e-mails, please)


    <questionmarc420@msn.com> wrote in message
    news:1148500886.695752.57100@u72g2000cwu.googlegroups.com...
    > hi,
    > im having toruble connecting to MS Access DB using Java.
    > This is the code i used:
    >
    > public void connect(){
    >
    > try {
    > Class.forName("sun.jdbc.odbc.JbdcOdbcDriver");
    > } catch (ClassNotFoundException e) {
    > e.printStackTrace();
    > }
    >
    >
    > String databaseName = "invent";
    > String url = "jdbc:eek:dbc:" + databaseName;
    > String loginName = "Admin";
    > String password = "lace";
    >
    >
    > try {
    > conn01 = DriverManager.getConnection(url,
    > loginName, password);
    > } catch (SQLException e) {
    > e.printStackTrace();
    > }
    > }
    >
    >
    >
    > this is the error i get:
    >
    > java.lang.ClassNotFoundException: sun.jdbc.odbc.JbdcOdbcDriver
    > at java.net.URLClassLoader$1.run(Unknown Source)
    > at java.security.AccessController.doPrivileged(Native Method)
    > at java.net.URLClassLoader.findClass(Unknown Source)
    > at java.lang.ClassLoader.loadClass(Unknown Source)
    > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    > at java.lang.ClassLoader.loadClass(Unknown Source)
    > at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    > at java.lang.Class.forName0(Native Method)
    > at java.lang.Class.forName(Unknown Source)
    > at allm.test.DBaccess.connect(DBaccess.java:18)
    > at allm.test.test.main(test.java:17)
    > java.sql.SQLException: No suitable driver
    > at java.sql.DriverManager.getConnection(Unknown Source)
    > at java.sql.DriverManager.getConnection(Unknown Source)
    > at allm.test.DBaccess.connect(DBaccess.java:29)
    > at allm.test.test.main(test.java:17)
    >
    >
    > can somebody please pooint me in the right direction.
    > do i need to configure somethign in access? is there any thing i have
    > to do in the ODBC configurations?
    >
    > any help is appreciated.
    > thanks in advance
    > -morc
    >
     

Share This Page