I assume that Eclipse and MySQL has already been installed. I use Eclipse Ganymede (3.4.2) and MySQL 3.5.1. For installing MySQL on Ubuntu, see my previous post.
1. Download MySQL JDBC Connector (mysql-connector-java-5.1.7.zip/jar)
Choose a mirror and download from here
Extract the contents of the jar/zip to a folder.
2. In Eclipse, click Menu -> Window -> Show View -> Other. Expand the 'Data Management' option and select 'Data Source Explorer'.
Click OK. The Data Source Explorer tab will open.
3. In Data Source Explorer, right click 'Database Connections' folder and click New.
The 'New Connection Profile' dialog will open. Select 'MySQL' and click Next.
Most likely your Drivers drop down will be empty. If yes, then it is time to create a new Driver definition.
4. Click on the small 'New Driver Definition' icon next to the drop down.
5. In the dialog that opens, select MySQL JDBC Driver v5.1.
6. Click Jar/List tab. You need to add the MySQL JDBC connector jar that you downloaded and extracted in step 1 above. Click Add JAR/Zip and select the mysql-connector-java-5.1.7.jar that you extracted. Click OK
7. Change the Database from 'database' to 'mysql' in both Database and URL fields.
8. Enter the password that you had provided during MySQL installation.
9. Click Test Connection and you should see a ping succeeded dialog.
10. Click Finish. Your database connection is successfully created. If you Expand the connection tree, you can see the database and tables etc.
Happy querying!
No comments:
Post a Comment