Welcome to SPN

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

Sign Up Now!
  1. Guest ji, please consider donating today!
      Become a Supporter    ::   Make a Contribution   
    Monthly Recurring Target: $300 :: Achieved: $95

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
    >
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page