Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

java jdbc  RSS feed

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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: 59726
187
  • Mark post as helpful
  • send pies
  • 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
  • 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
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • 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: 4048
48
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • 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: 59726
187
  • Mark post as helpful
  • send pies
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!