CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.

YesSoftware Forums -> CodeCharge Studio -> Java

 JDBC MySQL Driver

Print topic Send  topic

Author Message
Posted: 06/04/2005, 10:42 AM

Quote kuldeep:
hello frnds

i do have in configuring the mysql

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
// Notice, do not import com.mysql.jdbc.*
// or you will have problems!
public class LoadDriver {
public static void main(String[] args) {
try {
// The newInstance() call is a work around for some
// broken Java implementations
} catch (Exception ex) {
// handle the error

it gives the exception:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

and using the following also

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
... try {
Connection conn = DriverManager.getConnection( "mysql","username","password");
} catch (SQLException ex) {
// handle any errors
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());

gives the same exception:

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

i have included the .jar file of the driver in to the web-inf/lib of the Tomcat and also in to the Java Home directory i.e. jre/lib/ext ....
and still facing these problems

plz do help me

Same problem here, plz help!!!
Posted: 06/14/2005, 5:54 PM

you should set ENVRIOMENT VARIABLE CLASSPATH like this:
CLASSPATH=$CLASSPATH:/www/tomcat/common/lib/(yourdriver).jar (under Unix )
CLASSPATH = %CLASSPATH%; c:\tomcat\common\lib\(youardriver).jar

if you want to run the program above as a single application, you can put the jar file to any directory you like. but if you use tomcat as the jsp container you should put it in tomcat/common/lib, otherwise it would not work.

As far as how to include a jar into your CLASSPATH is concerned , you can refer to Think in Java 3rd. The book has an very specific explaination.

Best Regards


Posted: 06/24/2005, 4:43 AM

Posted: 07/07/2005, 3:19 AM

>Put jar in your classpath, either by adding the
>FULL path to it to your CLASSPATH enviornment variable, or putting it
>in $JAVA_HOME/jre/lib/ext.

Putting in $JAVA_HOME/jre/lib/ext solved my problem. I was getting Exception: com.mysql.jdbc.Driver
now its fine - great work, thanks dekacode :-D
Posted: 07/07/2005, 7:38 AM

I kept getting the com.mysql.jdbc.Driver exception (win xp pro sp2, java sdk but I managed to fix it last night. The solution may work for you too:

In the CLASSPATH environment variable make sure there are no spaces. If your path needs to contain a space then put quotes around the entry,
c:\file; d:\dir ect ory\file; e:\filename
c:\file;"d:\dir ect ory\file";e:filename
Victor Twomey
Posted: 07/16/2005, 7:29 AM

After setting path and classpath correctly and moving jar file to jre lib ext file, the Load Driver program ran successfully. Thanks for the help. Now if I can only get the C api to cooperate with me I will be happy. Thanks for the tips. This was a helpful web site.
Victor Twomey
First Prev Page 2 of 2 

Add new topic Subscribe to topic   

These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

Home   |    Search   |    Members   |    Register   |    Login

Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by  and YesSoftware, Inc.