This Eclipse DTP tutorial explains how to configure MySQL database connection profile and use Eclipse Data Source Explorer to connect to, navigate, and interact with datasource resources associated with the selected connection profile.
Eclipse DTP Plugin
- The Eclipse Data Tools Platform (DTP) project provides set of frameworks and tools for creating, managing, and performing database development and SQL query functions.
- The DTP plugin supports several database platforms including DB2, MySQL, HSQLDB, Derby, SQLite, Oracle, MS SQL, Postgres, Sybase ASA, Flat Files, XML Data, Web Services, and more.
- This project includes tools for specific data sources, connection-management functionality, Data Source Explorer view and query tools necessary to build, access, and manipulate data.
- Eclipse Indigo/Juno IDE for Java EE Developers (To install Eclipse, refer this link)
- Mysql-5.5 (To install MySQL, read this page)
- MySQL Connector/J 5.1 JAR file
Download MySQL Connector
- The connector can be downloaded from: http://dev.mysql.com/downloads/connector/j/. This tutorial uses 5.1 version. Unzip the connector to a safe location on your computer which contains MySQL Connector J JAR.
Database Development Perspective
To create a connection profile, you need to be in Java EE perspective or in Database Development perspective.
- To open database development perspective, click on Open Perspective icon from right top corner and click on Other…
- Select Database Development and click on OK.
Creating Connection Profile
Connection profile can be created in one of the following ways,
- Right click on Database Connections in Data Source Explorer -> New (or)
- From the main menu, select File -> New -> Other. Under Connection Profiles, select Connection Profile and click Next.
- Select MySQL from Connection Profile Types
- Enter a unique Name for the connection profile.
- (Optional) Enter a Description.
- Click Next.
Now select an existing JDBC Driver and provide Connection Details in the “New Connection Profile” dialog.
If this is the first installation of MySQL Database Profile in your Eclipse workspace, you have to create a new driver definition by providing the location of the driver JAR and connection properties.
- Click on the New Driver Definition icon next to the Drivers combo box.
- Select MySQL driver version under Name/Type tab.
- Click on JAR list tab and add the location of the MySQL JAR file.
- Click on Properties tab and enter the properties and click on OK.
- Click Test Connection to ping the server and to verify that the connection profile is working.
- Click Finish to create the connection profile.