cancel
Showing results for 
Search instead for 
Did you mean: 

Converting from JDBC to JDNI connection

Former Member
0 Kudos

I am currently using CR XI (sp3) JRC in my application to display reports via web pages. I am using Oracle with a JDBC connection. I need to change my JDBC connection to a JNDI connection. Here are my current connection settings;

connection_url=jdbc:oracle:thin:@ros-db03:1521:spndgwin

connectionString=!jdbc:oracle:thin:@ros-db03:1521:spndgwin!jdbc:oracle:thin:/@ros-db03:$:spndgwin

database_classname=oracle.jdbc.driver.OracleDriver

Can someone point me in the right direction?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Allen,

Are you trying to change database location from one oracle database (table) using JDBC connectivity

to another oracle dtatabase (table) using JNDI connectivity.

Correct me if i am wrong.

Jitin Vyas.

Former Member
0 Kudos

Jitin, I have a web application running on Apache TomCat 6.0 that uses a JDNI connection for database connectivity everywhere except when I run a report via the viewer page which uses a JDBC connection. I would like to change my reports to use the same JDNI connection. I tried to test this in the CR XI designer by using these settings in the CrConfig.xml but I get theerror "can't instantiate class".

Here's the working JDBC settings;

<JDBCURL>jdbc:oracle:thin:@10.0.1.111:1521:myAppDb</JDBCURL>

<JDBCClassName>oracle.jdbc.driver.OracleDriver</JDBCClassName>

<JDBCUserName>AppUser</JDBCUserName>

Here's the non-working JNDI settings;

<JNDIURL>//localhost:8080</JNDIURL>

<JNDIConnectionFactory>org.springframework.jndi.JndiObjectFactoryBean</JNDIConnectionFactory>

<JNDIInitContext>AppDatabase-ds</JNDIInitContext>

<JNDIUserName>AppUser</JNDIUserName>

We are using spring so I used it's factory name. I have the server running locally on my development PC which is why I used localhost as the URL value.

Here's my application-context-web.xml contents:

Bean definitions for Data base -->

<bean id="AppDatabaseDS" lazy-init="true" class="org.springframework.jndi.JndiObjectFactoryBean">

<property name="jndiName"><value>java:comp/env/AppDatabase-ds</value></property>

</bean>

and last of all my server.xml contents;

<GlobalNamingResources>

<Resource name="AppDatabase-ds"

auth="Container"

type="javax.sql.DataSource"

driverClassName="oracle.jdbc.driver.OracleDriver"

url="jdbc:oracle:thin:@10.0.1.111:1521:myAppDb"

username="AppUser"

password="userpw"

</GlobalNamingResources>