File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
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: 2563

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:
subject: Accessing MySQL from NetBeans
It's not a secret anymore!