File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java 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 » Java » Beginning Java
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!
Bill Cruise
Ranch Hand

Joined: Jun 01, 2007
Posts: 148
There's a good article on the NetBeans site at 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 ( I recommend it specifically because it is implemented in Java, and you can use the same driver to test with.
I agree. Here's the link:
subject: Accessing MySQL from NetBeans
It's not a secret anymore!