Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting Connected

 
Claude Cundiff
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trying to run the following code:



I got this from a website, so I'm not claiming ownership - just want to get things working.

Also, in the directory com/chicken, I have the mySQL driver:
mysql-connector-java-5.1.6-bin

When I run this, I get the following message:
Exception: com.mysql.jdbc.Driver

What am I doing wrong.

Thanks!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Claude,
You don't need to claim ownership .

The most likely cause is that the mysql jar is not in your classpath.
 
Claude Cundiff
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for responding Jeanne.

It is my understanding that, by default, the JVM will look in the current directory. That being said, I moved the driver to my root directory which is C:\Java_Programs.

Now, here's another thought I had, in the code, do you think this part is incorrect?


I say this because shouldn't this be the location of my driver?
 
Claude Cundiff
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...and by the way, moving the driver didn't work - just to clarify.
 
Claude Cundiff
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys, for anyone having this same issue, this is a great resource:

http://en.wikipedia.org/wiki/Classpath_(Java)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic