Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003

    Unanswered: MySQL JDBC driver class not found

    I'm having problem trying to connect to mysql using java application, it gives a classnot found exception, the classpath that I've specified is given below
    .;c:\mysql\;c:\oracle\ora92\jdbc\lib\;c:\ oracle\ora92\jdbc\lib\;c:\oracle\ ora92\sqlj\lib\;c:\oracle\ora92\sqlj \lib\;

    I did not have any problem connecting to oracle using jdbc drivers, the pertinent java codes are given below
    import sql.*;
    import io.*;

    Class.forName("com.mysql.jdbc.Driver").newInstance ();
    myConnection=DriverManager.getConnection (hostString, username,password);

    The problem is that it gives the following exception
    java.lang.ClassNotFoundException:com.mysql.jdbc.Dr iver
    same is the case if I use
    I tried expanding the zip file and giving the path in classpath, but it does not work. Any help is highly appreciated
    Thank you very much

  2. #2
    Join Date
    Dec 2003
    The only suggestions I have are these. I haven't seen using the newInstance() method called when loading the driver - simply use Class.forName("com.mysql.jdbc.Driver"); to load the driver.

    If it still doesn't work, then your code should be throwing an exception. Catch the exception and use the getMessage method to see if you can see anything odd about the error.

  3. #3
    Join Date
    Jan 2004
    What's inside your"\", actually, your must add only "mysql-connector-java-2.0.14-bin.jar" in your CLASSPATH. Basically, this file is packed inside zip file that you got from mysql site. Try to unzip it and find jar file and put it in your classpath

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts