Skip to main content

How to connect to a database in Netbeans??

1 reply [Last post]
Joined: 2008-01-31

Plz help... im a newbie in java and im using Netbeans 6. i was creating a program to manipulate a database(embedded) but i got an error in my program the error is "ClassNotFoundError" when im trying to load JavaDB drive "org.apache.derby...." in Netbeans(database on the different directory). BUT when i try to paste my CODE in a text editor and run it manually it work fine(.class, .java, and database in the same directory). plz... help bcoz im stuck on this...
tnx in advance!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-01-02

Open NetBeans. Under Services tab open/expand Databases. Right-click on Databases and select New Connection. New Database Connection window opens.
Beside Name select the type of database driver you are using for your connection.
For Database_Url type the Url used for the particular database you are using, for instance MySQL uses jdbc:mysql://:/, host=localhost, port=3306, DB=nameofyourdatabase. Then type the username and password that you use to start your SQL server. Thats all you need.