Setup MySQL DB in Eclipse
1. The Data Tools Platform (DTP) is required for setup DB connection, the Eclipse IDE for Java EE Developers distribution of Eclipse we mentioned in ZK Studio Essentials has already include DTP, so in most case it is not necessary to do extra Eclipse DTP plug-in installation.
2. Download MySQL Connector/J:
extract the zip file to a proper location.
Setup Database Connection in MySQL
- Open Data Source Explorer via [Window]/[Show View]/[Data Source Explorer]:
- Right click the Database Connection folder, select [New...].
- Select the Database you suppose to connect ( MySQL 5.1 as the example in this document), you can type custom name and description for mnemonic, click
- On next page, click the New Driver Definition icon next to the "Drivers:" listbox.
- On the popup window, select the Database Version in "Name/Type"' tab.
Swith to "Jar List" tab, click to clear the default false jar file location.
then click .
Locate the jar file inside the folder that just extracted from downloaded MySQL Connectoer/J zip file.
Switch to '"Properties" tab, modify the database connection setting according to your MySQL Database configuration, then click
Note: The JDBC URL format for MySQL Connector/J is as follows, with items in square brackets ([, ]) being optional:
If the host name is not specified, it defaults to 127.0.0.1. If the port is not specified, it defaults to 3306, the default port number for MySQL servers. In above image the database name is test
- To verify if the setup is functional, click
It should popup a Ping succeeded message, Click to continue.
- Firewall of the System that install Database or security setting of the Database may prevent you from connect the DB successfully.
- If you had specify the right MySQL Connector/J jar file before, then Step 4 & 5 can be skipped, you can directly modify the following field to match your MySQL Database configuration:
then proceed the subsequent steps to finish setup.