Many Thanks for your help!

I was able to create the Oracle DataSource and reference through osgi
service in Spring XML 

Record my steps here just in case it might be helpful for others:

1) Go to the folder where ojdbc6.jar is located then enter the following in
command prompt:
mvn install:install-file -Dfile=ojdbc6.jar -DgroupId=com.oracle
-DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar

2) Go to karaf shell and enter:
install -s wrap:mvn:com.oracle/ojdbc6/11.2.0
feature:repo-add pax-jdbc 0.7.0
feature:install jdbc pax-jdbc-config pax-jdbc-pool-dbcp2 pax-jdbc-oracle
transaction

3) Check that 3 DataSourceFactories (OracleDriver, OracleDriver-pool and
OracleDriver-pool-xa) exists:
service:list DataSourceFactory

4) create "org.ops4j.datasource-<ds_name>.cfg" with the following contents
and store in karaf "etc" folder

osgi.jdbc.driver.name=oracle-pool
databaseName=<ds_name>
user=<username>
password=<password>
dataSourceName=<osgi_jndi_servicename_to-be_in_spring>
url=jdbc:oracle:thin:@<oracle_host>:<oracle_port>/<sid>

5) Check the datasource created:
service:list DataSource

6) In Spring XML (Note the osgi namespece and )

In Camel Application's Spring XML (note the hightlighted)
<?xml version= "1.0" encoding ="UTF-8"?>
<beans xmlns= "http://www.springframework.org/schema/beans";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns:camel="http://camel.apache.org/schema/spring";
       xmlns:osgi="http://www.springframework.org/schema/osgi";
       xsi:schemaLocation="
          http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
          http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
          http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
 ">

...
   <camelContext xmlns="http://camel.apache.org/schema/spring";>
...
    </camelContext >
   
    <osgi:reference id=&quot;db001&quot; 
interface=&quot;javax.sql.DataSource&quot;
filter=&quot;(osgi.jndi.service.name=&lt;osgi_jndi_servicename_to-be_in_spring>)"
  
/>
</beans>







--
View this message in context: 
http://karaf.922171.n3.nabble.com/Karaf-4-0-1-create-Pooled-Oracle-datasource-tp4042724p4042733.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to