Now it is time for us to setup the biggest, most important, and best known player in the database world: Oracle.
Oracle's database system is considered by many to be the most feature-complete, functional, and reliable database system on the market. Different versions are suited for different needs and can range from free cut-down versions to full blown suites, with every possible feature and tweak.
There are many versions that can be used with NetBeans. The version we will use for this recipe is the Oracle 10g Express Edition. It is free to develop for and fairly easy to install.
It is necessary to have Oracle 10g Express Edition installed on the system and fully configured. In this recipe, we will demonstrate only how to make Oracle accessible from within NetBeans.
Here's where to find Oracle 10g Express Edition:
http://www.oracle.com/technology/software/products/database/xe/index.html
For this recipe to work, it is also necessary to download the JDBC driver, named ojdbc14.jar
, so it can interface between NetBeans and the Database.
Visit the page below to download the driver:
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html
Once the Database is installed and running, and the JDBC driver downloaded, we can proceed to configure NetBeans.
Navigate to the Services window:
Adding a new driver:
The control then returns to the New Database Connection window.
The next step is to enter basic database information.
Note that the following information is not set in stone and you might have changed it when installing and configuring the database. So if all the defaults were used, it is possible that all the information is the same as presented here:
Now that everything looks more or less like the following, it is important to notice the pattern of the JDBC URL:
Click OK and the control will be passed to the Advanced tab, select system
as the Schema (or one of your choice), and click OK.
This is the first database in this Cookbook that is required to find a JAR file to connect properly.
This is because NetBeans is not providing the JAR file from its package by default. NetBeans provides drivers for MySQL and together with GlassFish Server, also Java DB.
As shown in the registration procedure, after entering the required information, it is important to notice the format of the URL, which needs to be:
jdbc:oracle:thin:@localhost:1521:XE
XE comes from Express Edition and this is the desired format.
18.191.208.203