Since you have already finished adding jar file, now you are ready to connect your Java program with MySQL Database. How to connect mysql database in java using eclipse-fig-12 Connecting Java Program with MySQL Database
You can see the added Jar file as shown in the figure below.
How to connect mysql database in java using eclipse-fig-11
After clicking on the button a pop-up window will appear where you have to select and open the jar file.
Right-click on the project, go to the properties section then select Java Build Path and click on the Add External JARs button.
Next, you have to include this jar file into your program so that you will be able to connect your java program with MySQL database.
#ECLIPSE HOW TO INSTALL WINDOWBUILDER ARCHIVE#
Extract the zip archive and you will get the jar file.
Connect MySQL database in Java Using Eclipse – fig – 10
#ECLIPSE HOW TO INSTALL WINDOWBUILDER DOWNLOAD#
Then download the Platform Independent (Architecture Independent), ZIP Archive as shown below.
How to Connect MySQL Database in Java Using Eclipse – fig – 9
After visiting the link, select platform independent from the drop-down menu as shown in the figure below.
You can download the latest version of MySQL connector from this link ( MySQL Connector Java download).
The version number in the Jar file can be different.
#ECLIPSE HOW TO INSTALL WINDOWBUILDER DRIVER#
In order to connect your java program with MySQL database, you need to include MySQL JDBC driver which is a JAR file, namely mysql-connector-java-8.0.28.jar.
MySQL with Java in Eclipse – fig -8 Adding MySQL connector jar file in Eclipse
Now give a name to your class( MyDbconnect in this Example), tick mark on the public static void main(String args), and then click on the Finish button as shown in the figure below.
Now right click on the project and create a new Java class ( New>Class).
Now give a name to your project ( DbConnect in this example) and click on “Finish”.
Open Eclipse IDE and click on the Java Project under the new section of File Menu ( File>New>Java Project ).
To get to know how to download and Install MySQL in your system so that you can Use MySQL command-line client, you can follow this guide.Ĭreate table student ( ROLLNO varchar ( 10 ) not null, USERNAME varchar ( 30 ), DEPT VARCHAR ( 30 ) ) Creating a Java Project in Eclipse.
If you don’t know how to install MySQL workbench in your system, then you can follow this guide, How to install MySQL Workbench.
To create a database and table, you can either choose MySQL command-line client or MySQL workbench, which is nothing but a GUI version of the MySQL console where we can visually design, model, and generates databases.
After downloading the file, you need to install it in your system in the same way you install any application.
Now again, click on the Download button to download the executable eclipse file.
Click on the download button, as shown in the figure below.
After clicking on the Download Button, you will be redirected to another Web page.
Open your favorite browser and go to the official website of Eclipse When you enter the official website of the eclipse, you will see a download button in the top right corner.
The very First thing you need to do is to Download and Install Eclipse IDE on your system.
1.10 Conclusion Downloading and Installing Eclipse.
1.9 Deleting Data from the MySQL Database using Java.
1.8 How to Retrieve Data from MySQL Database in Java Using Eclipse.
1.7 Updating Data in The MySQL Database using Java.
1.6 Inserting Data into The MySQL Database using Java.
1.5 Connecting Java Program with MySQL Database.
1.4 Adding MySQL connector jar file in Eclipse.
1.2 Creating a Database and Table in MySQL.
1 How to Connect MySQL Database in Java Using Eclipse.