Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

OracleDataSource with Tomcat 5.5.7

442820Jul 14 2005
In the ever confusing quest to properly create an Oracle data source in Tomcat 5.5.x using the 10g JDBC drivers, I am stuck trying to properly configure connection caching. I've tried the following in my context XML file...

<Resource
name = "jdbc/suny"
auth = "Container"
type = "oracle.jdbc.pool.OracleDataSource"
driverClassName = "oracle.jdbc.driver.OracleDriver"
factory = "oracle.jdbc.pool.OracleDataSourceFactory"

url = "jdbc:oracle:thin:@xyz.com:1521:etc"
user = "abc"
password = "def"

connectionCachingEnabled = "true"
implicitCachingEnabled = "true"
maxStatementsLimit = "5"
minLimit = "0"
maxLimit = "20"
validateConnection = "true"
/>

...but when I retrieve the data source in my code and examine it...

OracleDataSource ods = (OracleDataSource)m_dataSource; message.append("\nExtended Oracle data source information");
message.append("\nName: " +
ods.getDataSourceName());
message.append("\nDescription: " +
ods.getDescription());
message.append("\nCaching enabled: " +
ods.getConnectionCachingEnabled());
message.append("\nImplicit caching enabled: " +
ods.getImplicitCachingEnabled());
message.append("\nExplicit caching enabled: " +
ods.getExplicitCachingEnabled());
message.append("\nFast Failover enabled: " +
ods.getFastConnectionFailoverEnabled());
message.append("\nConnection cache properties: " + ods.getConnectionCacheProperties());

...I get the following inconsistent results...

Extended Oracle data source information
Name: OracleDataSource
Description: null
Caching enabled: true
Implicit caching enabled: false
Explicit caching enabled: false
Fast Failover enabled: false
Connection cache properties: {MaxStatementsLimit=0, AbandonedConnectionTimeout=0, MinLimit=0, TimeToLiveTimeout=0, LowerThresholdLimit=20, InitialLimit=0, ValidateConnection=false, ConnectionWaitTimeout=0, PropertyCheckInterval=900, InactivityTimeout=0, ClosestConnectionMatch=false, MaxLimit=2147483647, AttributeWeights=NULL}

...that show that the data source is correct and the connectionCachingEnabled property is getting through. But I can't seem to set any of the other properties, most importantly the maximum number of connections for the pool. So I have a few questions...

Is this is latest and greatest way to properly create and configure an Oracle data source in Tomcat?

How does Tomcat go about creating the data source and how does it decide what properties to set on the data source?

Is there a definitive list of properties for the Oracle data source?

Thanks,
Bernie Durfee
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 11 2005
Added on Jul 14 2005
0 comments
807 views