I mange to connect to my MySQL after adding the "MySQL Connector/J 3.0 Driver". But it only worked using the Eclipse Editor (choosing the right jar-file in the "Run-section"). What I want to do is to install the driver in cmd. I tried to type "set CLASSPATH=C:\MySQL\mysql-connector-java-3.0.9-stable-bin.jar;%CLASSPATH%" in cmd but that didnt do it. I didnt get any error mesage, Im supose to add some line to code, like telling my application that I want to use the driver I have installed? Thanks for yout time
dont know how confident you are in java so dont want to insult you by saying the obvious, but have you looked at including the jar file in your execution command ? something like ... java -cp .;c:\mydir\myDBDriver.jar MyApp
SCJP 1.2, SCJP 5, SCBCD
Joined: Dec 03, 2003
Thanks for your reply! I havent tried the sollutions yet. But just to make sure, if you dont want to insult me, then dont. As simple as that. If I ask something basic, then I must be in basic stage of java. You have to start some where. Thanks for your time!
I have no idea why your CLASSPATH strategy isn't working. But have you tried copying that long-named jar file into the $JAVA_HOME\jre\lib\ext directory and leaving your CLASSPATH unchanged (i.e., from its original value)? I'm trying to remember where I read that the "ext" directory is where the Java interpreter finds "extension" classes, as distinct from "bootstrap" and "user" classes. Anyway, it seemed to work for me, not that I've done much with mySql.
You are correct Jay...The java intepreter will find any jar files located in the jdk\jre\lib\ext\ folder. If the jar files are put somewhere else, the path has to be made known my setting the classpath. I do have my mySQL jar file, servlet.jar, etc. in the above location.
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley