The Dopefly Tech Blog

<< The Dopefly Tech Blog Main page

Using the Eclipse Data Tools

posted under category: Database on April 3, 2008 at 1:00 am by MrNate

I felt the need to mention that to anyone who isn't using the Eclipse Data Tools Platform (DTP), you should look into it. I recently finally figured out how to make it run. It wasn't a very obvious process, so I thought I would type up some help in a blog entry. This is part review, part new user help, part promotion for another deserving open source product.

The first hurdle for me was connecting to my database. It's not easy, even with help from all the sources. Remember that someone out there has already done it, so keep googling until you find what you need. For me, I was missing my database instance name / service ID on the connect string. The format for my Oracle server is This is not documented hardly anywhere. Once connected, I could browse the server, introspect the tables, procedures, views and everything. These things were pretty easy to figure out at this point.

The worst thing for me was figuring out how to just execute some adhoc SQL. It doesn't make sense at first. Eclipse makes you create a SQL file, even for adhoc statements. That's a true pain, but it's somewhat standard in the Eclipse IDE: you have to make a file before you can put anything in it. This differs from most other products, such as Dreamweaver or Flash, Adobe products, and also Notepad or Word, both MS products. Microsoft is so good at this, that you can make a visual studio project, put a bunch of files together, compile an exe and run it, then, if you don't want to save it, just close the project and, with confirmation, throw it all away. This kind of adhoc throw-away mentality is what most of us have been trained on, and is one of the major hurdles when switching to Eclipse.

(jump break - stunning conclusion and an Adobe rant after the break)

Back to DTP. you've created a .SQL file. Make sure you select your database connection at the top of the editor, then, when typing, you will be blessed with content assistance. It's not the best I can imagine, but it's rather good. Knowing what brand of database I use, the SQL editor gives me shortcuts to all the database functions as well as my own database objects. Now, getting your queries to run is a trick. Select what you want to execute, right click and pick "Execute Selected Text". Alt+X (CMD+X for mac?) is the shortcut key. Also, you can run all the queries in the file at once by selecting "Execute All" - Ctrl+Alt+X. The SQL Results view should pop up immediately and show you what you just did. In the results view, the left pane shows a history log of the queries you ran (and is persisted even between sessions, until you clear it), the right pane shows the data that was returned, if any.

I like the way it keeps track of historical queries. I toyed with a web version of something close to this years ago, though not so successfully. From the results view's data, you can export what you selected in different ways, which can even be loaded back into your database through the data source explorer (right-click on a table, data, load).

One last note in this review/plug/tutorial. DTP will generate DBUnit tests. I haven't used it yet, and I doubt I'll get to it soon, but for a full time DB developer with java experience, this is great news.

Overall, I like the integration and flow and how the aspects of the tool work together. Once you make your connection and figure out how to do the basics, the Eclipse Data Tools make a powerful database IDE. The price, as always, can't be beat, and you know the Eclipse plugin developers are always hard at work on improvements for the next version. While the features are not as deep as deep as many proprietary tools such as Toad or SQL Server Manager, its integration into an already well-loved IDE, Eclipse, makes it worthwhile to have on hand, though, as with the Eclipse culture, it won't give you a quick pick-up-and-edit experience.

For users of other Eclipse plugin DMBS's such as SQL Explorer or Quantum, would you want to switch? This, I can't say for sure. Perhaps, if you like the integrated nature of tools made by the Eclipse foundation, this could be up your alley. Trying it out doesn't hurt, but I would not bet money that it's better than your current tools. If anyone has experience, please share.

For ColdFusion developers, why would I choose DTP over the Adobe ColdFusion RDS database tools? For one very simple reason. The CF RDS SQL editor is terrible. Unbelievably awful. Go ahead, try to use it. Try block indenting. Try to hit the delete key. No color coding, no database introspection, no right-clicking on the text, no select all (not even with ctrl+a), no find or replace. Thank you Adobe for making a text editor that's worse than Notepad. Even worse than 'edit' from MSDOS. If I were Adobe, I would focus on connecting a JDBC driver to an RDS server. Then we could use RDS with DTP, SQLExplorer or a pure java app, etc., etc.

Too old to comment!
On Apr 3, 2008 at 1:00 AM Jim Priest ( said:
There was a pretty good thread on DB tools on the CFEclipse mailing list awhile ago. I've tried all of them EXCEPT DTP so I may have to give that a try. Despite trying to force myself to use them - I always seemed to revert back to SQL Explorer because I needed to do something the Eclipse plugin wouldn't do - or wouldn't do consistently.

For the Oracle JDBC connection I have this copied to a local page on my wiki for quick reference:
Too old to comment!