Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect NetBeans to MySQL database?

I have just installed NetBeans 7.0 and I am a newbie in NetBeans' world. can any one tell me how to connect my application to MySQl / Postgres ? I work on Windows XP.

like image 893
Amit Avatar asked May 21 '11 11:05

Amit


People also ask

How do I connect to a MySQL database?

To Connect to a MySQL Database Expand the Drivers node from the Database Explorer. Right-click the MySQL (Connector/J driver) and choose Connect Using.... The New Database Connection dialog box is displayed. In the Basic Setting tab, enter the Database's URL <HOST>:<PORT>/<DB> in the corresponding text field.

Where is MySQL connector jar file in NetBeans?

In the option pane, click on Properties. Step 4: In properties, go to Libraries and click on the plus '+' tab of the Classpath and choose Add JAR/Folder. Step 5: Browse the folder which we copied to some other location and choose the JAR file present in that folder with name such as mysql-connector-java-8.0.


3 Answers

In the Services window you can right click on the Databases tab and select New Connection. New Connection

Select MySQL(Connector/J Driver) from the drop down list. The driver file should be listed in the window. If not, you can download the file, then click add and select it from your hard drive. Driver Information

Finally enter your database details such as servername, username and password and click finish. Database Details

like image 163
Vincent Ramdhanie Avatar answered Sep 30 '22 12:09

Vincent Ramdhanie


One way to connect to such databases is to use a JDBC (Java Database Connectivity) driver. You can find more about JDBC at the Oracle FAQ.

like image 31
Daniel Avatar answered Sep 30 '22 12:09

Daniel


If you meant you want to use IDE's GUI tool then

  • windows > services >database > driver
  • Get the driver jar
  • install the jar
  • right click on driver installed > connect using > and then provide the information

Or otherwise use JDBC

like image 31
jmj Avatar answered Sep 30 '22 12:09

jmj