tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roberts, Eric" <Eric.Robe...@one.at>
Subject RE: How to configure datasources in tomcat 4.1.12 to obtain OracleResultSets
Date Mon, 09 Dec 2002 12:13:36 GMT
Try

<parameter><name>factory</name><value>org.apache.commons.dbcp.BasicDataSourceFactory</value></parameter>

Hope this helps.

-----Original Message-----
From: Thomas Achleitner [mailto:tachleitner@ftisoft.at]
Sent: Montag, 09. Dezember 2002 12:28
To: tomcat-user@jakarta.apache.org
Subject: How to configure datasources in tomcat 4.1.12 to obtain
OracleResultSets 


Hi!
 
Since my application running under both OracleAS and Tomcat 4.1.12 should obtain connection
pooling i tried to configure the application servers. Our application makes use of OracleResultSet.
I configured OracleAS by editing the data-sources.xml file which works very well: 
<data-source 
class="com.evermind.sql.DriverManagerDataSource" 
name="OracleDS" 
location="jdbc/OracleCoreDS" 
xa-location="jdbc/xa/OracleXADS" 
ejb-location="jdbc/OracleDS" 
connection-driver="oracle.jdbc.driver.OracleDriver" 
username="scott" 
password="tiger" 
url="jdbc:oracle:thin:@testdb:1525:ORA5" 
inactivity-timeout="30" 
/> 

The code for jndi lookup is here. It works fine when i cast ResultSet to OracleResultSet using
OracleAS: 
initCtx = new InitialContext(); 
envCtx = (Context) initCtx.lookup("java:comp/env"); 
dataSource = (DataSource) envCtx.lookup("jdbc/OracleDS"); 
con = dataSource.getConnection(); 
ResultSet rs = con.executeQuery(".."); 
OracleResultSet orars = (OracleResultSet)rs; 

Then i configured tomcat 4.1.12 server.xml file: 
<Resource name="jdbc/OracleDS" auth="Container" type="javax.sql.DataSource"/> 
<ResourceParams name="jdbc/OracleDS"> 
<parameter><name>username</name><value>scott</value></parameter>

<parameter><name>password</name><value>tiger</value></parameter>

<parameter><name>driverClassName</name><value>oracle.jdbc.driver.OracleDriver</value></parameter>

<parameter><name>url</name><value>jdbc:oracle:thin:@testdb:1525:ORA5</value></parameter>

</ResourceParams> 

The same source for jndi lookup brings up a ClassCastException at line 
OracleResultSet orars = (OracleResultSet)rs; 

Therefore i tried to add a new parameter in tomcats server.xml: 
<parameter><name>factory</name><value>com.evermind.sql.DriverManagerDataSource</value></parameter>


Now following exceptions occurs: 
javax.naming.NamingException: Could not create resource factory instance, com.evermind.sql.DriverManagerDataSource

java.lang.Object org.apache.naming.factory.ResourceFactory.getObjectInstance(java.lang.Object,
javax.naming.Name, javax.naming.Context, java.util.Hashtable) 

I have oc4j.jar and classes12.jar in tomcats home directory under config/lib. 

How should i configure tomcat to be able to use connection pooling and OracleResultSets? 

Thanks in advance! 

thomas

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message