Eclipse PDT and MySQL – SQL Explorer Plugin

Posted by on Mar 27, 2008 in Eclipse, Programming, Technology, Web Development33 comments

Eclipse SQL Explorer LogoI’ve been using Eclipse PDT for some time now, and since PHP programming invariably involves connecting to a database at some point or another, I wanted to be able to access my MySQL databases from within the Eclipse IDE – even if only to quickly debug SQL statements. I generally use a combination of a locally installed phpMyAdmin, MySQL Administrator, MySQL Query Browser, and now the Eclipse SQL Explorer Plugin, which give me all the functionality I need for Web Application development.

phpMyAdmin, MySQL Administrator and MySQL Query Browser can be installed as follows, by the way:

sudo apt-get install phpmyadmin mysql-admin mysql-query-browser

Installing Eclipse SQL Explorer was pretty straight forward – I simply downloaded the archive package from Sourceforge, saved it to a directory in on my desktop (there is also a standalone client available, so be sure to download “Eclipse SQL Explorer [RCP/Plugin]” if you’re setting it up as an Eclipse plugin – here’s a direct link to the latest plugin file), and extracted the files:

cd ~/Desktop/sqlexplorer

This created two directories (features and plugins) along with two text files. To install the plugin, I just copied the two directories to my Eclipse root installation directory (see my previous post “Eclipse PDT IDE for PHP MySQL 32 Bit install on 64 Bit Ubuntu“), which is /opt/eclipse32

cp -R features plugins /opt/eclipse32/

Notice there was no need to use the sudo command before copying, since my user owns the eclipse32 folder.

Configuring SQL Explorer

Once installed, I also had to do some additional setup before I could configure SQL Explorer to connect to my local MySQL databases via Eclipse – namely, download and install the Java Connector for MySQL (MySQL JDBC Driver), to enable JDBC connections. The latest driver (5.1 at the time of writing) tar.gz file can be downloaded from the MySQL site here.

Once downloaded, I just extracted the files, and entered the new directory:

cd ~/Desktop/mysqljdbc
tar -zxvf mysql-connector-java-5.1.6.tar.gz
cd mysql-connector-java-5.1.6

The important file here (along with the documentation, of course) is the mysql-connector-java-5.1.6-bin.jar file, which is the driver itself. I guess this could be placed anywhere, since we just need to point the SQL Explorer plugin to it when setting it up in Eclipse, but for convenience and tidiness, I moved it to the /usr/share/mysql directory:

sudo cp mysql-connector-java-5.1.6-bin.jar /usr/share/mysql

With the JDBC driver installed, I could set up the Eclipse SQL Explorer plugin. In Eclipse, I went to Window->Preferences and expanded the new SQL Explorer section, highlighting “JDBC Drivers”, then double clicking on “MySQL Driver” to open the MySQL setup dialog:

Eclipse SQL Explorer Setup

In the MySQL Driver setup, I had to point the plugin to the MySQL JDBC Driver, by clicking on the “Extra Class Path” tab, and then clicking “Add” to point it to /usr/share/mysql/mysql-connector-java-5.1.6-bin.jar. Once added, clicking on “List Drivers” will bring up the list of available drivers in the “Driver Class Name” pull down menu. Only one is listed, and it just so happens to be the one we need – com.mysql.jdbc.Driver:

Eclipse SQL Explorer Setup

Click OK, and the driver is set up! I also clicked the “Set Default” button, since MySQL is currently the only database I connect to. With the Driver set up, I could then set up a connection to my database system. If the “Connections” view is not already available, it has to be selected via the Window->Show View->Other menu, and clicking on the “Connections” view within the “SQL Explorer” folder in this dialog.

With the Connections View available, I could set up the new connection profile, by right clicking in the view and selecting “New Connection Profile”, which opens up a new dialog, in which the new connection data is input:

Eclipse SQL Explorer Setup

It was a pretty simple process to create the connection – I just needed to replace the relevant parameters in the JDBC connections string with my connection details, so




