CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> CodeCharge Studio -> Java

 JDBC MySQL Driver

Print topic Send  topic

Author Message
CuchoBoy
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
Class.forName("com.mysql.jdbc.Driver").newInstance();
} 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!!!
eserver221
Posted: 06/14/2005, 5:54 PM

CuchoBoy,
you should set ENVRIOMENT VARIABLE CLASSPATH like this:
CLASSPATH=$CLASSPATH:/www/tomcat/common/lib/(yourdriver).jar (under Unix )
or
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

eserver220



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

:-):(:-D8-):*):-/:-{}:-X:-O:-@O:):-P:-<:-(:-|;-)
RFU3
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
randomhelpfulperson
Posted: 07/07/2005, 7:38 AM

I kept getting the com.mysql.jdbc.Driver exception (win xp pro sp2, java sdk 1.4.2.08) 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,
eg
c:\file; d:\dir ect ory\file; e:\filename
becomes
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.
Regards,
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 http://support.yessoftware.com.

MS Access to Web

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

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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