473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 (9.2.0.1.0). All for windows.

Changes I have made are these:

In context.xml:

<Context path="/test" docBase="test" debug="0"
reloadable="true" >
<Resource
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:@192.168.1.109:1521:GLOBALDB " />
</Context>

In web.xml (only resource-ref):

<resource-ref>
<res-ref-name>jdbc/test</res-ref-name>
<res-type>oracle.jdbc.pool.OracleConnectionPoolDataSour ce</res-type>
<res-auth>Container</res-auth>
</resource-ref>

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
that:

initCtx = new InitialContext();
OracleConnectionPoolDataSource ds = new OracleConnectionPoolDataSource();
ds.setDataSourceName("oracle.jdbc.pool.OracleConne ctionPoolDataSource");
ds.setURL(dbURL);
ds.setDescription(DS);
ds.setUser(dbUsuario);
ds.setPassword(dbPassword);
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.
Jul 18 '07 #1
0 1240

Sign in to post your reply or Sign up for a free account.

Similar topics

117
by: Peter Olcott | last post by:
www.halting-problem.com
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.