Miles to go …

September 30, 2009

TOTD #107: Connect to Oracle database using NetBeans

Filed under: General — arungupta @ 11:32 am

TOTD #106 explained how to install Oracle database 10g R2 on Mac OS X. This Tip Of The Day will explain how to connect Oracle database with NetBeans to leverage all the goodness provided by NetBeans for Java EE application development, Rails, and others.

  1. Download Oracle JDBC Drivers, specifically ojdbc14.jar. (ojdbc6.jar is recommended to be used with GlassFish v3).
  2. Using NetBeans 6.8 M1, in Services tab, right-click on "Databases" and select "New Connection…" as shown:

  3. Expand "Name:" and select "New Driver…":

  4. Click on "Add…" and choose the recently downloaded JDBC driver JAR file as shown below:

    and click on "OK".

  5. Enter the database values as shown below:

    The password is "hr" for the sample HR database. Clicking on "Show JDBC URL" also shows the complete JDBC URL. Click on "OK".

    You may have to unlock the "hr" user by giving the command:


    as explained in TOTD #106.

  6. Select the "HR" schema as shown below:

    and click on "OK". The complete list of schemas is now shown in the "Databases" node as shown below:

  7. Expand the "HR" node and the complete list of tables is visible now:

    Expanding each table shows you the complete definition as shown:

  8. Right-click on "COUNTRIES" table and select "View Data…"

    and the result is shown as:

    Additionally, you can execute any SQL command by selecting "Execute Command…":

A complete archive of all the TOTDs is available here.

Subsequent blogs will show how to write a Java EE application to access the Oracle database.

Technorati: totd oracle database netbeans

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot
Related posts:
  1. TOTD #112: Exposing Oracle database tables as RESTful entities using JAX-RS, GlassFish, and NetBeans
  2. TOTD #121: JDBC resource for MySQL and Oracle sample database in GlassFish v3
  3. TOTD #108: Java EE 6 web application (JSF 2.0 + JPA 2.0 + EJB 3.1) using Oracle, NetBeans, and GlassFish
  4. TOTD #25: Rails application with PostgreSQL database using NetBeans
  5. Database-enabled Hello World RoR app


  1. i am getting error message "Unable to add connection to jdbc:oracle:thin:@localhost:1521:orcl using oracle.

    Comment by pradeep — February 8, 2010 @ 10:27 am

  2. Pradeep, can you make sure Oracle instance is running ?

    Comment by Arun Gupta — February 15, 2010 @ 4:37 pm

  3. instead of orcl provide XE

    Comment by ajay — May 11, 2012 @ 8:18 am

  4. Please Tell me how to write the simple java application by using oracle Thin driver in NetBeans … by step by step
    (with screenshots)

    you can also mail me at :

    Comment by Shrikant Kale — August 1, 2012 @ 12:34 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.
Powered by WordPress