Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Other Java > Java Databases
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Java Databases Discussion specific to working with Java Databases. For other Java topics, please see related Java forums. For database discussions not specific to Java, please see the Database category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 18th, 2007, 11:48 AM
Registered User
Join Date: Jul 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default OracleConnectionPoolDataSource Problem

I'm Trying to connect a JSP tomcat-based application to Oracle using
OracleConnectionPoolDataSource and related classes. I have used
javax.sql.DataSource an it did work fine. I have made changes I need for using
that classes and when I get the DataSource it throws exception
"javax.naming.NamingException: Cannot create resource instance".

I'm using Apache Tomcat 5.5.23 for windows, Java JDK 1.5.0_05 and Oracle 9i
Release 2 ( All for windows.

Changes I have made are these:

In context.xml:

<Context path="/test" docBase="test" debug="0"
reloadable="true" >
   name="jdbc/test" auth="Container"
   type="oracle.jdbc.pool.OracleConnectionPoolDataSou rce"
   maxActive="0" maxIdle="-1" maxWait="-1"
   removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"
   username="test" password="test"
   driverClassName="oracle.jdbc.pool.OracleConnection PoolDataSource"
   url="jdbc:oracle:thin:@ " />

In web.xml (only resource-ref):

<res-type>oracle.jdbc.pool.OracleConnectionPoolDataSour ce</res-type>

Code that creates connection:

initCtx = new InitialContext();
ctx = (Context) initCtx.lookup("java:/comp/env");
ds = (OracleConnectionPoolDataSource) ctx.lookup("/jdbc/test");
PooledConnection pc = ds.getPooledConnection();
con = pc.getConnection();

I have searched in google and found some examples that use
oracle.jdbc.driver.OracleDriver in driverClassName. I have also tried this
option with the same results. I suppose bug is elsewhere.

I have tried to create DataSource instance in the code instead of get it from
resource. Doing this it drops no error and page works, but I don't know how can
I control maximun number of pooled connections. This is the code I have used for

initCtx = new InitialContext();
OracleConnectionPoolDataSource ds = new OracleConnectionPoolDataSource();
ds.setDataSourceName("oracle.jdbc.pool.OracleConne ctionPoolDataSource");
initCtx.rebind(DS, ds);
pc = ds.getPooledConnection();

But it creates only one connection and doesn't allow two users to log in at the
same time.

Please. I need help.


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

All times are GMT -4. The time now is 09:20 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.