The Dopefly Tech Blog

« The Dopefly Tech Blog Main page

Using the Eclipse Data Tools

posted under category: Database on April 3, 2008 by Nathan

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 [email protected]:port:instance. 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.

Nathan is a software developer at The Boeing Company in Charleston, SC. He is essentially a big programming nerd. Really, you could say that makes him a nerd among nerds. Aside from making software for the web, he plays with tech toys and likes to think about programming's big picture while speaking at conferences and generally impressing people with massive nerdiness and straight-faced sarcastic humor. Nathan got his programming start writing batch files in DOS. It should go without saying, but these thought and opinions have nothing to do with Boeing in any way.
This blog is also available as an RSS 2.0 feed. Click your heels together and click here to contact Nathan.