Setup MySQL DB in Eclipse

From Documentation
Revision as of 03:03, 29 December 2010 by Tomyeh (talk | contribs) (→‎Prerequisite)


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

  1. Open Data Source Explorer via [Window]/[Show View]/[Data Source Explorer]:
    001 open DataSourceExplorer.png

  2. Right click the Database Connection folder, select [New...].
    001-1 New Database in DataSourceExplorer.png

  3. 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  Next > .
    002 select DB Type.png

  4. On next page, click the New Driver Definition icon next to the "Drivers:" listbox.
    003 new DriverDef.png

  5. On the popup window, select the Database Version in "Name/Type" tab.
    004 chose MySQL DBVer.png

    Swith to "Jar List" tab, click  Clear All  to clear the default false jar file location.
    005 clear redundant Jar.png

    then click  Add JAR/Zp... .
    006 specify MySQL connector Jar.png

    Locate the jar file inside the folder that just extracted from downloaded MySQL Connectoer/J zip file.
    007 locate MySQL connector Jar file.png

    Switch to "Properties" tab, modify the database connection setting according to your MySQL Database configruation, then click  OK .
    008 specify MySQL connection setting.png

  6. To verify if the setup is functional, click  Test Connection .
    009 test MySQL connection.png

    It should popup a Ping succeeded message, Click  OK  to continue.
    010 test MySQL connection succeed.png

  7. Press  Finish  to close the setup wizard window, And you should be able to see there's a Database icon in the Database Connections folder.
    011 MySQL DB shown in DataSourceExplorer.png


  1. Firewall of the System that install Database or security setting of the Database may prevent you from connect the DB successfully.
  2. 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:
    012 modify MySQL DB connection setting.png
    then proceed the subsequent steps to finish setup.