If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > simple JSP connect MySQL error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-15-03, 15:11
ilikeitraw ilikeitraw is offline
Registered User
 
Join Date: Oct 2003
Posts: 13
Question 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
Reply With Quote
  #2 (permalink)  
Old 10-15-03, 18:14
ilikeitraw ilikeitraw is offline
Registered User
 
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/)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On