Eclipse PDT and MySQL – SQL Explorer Plugin

Posted by on Mar 27, 2008 in Eclipse, Programming, Technology, Web Development32 commentsPrint This Post

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
unzip sqlexplorer_plugin-3.5.0.RC5.zip

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

jdbc:mysql://<hostname>[<:3306:>]/<dbname>

became

jdbc:mysql://localhost:3306/mydatabase

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.


Something not quite right? Inaccuracies or invalid code? Didn’t work for you? Don’t like me using Ss instead of Zs? Add a comment below! All comments are welcome. Except spam, because spam is a bit crap.





















Dragon Touch® Y88X 7'' Quad Core Google Android 4.4 KitKat Tablet PC, Dual Camera, HD 1024x600 Multi-touch Screen, 8GB Nand Flash, Google Play Pre-load, 3D Game Supported (Advanced version of Y88) [By TabletExpress]


Dragon Touch® Y88X 7” Quad Core Google Android 4.4 KitKat Tablet PC, Dual Camera, HD 1024×600 Multi-touch Screen, 8GB Nand Flash, Google Play Pre-load, 3D Game Supported (Advanced version of Y88) [By TabletExpress]


$54.99


Outstanding PerformanceThe Y88X tablet is equipped with a Quad-Core CPU, which means up to 4x the CPU speed for everything you do. Its AnTuTu score almost doubles that of Y88, with 14,800, while Y88 is 7,900. Enjoy the stream videos, smooth-flowing gaming, web surfing and more!Newest Android 4.4 KitKatThe KitKat system enables faster multitasking, optimizes user interface with more convenience and…

Cheapest 10 inch Android KitKat Tablet with TWO YEAR WARRANTY - NEW Polatab Elite Q10.1 Black Android 4.4 (KitKat) Tablet PC QUAD-CORE CPU - POWERFUL GPU - 16GB STORAGE - SLEEK DESIGN - BLUETOOTH - FLAT 50% OFF - LIMITED TIME OFFER


Cheapest 10 inch Android KitKat Tablet with TWO YEAR WARRANTY – NEW Polatab Elite Q10.1 Black Android 4.4 (KitKat) Tablet PC QUAD-CORE CPU – POWERFUL GPU – 16GB STORAGE – SLEEK DESIGN – BLUETOOTH – FLAT 50% OFF – LIMITED TIME OFFER


$104.99


Polatab offers value like no other. Our factory is designed to operate at the most efficient of costs without sacrificing quality meaning the end user receives the best possible product for the price – often 20% or 30% cheaper than our rivals for similar specification. Now, with a full 2 year warranty, we know that you can’t buy better !
This is a value product and does not claim to have a high re…

Tags: , , , , ,