aspose file tools*
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
Author

Accessing MySQL from NetBeans

Mahi Rahman
Greenhorn

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

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

Joined: Dec 20, 2006
Posts: 2510
    
  10

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
youtube channel
Mahi Rahman
Greenhorn

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!

Mahi.
 
jQuery in Action, 2nd edition
 
subject: Accessing MySQL from NetBeans