The Artima Developer Community
Sponsored Link

Java Buzz Forum
Database Access from Eclipse

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Levent Gurses

Posts: 79
Nickname: gursesl
Registered: Sep, 2006

Levent Gurses is the co-founder of Jacoozi, an integrated solutions provider based in VA.
Database Access from Eclipse Posted: Sep 19, 2006 2:18 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Levent Gurses.
Original Post: Database Access from Eclipse
Feed Title: Levent Gurses' Journal
Feed URL: http://jroller.com/rss/gursesl
Feed Description: Levent Gurses' Journal
Latest Java Buzz Posts
Latest Java Buzz Posts by Levent Gurses
Latest Posts From Levent Gurses' Journal

Advertisement

You've heard that Eclipse is more than a Java IDE; it's more like an application container. The embedded nature of the Eclipse plugins makes switching between tasks fast and efficient. Those of you working with JDBC (...and who does not?) can install a database access plugin, define connection bookmarks and start browsing the database with no need for a proprietary database client.

QuantumDB

QuantumDB (SourceForge) is a lightweight, open-source plugin for database access from Eclipse (...did I mention that it also works?). The latest version of QuantumDB at the time of this writing is 2.4.5.

Why would you want to access your database from Eclipse? Well, if you already use Eclipse for Java development, it just makes life easier to stay in the same environment for non-Java tasks. Besides, it is a time-saver and a cool gadget. Oh, and it also lets you:

  • connect to databases using standard JDBC drivers
  • review schemas, tables, views and sequences
  • look up column, index and foreign key information
  • issue ad-hoc queries or other SQL statements against the database
  • manage, edit, and work with SQL files (*.sql)
  • issue updates, deletes, and inserts using simple, easy-to-use wizards
  • keep track of recently executed queries
  • manage your database connections by defining database bookmarks


QuantumDB supports various databases. Here is a brief list of the JDBC-complaint databases that you can connect:

  • Adabas
  • DB2
  • DB2 on AS400
  • HSQLDB
  • Informix
  • MySQL
  • Oracle
  • Pointbase
  • PostgreSQL
  • Sybase

Installation

Like any other Eclipse plugin, the installation of this plugin is a bit complicated. You need to download the QuantumDB zip file quantum2.4.2_e3.0.zip from download and extract the archive to your ECLIPSE_HOME folder. You are done.

First Database Connection

OK, you finished the long installation, now it's time to test the plugin. This is also a little complicated:
  1. Launch Eclipse.
  2. Open Window | Open Perspective | Other
  3. In the Select Perspective window select Quantum DB (See Figure 1 Open the QuantumDB perspective).
  4. Click OK

Figure 1 Open the QuantumDB perspective

Now you should see a blank QuantumDB perspective with four views. On the right-hand side of the perspective there is the Database Bookmarks view. Right-click anywhere on this view and select New Bookmark. New Bookmark window will open (See Figure 2 Add DB2 JDBC driver). In the next steps you will add the JDBC driver suited for your database. Since most folks are already familiar with MySQL, the exercise will add a DB2 driver.
  1. Click Add driver
  2. In the following dialog, New JDBC Driver, click Add External Jar
  3. In the Open dialog, change Files of type: to Zip Files (*.zip) and navigate to your DB2 driver (jar or zip), in my case that's under C:\sql\db2\db2java.zip. Click OK.
  4. Back in the New JDBC Driver dialog, click Browse
  5. From the three classes on the list, pick the first class (See Figure 3 Select driver class). Click OK.
  6. Notice that Type is now DB2. If it is not, change it to DB2.
  7. Click Finish
  8. Your JDBC driver window should look like Figure 4 DB2 JDBC driver installed. Select the DB2 driver and click Next.
  9. In the Connection details dialog, enter your username, password and database name. In my case I entered the following:
    1. Userid: levent
    2. Password: need2worry
    3. Database name: test
  10. Click Next.
  11. Enter a bookmark name such as test
  12. Click Next.
  13. Select Show the default schema.
  14. Click Finish.

Figure 2 Add DB2 JDBC driver


Figure 3 Select driver class


Figure 4 DB2 JDBC driver installed

In your Database Bookmarks view you should see your first connection, test . Right-click on the connection and select Connect. Expand the database icon and tables. Double click on any table. See the results in the Quantum Table View (See
Figure 5 QuantumDB table query).


Figure 5 QuantumDB table query

Type any query in the Quantum SQL Query Editor. Click the green arrow on the upper right corner of the editor. Observe the query results in the new pane inside the Quantum Table View (See Table 1 Simple select query and Figure 6 Query results)

SELECT * TBL_USER where USER_TYPE='U'


Table 1 Simple select query

 


Figure 6 Query results

Notice in the Database Bookmarks view, under the Recent SQL Statements, QuantumDB keeps your queries, so that if you need to go back, you find your queries easier. Time-saver!

This plugin, like any other Eclipse plugin, is always a work in progress. Thus, make sure to check for the upcoming versions.

System Information:

Windows 2000

JDK 1.4.2_03

Eclipse 3.0

QuantumDB 2.4.2


About the author

Levent Gurses is a Washington, DC-based technology consultant. He is also one of the co-founders of Jacoozi, an integrated solutions provider based in Alexandria, VA. In his professional life Levent helps clients overcome their J2EE challenges and develop leaner and meaner software development practices. Most of his free time goes in reading and motorcycle racing.

Read: Database Access from Eclipse

Topic: Flickr: Lazy Shot of the SDN Clubhouse Previous Topic   Next Topic Topic: I was right WTP1.5.1 and TikalSUites

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use