• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java jdbc

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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



 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't put your Java installation folders in your CLASSPATH. Don't keep your own work in your Java installation folder.
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 48
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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;................?
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Campbell Ritchie
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic