How To Browse Oracle Databases from within Netbeans

I started using Netbeans about two months ago for Ruby and Ruby on Rails development. Before, I was working in Eclipse with the RadRails plugin and it’s not very likely I’ll ever go back to it. It was good, but Netbeans is just a little bit better in everything.

But that ’s not what this post is about, in fact, there was a feature that I couldn’t get to work in Netbeans: the database browsing from within the IDE, and more specific for an Oracle database. Today I gave it another try and guess what, it’s working now :-). It turned out to be pretty easy, but I suppose I’m not the only one who is having difficulties with this, so here ’s how I did it:

  • My System:
    • Ubuntu 7.10 (Gutsy Gibbon)
    • Netbeans 6.0 beta2
    • Local installation of Oracle XE 10.2.0.1.0
  • Netbeans uses jdbc drivers to connect to a database, so you need to get the the one for Oracle, you can get it here: http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html (download ojdbc14.jar)
    • In the “services” window, create a “new driver” and browse for your ojdbc14.jar file.
    • select oracle.jdbc.OracleDriver
    • create a “new connection” and select your Oracle driver
    • Your connection string should look something like this: jdbc:oracle:thin:@localhost:1521:XE
    • It doesn’t work without the “XE” at the end, you ‘ll get the error “TNS:listener does not currently know of service requested in connect descriptor”. That’s why I couldn’t get it to work the first time.
    • Check the “advanced” tab and see if your connection is working (you should be able to select a schema from your DB). If you get an error at this point, there is probably something wrong with your connection string.

Now you should be able to browse your database tables, write and execute sql queries in the sql editor, ... without leaving your IDE ! It’s not a full blown database development or administration tool, but the basic functionality is there. Maybe there will be more features in the future… (I’d love to see the possibility to add and delete rows!)

Entries per category

  1. docpublisher (6)
  2. events (6)
  3. rails (6)
  4. ruby (15)
  5. xml (3)