| Author |
java jdbc
|
dhanil das
Greenhorn
Joined: Sep 04, 2009
Posts: 7
|
|
sir, I got some errors when i execute my first java program to connect the "MYSQL" database ,here is the code
it compiles successfully , but show this error during running ,
:>java JdbcConnection
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
please help me
|
 |
James Ward
Ranch Hand
Joined: Apr 27, 2003
Posts: 263
|
|
You do not have MySQL driver in your classpath.
It is a jar file with a name like: mysql-connector-java-5.1.5-bin.jar, include it in your classpath.
|
 |
dhanil das
Greenhorn
Joined: Sep 04, 2009
Posts: 7
|
|
Thanks for your quick reply sir , here i got the solution to our problem ,here it is
set path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\Sun\SDK\bin;C:\Program Files\Java\jdk1.6.0_03\bin;;C:\Program Files\Java\jdk1.6.0_03\bin;
set classpath=;C:\Program Files\Java\jdk1.6.0_03\bin;;C:\ProgramFiles\Java\jdk1.6.0_03\bin;C:\mysql-connector-java-5.0.8\mysql-connector-java-5.0.8-bin.jar;
thank you sir
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32833
|
|
|
Don't put your Java installation folders in your CLASSPATH. Don't keep your own work in your Java installation folder.
|
 |
avijit majumder
Greenhorn
Joined: Sep 01, 2009
Posts: 15
|
|
put the mysql driver on your project folder or where the java file run.
the driver -->.JAR File name is mysql-connector-java-3.1.11-bin.jar . [download it from net]
then extract it
after extract three folder com,META-INF,org apper.
Now Run the file. ___IT WORK.
|
 |
nick kaushik
Ranch Hand
Joined: Sep 25, 2009
Posts: 48
|
|
why does he have path defined 2 times?
C:\Program Files\Java\jdk1.6.0_03\bin;;C:\Program Files\Java\jdk1.6.0_03\bin;................?
|
"ye shall know the truth & the truth shall set you free..."
|
 |
Vijitha Kumara
Bartender
Joined: Mar 24, 2008
Posts: 3673
|
|
nick kaushik wrote:why does he have path defined 2 times?
C:\Program Files\Java\jdk1.6.0_03\bin;;C:\Program Files\Java\jdk1.6.0_03\bin;................?
Only one is required. If you have more (for several JDK versions) first one is taken.
|
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32833
|
|
|
It does no harm to have the same thing twice in one's PATH. We only get complaints when something isn't in the PATH at all.
|
 |
 |
|
|
subject: java jdbc
|
|
|