MySQL

How to connect MySQL Database in Eclipse

In this tutorial, we will see how to connect MySQL Database in Eclipse IDE.

Connect MySQL Database in Eclipse:

Eclipse is a most familiar opensource IDE for J2EE developers; it provides essential tools to help developers to manage their applications.

Here we will see the most useful use case; how to connect MySQL Database in Eclipse.

Versions:

  • Eclipse IDE for Enterprise Java Developers
    • Version: 2019-03 (4.11.0)
    • Build id: 20190314-1200
  • MySQL 8.0.15
  • Windows 10 64 Bit
Note: Install MySQL on your machine, if you don’t have MySQL installation on Windows 10 you may have to follow our previous tutorials.

1. Goto Database Perspective:

Window-> Perspective->Open Perspective-> Other

How to Connect MySQL in Eclipse-min

2. Select Database Development Perspective:

select the Database Development perspective and click on the Open button.

How to Connect MySQL in Eclipse 2-min

It opens the Data Base development perspective as below.

3. Create Database Connections:

There you can see the Database Connections folder, right click and click on the New.

How to Connect MySQL in Eclipse 3-min

Then you will see the New Connection Profile window as below; there you will find all available connections, filter the connection profile type with “MySQL” string and select the MySQL connection.

Name this connection as MYSQL_DB_CONNECTION and click on Next button.

How to Connect MySQL in Eclipse 4-min

This window allows you to attach the driver details to connect with the MySQL DB. Click on the below-highlighted icon to attach MySQL connector.

How to Connect MySQL in Eclipse 5-min

Then you will see the following window; select the MySQL version which you wanted to connect with and move to JAR List tab.

How to Connect MySQL in Eclipse 6-min

Here we have to attach the MySQL connector.

4. Download and attach MySQL connector:

Download the MySQL connector from the official website.

How to Connect MySQL in Eclipse 7-min

It will be downloaded as a .zip file; extract the zip and there you will see the mysql-connector-java-xxx.jar; add this jar file in Jar List tab by clicking on the Add JAR button as below screenshot and click on the Ok button.

How to Connect MySQL in Eclipse 8-min

Specify the MySQL connection details like username, password and database name and click on the Test Connection button.

How to Connect MySQL in Eclipse 9-min

If everything configured well, you would see the below Ping succeeded! Message.

How to Connect MySQL in Eclipse 10-min

Then Click on the Finish button.

Done.

5. Verify:

Again go to Data Source Explorer and refresh on Database Connections folder and expand the folders inside it. You would see the MySQL database schema here.

How to Connect MySQL in Eclipse 12-min

References:

Happy Learning :)

Found a mistake or something out of date? Tell us →

Written by

chandrashekhar

Founder of onlinetutorialspoint.com. Enterprise architect with 15+ years in healthcare technology, designing and running systems on AWS and Azure. Writes about building real things with AI, local AI hardware and cloud certifications.

Keep reading

MySQL

How to connect MySQL DB with Python

In this tutorial, we'll see a step by step guide on how to connect MySQL Database with Python and will execute a query using Python. Setup and Configurations…

Python

Python MySQL create database and table

In this tutorial, we’ll show how to perform Create MySQL Database and insert some data init using Python step by step. 1. Setup Required to connect MySQL To…

5 comments

  1. Getting error (An error has occurred. See error log for more details.
    com/ibm/icu/util/StringTokenizer) while selecting the driver . Any ideas?

Ask a question or leave a comment