Oracle is one of the leading, commercially-available SQL relational database management systems. It is available in a variety of configurations from small personal versions to fault-tolerant, enterprise-class versions. It runs on a variety of hardware/operating system platforms. See http://www.oracle.com for more information. Jena2 has been tested with the Oracle 9i binary release, version 9.2.0.1.0.
As Oracle is commercially-available software, we cannot provide generic download instructions. We assume that Jena users wishing to use Oracle have access to an existing Oracle installation or access to the software. Below we list some assumptions and post-installation instructions for using Oracle with Jena. Currently, Jena2 has been tested with Oracle on Windows XP and on Linux AS.
Jena2 has been tested with Oracle on WindowsXP with the following versions.
Server: Oracle 9.2.0.1.0 | JDBC Thick Driver: oci8, oci |
Oracle is certified for RedHat Linux versions AS and ES. No other RedHat versions are supported by Oracle (for details, see http://otn.oracle.com/tech/linux/index.html). Unfortunately, AS and ES are not free. However, we were able to run the Jena2 test suite with Oracle using two free RedHat distributions, 7.2 and 9.0. All tests passed however there is a minor warning that we do not think will affect Jena2 users (see Known Bugs). Consequently, we can recommend the following Oracle version with Jena2. Note that installing Oracle under Linux can be tricky. For tips on installing and running Oracle under RedHat Linux, see http://www.puschitz.com/InstallingOracle9i.html and http://linux.oreillynet.com/lpt/a/4141.
Server: Oracle 9.2.0.1.0 | JDBC Thick Driver: oci (using the 9.2.0.3 versions of ojdbc14.jar and ocrs12.zip) |
A user account and password are required to access the Oracle server. Typically, Oracle is installed with a demo database and user account that may be used for testing and experimentation. In the examples below, we assume the use of this default account (user name is scott and password is tiger). If you have your own Oracle user name and password, please use those values for DB_USER, DB_PASSWD. The DB_URL value should be set as indicated below.
jdbc:oracle:oci:@ | Uses the thick JDBC client and connects to the default local database. |
jdbc:oracle:oci:@<tnsname> | Uses the thick JDBC client and connects to the specified database. |
jdbc:oracle:thin:@ | Uses the thin JDBC client and connects to the default local database (untested with Jena2). |
jdbc:oracle:thin:@<host>:port:<sid> | Uses the thin JDBC client and connects to a database with the specified sid on the specified host on the specified port (untested with Jena2). |
In order to run Jena2 programs with Oracle, make sure that your CLASSPATH includes the jar files for classes12.jar and nls_charset12.jar.
Jena supports both memory models and database models. In general, a Jena program may use both types of models identically. However, there are some differences in how the models are created. Creating a memory model can be done with a single Jena call. Creating a database model, or opening a previously created one, requires several steps as as follows.
- Important:
Edit the source file com.hp.hpl.jena.db.impl.Driver_Oracle.java.
Uncomment the Oracle import commands at the top of the file:
 import oracle.jdbc.OracleResultSet;
 import oracle.sql.BLOB;
Comment-out the stubbed-out interfaces named BLOB and OracleResultSet.- Load the JDBC driver. This enables the Jena program to communicate with the database instance.
- Create a database connection. This creates a Java object for a database connection.
- Create or open a model on the connection. This connects to the database and creates an empty model or opens a previously created model.
Steps 2-4 are illustrated in the following Java code.
- // Load the Driver
- String className = "oracle.jdbc.driver.DriverOracle" // path of driver class
- Class.forName (className); // load driver
Jena stores all models in a single database using whatever database (name) specified on the database connection. See the Jena Database Release Notes for details on the physical layout.
Some Jena users may wish to occasionally access the Oracle database directly to determine if changes have taken effect. Some useful Oracle commands are listed here (replace the names in italics by names for your database instance). To use them, start the Oracle command line interface: SQLPlus username/password