• 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Connecting to MySQL

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everyone,

I am quite new in using JDBC, I know this question is repeated but as i couldn't solve problem so writing you for help.

I am running this program in eclipse with Windows vista and MySQL and receiving this error "Cannot connect to database serverjava.lang.ClassNotFoundException: com.mysql.jdbc.Driver"

I copied all extracted file of "mysql-connector-java-5.1.6" in MySQLDB package and also tried by setting the classpath but always get error.

I'll be very thankful to you for help in this regard.
[ August 14, 2008: Message edited by: Tahir Abbas ]
 
author & internet detective
Posts: 39343
755
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tahir,
Is this a standalone Java program in Eclipse? If so, can you confirm the mysql jar is in your project's build path. If not, what server are you using?
 
Tahir Abbas
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! for help, yea problem was in build path i am writing steps may be helpful for someone else.

1- After opening project window(menu) > Preference then select Java>build Path > classpath variable and click on new button and give variable name and path of unzipped mysql connector folder in the appeared dialogue box, click ok again ok.

2- Right click on Project Properties select Java Build Path then click on Libraries tab then click on classpath variable. Select the newly formed variable from the list then click on Extend button ___.jar file will appear click on jar file then click ok, ok.

This way i got right output.

Thanks! for help and Regards
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!