Win a copy of Mesos in Action this week in the Cloud/Virtualizaton 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!
 
Vyas
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try importing it as a library or put it in the Netbeans tomcat/lib
 
Jan Cumps
Bartender
Posts: 2588
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You did not mention your Netbeans Version, but here is how it works in NetBeans 6:

Right click on your project -> Properties
Category Libraries
Compile tab
Add JAR / Folder.

Locate the driver jar and confirm.

Regards, Jan
 
Mahi Rahman
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hei Jan!

Great! I use NetBeans 5.5 and I found the steps you suggested is also applicable to this version. And, it's now working! Thanks a lot for your tips!

Mahi.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic