wood burning stoves 2.0
The moose likes IDEs, Version Control and other tools and the fly likes Accessing MySQL from NetBeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Accessing MySQL from NetBeans" Watch "Accessing MySQL from NetBeans" New topic

Accessing MySQL from NetBeans

Mahi Rahman

Joined: Feb 16, 2007
Posts: 21

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!

Joined: May 21, 2007
Posts: 17
Try importing it as a library or put it in the Netbeans tomcat/lib
Jan Cumps

Joined: Dec 20, 2006
Posts: 2565

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

OCUP UML fundamental and ITIL foundation
Mahi Rahman

Joined: Feb 16, 2007
Posts: 21
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!

I agree. Here's the link: http://aspose.com/file-tools
subject: Accessing MySQL from NetBeans
It's not a secret anymore!