Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Posts
    13

    Question Unanswered: simple JSP connect MySQL error

    I'm receiving this error:
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver is an unknown class

    My .bashrc and .bash_profile files have the PATH and CLASSPATH formatted like:
    PATH=$JAVA_HOME/bin:$PATH:$HOME/bin:$RESIN_HOME/bin:/root/sun/j2eesdk1.4_beta2/jdk/jre/lib/ext/mysql-connector-java-3.0.9-stable-bin.jar
    CLASSPATH="/root/sun/j2eesdk1.4_beta2/jdk/jre/lib/ext/mysql-connector-java-3.0.9-stable-bin.jar:$CLASSPATH"

    My db connection is like:
    Class.forName("com.mysql.jdbc.Driver").newInstance ();
    Connection conn = DriverManager.getConnection("jdbc:mysql://192.168.4.202:3306/ts?user=mysql&password=mysql");
    Statement stmt = conn.createStatement();

    The error is obviously caused by the jvm not being able to locate the driver... but I'm not sure why it can't find it with the above information specified.

    Any help would be greatly appreciated !
    Thanks !
    ==
    Dylan

  2. #2
    Join Date
    Oct 2003
    Posts
    13

    Exclamation fixed

    *phew... it is fixed now ... resolution:

    I'm running Resin, and probably just like any other Servlet/JSP server, you need to have the MySql driver located in the /lib directory.

    I don't know exactly which /lib directory was needed, but I put it in every /lib directory I had in my $JAVA_HOME install dir, and in every /lib directory in my Servlet/JSP server installation.
    (including WEB-INF/lib/)

Posting Permissions

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