-
jdbc and mysql
I am currently using jdbc to connect to a mysql database with the mysql driver mysql-connector-java-3.0.11-stable.jar (com.mysql.jdbc.Driver). It works just fine in JBuilder once it was added to JBuilders internal classpath. But no matter what I do I can't manage to get it to run from a jar file after setting windows xp pro classpath. Here is my classpath.
CLASSPATH=%CLASSPATH%;.;c:\mysql\jdbc\mysql-connector-java-3.0.11-stable-bin.jar
The correct path for the file is:
C:\mysql\jdbc\mysql-connector-java-3.0.11-stable.jar
I have also tried unzipping the jar file and then changing the class file to match the correct path but anyway I go I still get an exception.
I have rebooted since I changed the path. I have also tried manually setting the classpath when I exec the jar file with
java -cp C:\mysql\jdbc\mysql-connector-java-3.0.11-stable.jar -jar Res.jar
Any help is great, Its about to drive me crazy. Thanks
-
your classpath is incorrect.
you cannot edit the environment variable in that way and have your classpath come correct..
edit the classpath (right click my computer.. properties.. advanced.. env vars.. system vars.. classpath.. edit) to be:
c:\j2sdk_1.4.2_03\jre\lib\rt.jar;c:\mysql\jdbc\mysql-connector-java-3.0.11-stable-bin.jar;.
then DO NOT PUT the -cp switch into java..
just
java -jar Res.jar
no need to reboot, but you MUST close all command prompt windows and open a new one after you edit the variable
-
note that your java2 sdk might not be installed at that location.. edit the path, or better, edit the path in the JAVA_HOME dir, then make your classpath to be:
%JAVA_HOME%\jre\lib\rt.jar...(and so on)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks