Other Documentation

Project Documentation

Miscellaneous

Legend

External Link

Opens in a new window

Oracle Howto

Oracle has long used a custom way to access and write LOB objects,
and did not support standard LOB usage. However, this has changed
with the 10.2.0.1 version of the oracle jdbc driver.
For older drivers, Saravana Kannan is maintaining a patched version
of Village that supports Oracle LOBs:
Village 2.0
Patched for Oracle LOBs - For use with Torque 3.1 and later.
For the 10.2.0.1 drivers and later, the standard village library can be
used. However, village 2.0. has an issue concerning null values in
lob columns, so empty lobs still can not be read.

The data type TIME only has day accuracy for Oracle. This is due to the
underlying village library and the fact that oracle does not support
a SQL type TIME.
If you are using Oracle 9i and later, you can use the type TIMESTAMP
instead which gives you millisecond accuracy.

Oracle does not distinguish between empty strings and null strings.
If an empty string is inserted into a table, it will be treated as null.
If you want to re-read this column by selecting records which contain
an empty string, oracle will return no columns. The only way to select
the column is to query for records which contain null in that column.
This behaviour is different in most other databases. So if you
want to write code which works for other databases and oracle, you need
to consider both cases - the column might be null and it might contain
an empty string. For example:

Oracle versions

This version of Torque is optimized for Oracle 9i and later.
The following issues exist for older versions of Oracle:

The data type TIMESTAMP is not supported up to and including
Oracle 8.1.7. Either use the types DATE or TIME instead of TIMESTAMP
or change the following line in the class
org.apache.torque.engine.platform.PlatformOracleImpl
in the generator source

and rebuild the generator from source.
However, both possibilities will give you only day accuracy for the
data types DATE, TIME and TIMESTAMP

Introductory note for the following sections

The following part of this HOWTO was written some time ago and was
targeted at Oracle 8i and the version of Torque that was coupled with the
Turbine application framework.
Contributions towards updating the information below can be submitted to the
Torque Dev mailing list.

Oracle Howto for Turbine

This HOWTO aims to be a simple guide to make Turbine run with an existing
Oracle 8i database. The process of making Turbine run is not covered in
this guide, proceed to the
Turbine site for
help on how to install Turbine.

Creating the Database

If you do not have a database already set up, you will need to create one so
we can create the necessary tables for Turbine. The steps below are simple
steps to take to create a new database. If you already have a database ready for
use, you can skip this part.

1. Open the Oracle Database Configuration assistant

2. Create a database with the Global Database Name 'turbine.project' and
SID 'turbine'

Global Database Name : turbine.project

SID : turbine

SYSTEM account password : manager

SYS account password : change_on_install

3. Wait for the database to be created.

4. Good idea to stop the services from running if the Oracle database
isn't being used as they are memory hungry for a development desktop machine.
Check if the Oracle TNS Listener and the correct service are running when
trying to connect.

Populating the Database from the .sql Scripts

5. Start SQL *PLUS and login to the database using the username and
password for the database. You may want to use the same username and password you will
use for Turbine, or you will need to create synonyms for the tables and grant the
necessary privilieges (SELECT, UPDATE, INSERT, etc), so Turbine can access the
tables directly without using "user"."table_name".

6. Run the Oracle specific scripts. For the cvs version of Turbine,
these can be found in turbine/src/sql . In SQL*PLUS type :

@path/to/oracle-turbine.sql

7.The oracle-turbine.sql script creates an oracle sequence
for each turbine table. To use these sequences for primary
key generation, the oracle-turbine-security.sql script should
be modified. For example, the following command from the script :

When your changes, if any, are made to the script, run it from SQL*PLUS :

@path/to/oracle-turbine-security.sql

8.If you would rather use Turbine's id-broker to generate
primary keys, run the following scripts to create and populate the
id-broker table :

@path/to/oracle-id-table-schema.sql

@path/to/oracle-turbine-id-table-init.sql

Setting up Turbine to Connect to Oracle

9. Download and install the Oracle 8i JDBC type 4 Thin driver for JDK
1.2.x from the Oracle website. Add the classes12_01.zip file to the
classpath of the servlet engine. In JServ add to the jserv.properties file
the line:

wrapper.classpath=/path/to/classes12_01.zip

10. Ensure that the OracleoracleTNSListener service and the
OracleServiceTURBINE service is running before using the driver.

11. Follow the Turbine installation document
for Turbine with the following differences. To link up the Oracle
database and driver to Turbine, edit the TurbineResources.properties file;

The servername is the Oracle server name and the port is the port
that oracle uses. It is important not to confuse the Oracle servername
and port with the Apache server name and port. Refer to the Oracle 8i
documentation if there are any conflicts in this regard.
Take care to use the correct SID for the database you have set up.

Edit the database.default.username and
database.default.password to match the username and password of your
database.

You may need to check if a Turbine database adaptor has been setup for Oracle.
Look for the following lines in TurbineResources.properties, and add them in
case you do not find:

Connecting to the Oracle Database

12. Point your web browser at http://servername:port/servlets/Turbine
(the URL may vary depending on your servlet engine) and login as username
turbine, password turbine. After logging in you should see the congratulatory
"Welcome To The Default Screen".