Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing MySQL from NetBeans

 
Mahi Rahman
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

I am trying to get conncetion to MySQL database using this simple java class.




I have added the mysql driver to NetBeans IDE, but when I try to compile the file I get a ClassNotFound error (the file can't locate the mysqljdbc.jar). Can anybody please suggest me how to fix this? If I need to register the database specificaly for this program how to do it then?

Thanks in advace!
 
Bill Cruise
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's a good article on the NetBeans site at http://www.netbeans.org/kb/55/mysql.html. Based on what you've posted so far, I'd say go over the "Registering the Database in NetBeans IDE" section.

If that doesn't work, try connecting to your database using a third-party client like SQuirreL, and open source SQL client available on sourceforge (http://sourceforge.net/projects/squirrel-sql/). I recommend it specifically because it is implemented in Java, and you can use the same driver to test with.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic