Sun.jdbc.JdbcOdbcDriver ClassNotFound

This is a double post sorry, but I must have miss-clicked the wrong forum when posting originally.
sun.jdbc.JdbcOdbcDriver ClassNotFoundException
I'm getting class not found exception and I cannot work out why, code is below.
import java.sql.*; public class Main {     public static void main(String[] args)     {                 try         {             Connection c = Connect.openDatabase             ("jdbc:mysql://localhost/booksdb:3306", "root", "dbsd202");             Statement statement = c.createStatement();             ResultSet rs = statement.executeQuery("Select * from titles");                         while (rs.next())             {                 System.out.printf("%s\t%s\t%s\n",                 rs.getObject("title"), rs.getObject(1));             }         }         catch (SQLException e)         {             e.printStackTrace();         }      } } class Connect {     static Connection conn;     static Connection openDatabase(String url,String user,String pw)     {         try         {             Class.forName("sun.jdbc.JdbcOdbcDriver");             conn = DriverManager.getConnection(url,user,pw);         }         catch(Exception e)         {             System.out.printf("%s\n", e);             conn = null;         }         return conn;     } }

Darryl Burke wrote:
G-Unit wrote:
Never mind solved.And you will share the solution with the community, won't you?
dbOf course :)
The class name cannot be found because "sun.jdbc.JdbcOdbcDriver" does not exist.
The correct class name is "sun.jdbc.odbc.JdbcOdbcDriver".
The way I found that out was actually searching through the java source code for the class, and I'm assuming that is correct as when I changed it I started getting another error: "java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/booksdb:3306
Exception in thread "main" java.lang.NullPointerException
     at sql.Main.main(Main.java:26)"

Similar Messages

  • Sun.jdbc.JdbcOdbcDriver ClassNotFoundException

    Hello, I'm using Eclipse, I have created a small test class as I have never used SQL before(except for some querying) and have imported the MySQL connector J .jar, and the whole folder directory (just to be sure).
    I keep getting ClassNotFoundException on "sun.jdbc.JdbcOdbcDriver" which is preventing me from getting this to work.
    Is the class name a typo ? or what should the code look like?
    import java.sql.*;
    public class Main
        public static void main(String[] args)
            try
                Connection c = Connect.openDatabase
                ("jdbc:mysql://localhost/booksdb:3306", "root", "dbsd202");
                Statement statement = c.createStatement();
                ResultSet rs = statement.executeQuery("Select * from titles");
                while (rs.next())
                    System.out.printf("%s\t%s\t%s\n",
                              rs.getObject("title"), rs.getObject(1));
            catch (SQLException e)
                e.printStackTrace();
    class Connect
        static Connection conn;
        static Connection openDatabase(String url,String user,String pw)
            try
                Class.forName("sun.jdbc.JdbcOdbcDriver");
                conn = DriverManager.getConnection(url,user,pw);
            catch(Exception e)
                System.out.printf("%s\n", e);
                conn = null;
            return conn;
    }

    I'm not really a java expert, but as far as I know you have to install the jdbc-driver and to add the path to the driver to CLASSPATH-variable.
    If that doesn't help, you shoul post you question in a java forum, e.g. this one:
    http://forums.oracle.com/forums/category.jspa?categoryID=288

  • Where can i download (free) sun.jdbc.odbc.JdbcOdbcDriver?

    where can i download (free) sun.jdbc.odbc.JdbcOdbcDriver?... could u please give me the downlaod path...thanks...thanks million
    mag

    What if that code indicates you don't have it? i
    keep getting a ClassNotFound error for
    sun.jdbc.odbc.JdbcOdbcDriver. i can't d/l the JDK
    from Sun, i'm on OS X; i have downloaded it from
    Apple. i can't find the class anywhere, nor anywhere
    online. ODBC (not java) requires drivers which are OS specific. So it doesn't matter if you have the JDBC driver if you can't find the ODBC driver for the database that you want.
    i thought i was supposed to be able to code
    Java on OS X just fine?JDBC works. That is part of java.
    Drivers are not part of java. They are separate products.
    I suspect that, for example, if you want to connect to Oracle and you get the type 4 drivers from Oracle that they will work just fine on that OS.
    You might find that for the database that you are using that there is no driver (explicitly) for that OS though.

  • The driver: sun.jdbc.odbc.JdbcOdbcDriver could not be loaded with jws

    Hi,
    When I execute my executable jar file, there is no problem but when I open my .jnlp with web start, I obtain my main frame but the queries don't work.
    I have the error message below :
    Java Web Start 1.2 Console, d�marr�e Fri Apr 25 14:55:59 CEST 2003
    Environnement d'ex�cution Java 2 : version 1.3.1 par Sun Microsystems Inc.
    See com.borland.dx.dataset.DataSetException error code: BASE+83
    com.borland.dx.dataset.DataSetException: The driver: sun.jdbc.odbc.JdbcOdbcDriver could not be loaded. This could be a problem with the driver itself, or that the driver is not found on the classpath.
         at com.borland.dx.dataset.DataSetException.a(Unknown Source)
         at com.borland.dx.dataset.DataSetException.driverNotLoadedAtRuntime(Unknown Source)
    Anyone can help me please?

    Almost certainly, you need to include the JAR file that contains the class in question as a resource in your JNLP. My personal preference for this kind of thing is to have an entry that actually points to another JNLP for the driver (database, e-mail, whatever you need).
    In general, the whole application has to be packaged so that JWS is aware of all the pieces (other than the JRE)--one other thing I've done in some cases is put the driver JAR's into the jre/lib/ext directory.
    HTH,
    J M Craig

  • Use of sun.jdbc.odbc.JdbcOdbcDriver

    Hi, I'm starting to work with Java and I'm trying to connect to a SQL Server 2000 database using "sun.jdbc.odbc.JdbcOdbcDriver" driver but when I try to make the connection I get this error:
    "java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    Cannot get connection"
    Here is the my code:
    final static private String _driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    final static private String _url = "jdbc:odbc:<databasename>";
    Class.forName(_driver);                    // Load Driver
    c = DriverManager.getConnection(_url, "<user>", "<passwd>");
    } catch (java.lang.ClassNotFoundException e){
    System.out.println(e.toString());
    System.out.println("Cannot find driver class");
    System.exit(1);
    } catch (java.sql.SQLException e) {
    System.out.println(e.toString());          
    System.out.println("Cannot get connection");
    System.exit(1);
    Someone can help me with this ?? I'm stuck !!
    Thanks !!

    Hi, I'm starting to work with Java and I'm trying to
    connect to a SQL Server 2000 database using
    "sun.jdbc.odbc.JdbcOdbcDriver" driver but when I try
    to make the connection I get this error:
    "java.sql.SQLException: [Microsoft][ODBC Driver
    Manager] Data source name not found and no default
    driver specified
    Cannot get connection"
    Here is the my code:
    final static private String _driver =
    "sun.jdbc.odbc.JdbcOdbcDriver";
    final static private String _url =
    "jdbc:odbc:<databasename>"; the DSN that you set up for connecting to your database. is it called <databasename>? somehow i doubt it.

  • The driver: sun.jdbc.odbc.JdbcOdbcDriver could not be loaded with I use jws

    Hi,
    I use Java web start and the problem is that java web start can't be loaded the driver.
    Here is my error message :
    See com.borland.dx.dataset.DataSetException error code: BASE+83
    com.borland.dx.dataset.DataSetException: The driver: sun.jdbc.odbc.JdbcOdbcDriver could not be loaded. This could be a problem with the driver itself, or that the driver is not found on the classpath.
    at com.borland.dx.dataset.DataSetException.a(Unknown Source)
    at com.borland.dx.dataset.DataSetException.driverNotLoadedAtRuntime(Unknown Source)
    at ...
    In my .jnlp I put :
    <resources>
    <j2se version="1.3+" />
    <jar href="ManipulationLigneAS400.jar" /> it's my application
    <jar href="classes12.zip" />
    </resources>
    I don't know what .jar I have to put?
    Someone could help me please?

    Hi,
    see your thread http://forum.java.sun.com/thread.jsp?forum=31&thread=385994
    Ulrich

  • Do I need to download sun.jdbc.odbc.JdbcOdbcDriver ??

    Do I need to download sun.jdbc.odbc.JdbcOdbcDriver ??
    Thank you in advance.

    The JDBC/ODBC bridge comes with the JDK/JRE, at least since 1.2, I don't know about 1.1.
    Col

  • What do I need to use sun.jdbc.odbc.jdbcOdbcDriver

    hi there
    what do I need to use sun.jdbc.odbc.jdbcOdbcDriver to access MS Access database?
    String sourceURL = "jdbc:odbc:mysource";
    String sqlQuery = "select ComsumerAccountNumber from EDS5";
    //getting a connection
    try {
    Class.forName(driverName);
    Connection databaseConnection = DriverManager.getConnection(sourceURL);
    Statement statement = databaseConnection.createStatement();
    ResultSet rs = statement.executeQuery(sqlQuery);
    while(rs.next()){
    ...some code to do with the results
    catch (ClassNotFoundException cnfe) {
    System.err.println(cnfe.getMessage());
    catch (SQLException sqle) {
    System.err.println(sqle.getMessage());}
    I got error and caught it in catch( classnotfoundexception). no driver. is this the correct way to use a driver. I have created a data source.

    make sure the driverName is "sun.jdbc.odbc.JdbcOdbcDriver"
    I noticed you typed in your message "sun.jdbc.odbc.jdbcOdbcDriver" with a lowercase 'j'

  • How can i put a file into blob(using sun.jdbc.odbc.JdbcOdbcDriver)

    Hi
    i tried to put a file into blob , but got a problem.....
    My environment:windows 2000pro,JBuilder 5.0 enterprise,oracle 8.1.6,(not install oracle jdbc driver )
    a part of program(my program is very uglily,if anyone want,later i paste it ba....~_~)
    //Statement stmt2=null;
    //Resultset rs2;
    //opa1 is the blob data
    void saveBlobTableToDisk(Connection con) {
    try {
    stmt2=con.createStatement();
    sqlStr2="SELECT * FROM emp3 where id=1004";
    rs2=stmt2.executeQuery(sqlStr2);
    while (rs2.next()) {
    Blob aBlob=rs2.getBlob("opa1");
    i got the exception :
    " null
    java.lang.UnsupportedOperationException
         at sun.jdbc.odbc.JdbcOdbcResultSet.getBlob(JdbcOdbcResultSet.java:4174)
         at test3.Frame1.saveBlobTableToDisk(Frame1.java:48)
         at test3.Frame1.<init>(Frame1.java:26)
         at test3.Application1.<init>(Application1.java:5)
         at test3.Application1.main(Application1.java:8) "
    and the windows pop up a messagebox said that(about) my memory "0x09af007f" could not read, error in javaw.exe .
    Later i used (ResultSet)getBinaryStream() to solve it. but getBinaryStream() only return a InputStream,so that i can make blob to a file,but i can't make a file to blob using jdbc.....
    I am very stupid that installing sun java, oracle jdbc driver etc....(because i must set a lot of thing such as classpath,java_home etc), Can i only use JBuilder to do that ?
    Or i must install oracle jdbc driver ?
    Thanks.

    My guess here is that Sun's JDBC-ODBC bridge doesn't handle the BLOB datatype. Most ODBC drivers don't support that datatype, so I wouldn't expect the bridge to.
    Is there a reason that you can't use the Oracle driver?
    Justin

  • Is it possible to connect to mysql using sun.jdbc?

    Is it possible to connect to a mysql database using sun's jdbc:odbc driver?
    I develop a page on the internet that uses mysql. The connection code is placed in a java class. I get the errormessage: "no suitable driver" when I try to connect with jsp/java classes.
    If I use PHP it is ok.
    Code:
    $db = mysql_connect("localhost", "vegg", "nbvv2003");
    mysql_select_db("vegg_timereg",$db);
    $result = mysql_query("SELECT * FROM bruker",$db);The java code is like this:
    java.sql.Connection conn = null;
    String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    try {
          Class.forName(driver);
          conn = DriverManager.getConnection("jdbc:odbc:vegg_timereg","vegg","nbvv2003");
        catch (SQLException e) {
          out.print("<font color=red>Error:</font> SQLException<br>");
          out.print(e.getMessage());
        catch (ClassNotFoundException e) {
          out.print("<font color=red>Error:</font> Driver not found<br>");
          out.print(e.getMessage());
        catch (Exception e) {
          out.print("<font color=red>Error:</font> Error on initializing<br>");
          out.print(e.getMessage());
        }For me it does not seem like there are any drivers available in java, I've tried the sun.jdbc.odbc.JdbcOdbcDriver and org.gjt.mm.mysql.Driver. The mySql driver is missing, so that is the reason, but I do not get an error message when importing the jdbc:odbc driver.
    I do not have permission to check the setup on the webserver:(
    It runs Apache webserver.

    thx, but I don't seem to get any databases. It works when I run it locally, but on the external webserver it doesn't.
    Database info:
    Name: vegg_timereg
    Place: localhost (root)
    Type: mySQL
    It doesn't seem like the mysql driver is installed on the server, so I have to use jdbc. I do not have any permissions on the server, so I can't check it out myself.
    In PHP this connection works:
    $db = mysql_connect("localhost", "vegg", "nbvv2003");
    mysql_select_db("vegg_timereg",$db); I've tried like this (using java.sql.Driver): Class.forName("java.sql.Driver");
    conn = DriverManager.getConnection("jdbc:localhost/vegg_timereg","username","password");This is really annoying when it's so easy on my machine...

  • How do I get the SUN jdbc-odbc bridge to work?

    Hi,
    I'm trying to us the SUN 1.2 jdbc-odbc bridge on Oracle 8.
    I have installed the ODBC driver from www.intersolv.com
    (Merant) and have successfully tested it.
    I have SUN 1.2 installed and verified that
    the sun JdbdOdbcDriver is in my CLASSPATH.
    My driver path is:
    sun.jdbc.odbc.JdbcOdbcDriver
    My url is
    jdbc:odbc:Oracle8
    my odbc.ini is correct, and my ODBCINI is set.
    when I try to connect I get "No suitable driver".
    The SUN documentation indicates this error means
    my shared libraries aren't correct, but I have
    verified my ODBC setup with a odbc demo app.
    Any suggestions on how to form my url?
    Has anyone used the bridge on Solaris?
    null

    The display is just too dim.  I tried the brightness and backlight settings and these do not work.  This has been like this since I bought it.  Never bothered to deal with it before and just made do with reading a very dim menu.

  • Integrating sun's JdbcOdbcDriver into Websphere 5?

    Hello all, i'm in the middle of migrating an application that was running on tomcat to WAS5.1. All my database connection are working except for the ones that use the JdbcOdbcDriver. As tomcat used sun's jdk I had no problems before but now that I'm tied to IBMs bundled jre I'm at a loss of what to do. I don't like it but i added Sun's rt.jar file that contains the driver class to my WAS classpath but I get some sort of initialization error:
    java.lang.NullPointerException
         at sun.jdbc.odbc.JdbcOdbcDriver.initialize(JdbcOdbcDriver.java:436)
         at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:153)
         at java.sql.DriverManager.getConnection(DriverManager.java:538)
    All i really want is my old odbc driver bridges to work for .txt .dbf and .csv querying. Can someone give me some suggestions on what to do? Websphere's google group hasn't seem to discuss this issue since 2003 so maybe i'm on the wrong track entirely. Here is a example of the code i'm using just incase you are curious to the means:
    case Constants.MS_DBF:
         Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
         StringBuffer dbsrc_dbf = new StringBuffer();
         dbsrc_dbf.append("jdbc:odbc:DRIVER={Microsoft dBase Driver (*.dbf)};");
         dbsrc_dbf.append("UserCommitSync=Yes;Threads=3;Statistics=0;SafeTransactions=0;");
         dbsrc_dbf.append("PageTimeout=5;MaxScanRows=8;MaxBufferSize=2048;FIL=dBase 5.0;");
         dbsrc_dbf.append("DriverId=533;Deleted=1;DefaultDir=");
         dbsrc_dbf.append(db);
         connection = DriverManager.getConnection( dbsrc_dbf.toString(), "", "" );
    break;
    Thanks in advance for help on this. graeme.

    try this if you're still having problems(think you already solvet it, anyway...)
    env.put(..);
    env.put(..);
    System.setProperty("javax.net.ssl.trustStore",FILE_JKS_PATH);
    it worked fine for me,even if it was a websphere 4.* version.

  • Package sun.jdbc.rowset does not exist

    Hi,
    I am tryng to use a CachedRowSet in a JSP page. I got rowset.jar from sun and I put it in my classpath. When I try to import sun.jdbc.rowset I have the message "package sun.jdbc.rowset does not exist".
    Please, could someone help me?
    Tanks,
    Celso

    Hi,
    Unfortunately not... The name of the package is rowset...
    Some others ideas? Thanks,
    Celso

  • How to setting up the sun.jdbc driver in servlet

    in my servlet i implemens the MetaData Interface, The Sun JDBC driver was Not support the getMetaData() function .. I dont knw why it was
    Pls hel me

    http://www.apple.com/support/iphone/assistant/airprint/

  • Problem with sun.jdbc.rowset.CachedRowSet.

    Hi All,
    I cannot not able to import the package 'sun.jdbc.rowset.CachedRowSet'.
    while writing the path in the jsp:useBean or import to java class it shows at the compilation time that
    Error JavaCompile: sun.jdbc.rowset cannot be resolved.
    Is there any jar file needed and if then where i can find it.
    actually i need to import this for implementing the large row in paging system in jsp page.
    Thanks in advance.
    Regards
    ukbasak

    hi,
    Another link which to point over the rowset.jar file
    http://forums.systeminetwork.com/isnetforums/archive/index.php?t-36523.html

Maybe you are looking for