Entered the DB username and password, gave the connection a name, selected the newly created MySQL Driver, and clicked OK to save the connection. Double clicking the connection name in the Connections View connects to the DB and brings up an SQL window form which Queries may be run. By default, the results are displayed in a small view at the bottom of the main Eclipse IDE window – although, this can be dragged and placed anywhere. There are also several other views available via the Window->Show View->Other menu within the SQL Explorer section to peruse.

The Eclipse SQL Explorer homepage has extensive documentation available, including a cool section on extending the plugin. Maybe I should learn Java too?

That’s all Folks.

Tags: , , , , ,


» Comments RSS Feed
  1. […] recently written a post on “Eclipse PDT and MySQL – SQL Explorer Plugin“, for anyone who needs to set up MySQL connections in Eclipse. These icons link to social […]

  2. just wanted to say that after looking all over the internet, this was the most useful and informative information I found. The directions were easy to follow and I have no trouble installing my plugin. Just wanted to say thanks, I appreciate it.

  3. Thanks for the positive feedback, Frank! I’m really happy the guide helped you. Good luck with your development projects.

  4. everything works at perfection! tnks man! its a good tutorial to set up eclipse and connect to mysql in debian etch too!! thnks again! i’ve been searching this for more than 2 weeks.

  5. great tutorial!
    thanks heaps

  6. Hi,

    Thank you for the tutorial. Everything works i have connected my eclipse to phpmyadmin. with the editor the queries works.
    Created the connetion everything perfect.
    But now my question when write my connection file in php what is the variables values :
    $username=”root” ?
    $password=”” ?

    (the “?’ means is it the write value? and between”” are the current value not working)

    I am getting the problem my php file doesn’t connect to the sql server giving me the error :
    “Warning: mysql_connect() [function.mysql-connect]: Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2) in /home/www/Desktop/deitel&deitel/Test/login/membercreatetable.php on line 8″

    Would you please explain to me what i am doing wrong!

    thank you

  7. (the “?’ means is it the right value? and between”” are the current value not working)

  8. Hi Abibabou,

    the error you’re getting is actually due to the MySql client being unable to locate the socket to connect to the server, and not your PHP script. The client is looking for the socket in /tmp/mysql.sock, but for your istallation, the mysql.sock is located somewhere else. You’ll need to find where this file is on your system (possibly /var/lib/mysql/mysql.sock), which can be done by running:

    sudo find / | grep 'mysql.sock'

    Once you know where it is, edit your my.cnf file (/etc/my.cnf or /etc/mysql/my.cnf – location depends on your system) to tell mysql to point to the correct socket file. If there isn’t a [client] section in the my.cnf file, add it, or if it currently exists, edit the section with the new socket location, e.g.:


    Save the file, and restart Mysql.

    Hope that helps!

  9. After the installation of SQL Explorer plugin for Eclipse I was not able to connect to any MySQL database. I found your blog post and it learned me (how) to install the MySQL JDBC Driver… Thanks for this useful info!

  10. Code font where achieve?

  11. Thanks a ton! Especially the “Java Connector for MySQL” did the trick for me.


  12. In your configuration for phpeclipse what will be the workspace location to run it

  13. @Prantosh – workspace is just located in my home directory, e.g.


  14. how to activate the gui environment in phpeclipse after installing all these things as per the instruction given

  15. @Prantosh – sorry I misunderstood :)

    once you have opened Eclipse (in a terminal, execute /path/to/eclipse, e.g. if eclipse is installed in /opt/eclipse then run /opt/eclipse/eclipse), you need to open the PHP Perspective, by going to the menu Window -> Open Perspective -> PHP (if PHP is not listed, click “Other” and then select PHP). When you have thePHP perspective open, you can add more “Views” to it, by going to Window -> Show View -> Other which opens a new dialog window. In this window, expand SQL Development and SQL Explorer, then add the views you want to the PHP Perspective.

    I hope that helps.

  16. Thanks man.

  17. Thanks for putting this out there. :)

    After using your instructions and a bit of trial and error I figured out how to set up MySQL dev using Galileo on a Mac. I wrote up an article on it with hopes that someone will find it useful:

    Rock on!

  18. Thanks for this information.
    BTW, where did you get this pretty black theme for eclipse (I mean one on screenshots)?

  19. I have installed the sql explorer and there is now the new sql explorer view but I cant connect to the database. (I have PDT on Mac and the mysql database is the one in MAMP PRO) I access regulary to my database from my scripts with localhost root and pwd
    Now when I try to connect with
    jdbc:mysql://localhost:3306/myDababase (or without :3306)
    I have the following error: communication link failure, check your URL

    Thanks for help.

  20. Connectors aviable like:

    sudo apt-get install libmysql-java

    and you can find them in /usr/share/java/mysql-connector-java-.jar

  21. Connectors available like:

    sudo apt-get install libmysql-java

    and you can find them in /usr/share/java/mysql-connector-java-.jar

  22. […] sumber : […]

  23. Great website you have here but I was wanting to know if you knew of any user discussion forums
    that cover the same topics discussed here? I’d really love to be a part of group where I
    can get advice from other knowledgeable individuals that share the same interest.
    If you have any suggestions, please let me know.
    Thank you!

  24. I absolutely love your blog and find nearly all of your
    post’s to be exactly I’m looking for. Does one offer guest writers to write
    content for yourself? I wouldn’t mind publishing a post or elaborating on most of the subjects you write concerning here.

    Again, awesome site!

  25. TRM Filtration is world’s most famous provider in air filtrage, waste managing as well as managing environmental pollution. For over
    four decades, we’ve been able to increase global ease as well as effectiveness by innovative
    solutions and products. TRM has upgraded comfort as well as effectiveness globally by its state-of-the-art products and most trustworthy services for 4 decades.

    TRM air filtering devices are delivered in the
    U . S and additionally 6 other foreign nations. Additionally, our filtrage adventure covers a variety of industrial sectors for example
    pottery, timber, fabrics, drugs, synthetics, papers, fiberglass, corrugated, as well as silicone.

    TRM Filtration ensures overall health and well being
    by giving quality of air by means of its sophisticated purification technologies.

    Additionally, TRM Filtration is a OEM (original equipment manufacturer) of TRM Filtration. These appliances
    of varied configurations can be utilized to a number
    of programs. TRM Filters give you extremely low air-to-cloth ratios
    as well as very good effectiveness. TRM Filtration systems have been proven to be entirely good for the environment and also grab nearly 99 percent of parasites
    from the air.

  26. But there are other types of trendy surfaces such as quartz, Corian, slate and marble that is re-emerging into kitchen designs.
    The trend in kitchens today is to decorate for your life; so your kitchen furniture should be no exception. An overall approach should be to choose a kitchen design that’ll be
    aesthetically pleasing, efficient, and one that will serve the family well over a period of seven to ten years.

  27. I mean, it’s not sexy like Facebook; it’s not as easy as Twitter and it certainly is not as glamorous as having a My – Space page.
    People used to get enough back links to their sites and relied heavily on targeted keywords and key phrases to get search engine spiders attracted to
    their sites and achieve search engine optimization in the process.
    They do everything for you from market research to competition analysis.

  28. Howdy! I could have sworn I’ve been to this website before but after reading through some of
    the post I realized it’s new to me. Anyhow, I’m definitely happy I found it and I’ll be book-marking
    and checking back frequently!

  29. whoah this weblog is wonderful i love reading
    your articles. Stay up the great work! You recognize, lots of individuals are hunting round for
    this information, you can aid them greatly.

  30. Every weekend i used to visit this web page, as i wish for enjoyment, for the reason that this
    this web page conations really fastidious funny information too.

  31. Your business would need the maximum return for the investment
    and your business will gradually increase with the increased rankings on the search
    engines and people visit the site. If people are offered the option of home based business, they
    would definitely opt for it and readily give up their mundane corporate
    lives. The expert need not to be just co located with the client, as everything is possible over the internet.

  32. I think this is one of the so much important information for
    me. And i’m glad reading your article. However should statement on few common issues, The web site taste is ideal, the articles is
    truly nice : D. Just right activity, cheers

  33. very nice

Leave a comment