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

- Expand "Name:" and select "New Driver…":

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

and click on "OK".
-
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:
ALTER USER HR IDENTIFIED BY hr ACCOUNT UNLOCK;as explained in TOTD #106.
- 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:

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

Expanding each table shows you the complete definition as shown:

- 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
Related posts:- TOTD #112: Exposing Oracle database tables as RESTful entities using JAX-RS, GlassFish, and NetBeans
- TOTD #121: JDBC resource for MySQL and Oracle sample database in GlassFish v3
- TOTD #108: Java EE 6 web application (JSF 2.0 + JPA 2.0 + EJB 3.1) using Oracle, NetBeans, and GlassFish
- TOTD #25: Rails application with PostgreSQL database using NetBeans
- Database-enabled Hello World RoR app
[...] #105 explained how to install Oracle database 10g R2 on Mac OS X. TOTD #106 explained how to connect this Oracle database using NetBeans. This Tip Of The Day will explain how [...]
Pingback by TOTD #108: Java EE 6 web application (JSF 2.0 + JPA 2.0 + EJB 3.1) using Oracle, NetBeans, and GlassFish « Miles to go … — October 1, 2009 @ 11:49 am
[...] TOTD #107 explains how to configure Oracle database in NetBeans. [...]
Pingback by TOTD #112: Exposing Oracle database tables as RESTful entities using JAX-RS, GlassFish, and NetBeans « Miles to go … — October 8, 2009 @ 9:54 am
Hi, i don’t speak english very well, but i can try… Well.
I am working with netbeans IDE 6.7.1 and i connect a Oracle 9i with JDBC… It’s working… because i select a table and i can see data… But the problem is when i try this in code, in context.html
And dont work… help me please….thanks. And use JSTL 1.1 thanks again.
Comment by Mario — November 13, 2009 @ 8:56 am
Hi, i don’t speak english very well, but i can try… Well.
I am working with netbeans IDE 6.7.1 and i connect a Oracle 9i with JDBC… It’s working… because i select a table and i can see data… But the problem is when i try this in code, in context.html
name=”jdbc/uigv_Oracle9i”
auth=”Container”
type=”javax.sql.DataSource”
username=”user”
password=”clave”
driverClassName=”oracle.jdbc.OracleDriver”
url=”jdbc:oracle:thin:@198.9.9.9:1521:orcl”
maxActive=”20″ maxIdle=”10″ maxwait=”-1″
And dont work… help me please….thanks. And use JSTL 1.1 thanks again.
Comment by Mario — November 13, 2009 @ 8:57 am
Hi Arun,
the driver file ojdbc14.jar is a bit long in the tooth now – it hails from the days of Java 1.4!
Much better to use ojdbc6.jar if you have Java 6, or ojdbc5.jar if you have Java 1.5
Comment by Jonathan — February 9, 2010 @ 8:42 am
Thanks Jonathan!
That’s why ojdbc6.jar is recommended
Comment by arungupta — February 9, 2010 @ 9:58 am
To use a Oracle Thin connection may require you to turn off Netbean’s Remote Proxy setting.
If your using odbc14.jar make sure it’s the most recent version as early versions had some issues.
I have not been able to use the newer clients (odbc5.jar and odbc6.jar) to connect to databases older than 9.2.0.4.
Comment by Bill McAllister — February 9, 2010 @ 10:54 am
thanks arun.. wonderful…
Comment by sivakkannan — March 30, 2010 @ 4:02 am
Thank you! This saved me after so much searching.
Comment by Julius Kabugu — April 11, 2010 @ 1:14 pm