Thursday, July 10, 2008

Apache ODE 1.2 with Oracle Database 10g

Hi there,

It can be very usefull to change the database for many reasons (your customer wants to have this brand, your customer has some commercial discounts, support, etc...).

I'll will show you how to use the RDMS Oracle Database 10g with Apache ODE 1.2 .war version.

You'll need the sysdba privileges in order to follow the next steps.
You can get the oracle.sql script in the directory apache-ode-war-1.2/sql.

Create an ODE tablespace
Connect to the sid :
sqlplus sys/manager@xe as sysdba

Then execute the SQL statement :
CREATE TABLESPACE ODE DATAFILE
'/ENTREPRISE/PRODUCT/ORACLEXE/ORADATA/XE/ODE.DBF' SIZE 1000M AUTOEXTEND OFF
LOGGING
ONLINE
PERMANENT
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
BLOCKSIZE 8K
SEGMENT SPACE MANAGEMENT MANUAL
FLASHBACK ON;

Feel free to adapt this to your environement (the dbf path, the autoextend property and the initial size of the tbs).


Create an ODE schema
Execute the SQL statement :
CREATE USER ode
IDENTIFIED BY ode
DEFAULT TABLESPACE ode
TEMPORARY TABLESPACE temp
PROFILE DEFAULT
ACCOUNT UNLOCK;
-- Roles
GRANT RESOURCE TO ode;
GRANT CONNECT TO ode;
ALTER USER ode DEFAULT ROLE ALL;
-- System Privileges
GRANT UNLIMITED TABLESPACE TO ode;
GRANT CREATE VIEW TO ode;
-- tablespace Quota
ALTER USER ode QUOTA UNLIMITED ON ode;

Populate the ODE schema
Load the Apache ODE 1.2 schema :
sqlplus ode/ode@xe @oracle.sql
Create the JDBC datasource
Add this in the Host tag to the $CATALINA_HOME/conf/server.xml file :
<Context path="/ode" docBase="ode" debug="5" reloadable="true" crossContext="true">
<Resource name="jdbc/oracle/ode"
auth="Container"
type="javax.sql.DataSource"
maxActive="100"
maxIdle="30"
maxWait="10000"
username="ODE"
password="ODE"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@localhost:1521:XE"/>
</Context>

Bind the ODE engine to the oracle datasource
Add the file $CATALINA_HOME/webapps/ode/WEB-INF/conf/ode-axis2.properties with this content :
ode-axis2.db.mode=EXTERNAL
ode-axis2.db.ext.dataSource=java:comp/env/jdbc/oracle/ode

Add the Oracle JDBC Driver to the tomcat lib directory
Add the file ojdbc14.jar (which you can find in the lib directory of your $ORACLE_HOME) to the $CATALINA_HOME/lib directory.

Ok we're done, that's all !
Just restart the tomcat and it should work.

1 comment:

Satya said...

Hello,

Thanks for the good information. It is really useful a lot. I have followed all your steps but I am using Apache-ode-1.3.2 version. I am getting the following error.

ERROR - GeronimoLog.error(108) | Failed to resolved external DataSource at "java:comp/env/jdbc/oracle/ode".
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

Could you please help me. Thanks a lot

Satya