I'll try to answer all your questions and tell you what state is the
page now.
1. I get the same results with
"oracle.jdbc.pool.OracleConnectionPoolDataSource",
"oracle.jdbc.OracleDriver" and "oracle.jdbc.driver.OracleDriver".
Currently I'm using "oracle.jdbc.OracleDriver".
2. I am importing "javax.naming.*" which includes
"javax.naming.Context", "import javax.naming.InitialContext" and
"javax.naming.NamingException". I think if I were not importing that, it
would NEVER work, so I think this is not the problem.
3. "factory" attribute is new. I have found it in google and it began to
work when I started using it.
4. I use OracleConnectionPoolDataSource because with
javax.sql.DataSource it doesn't close correctly close connections from
pool and server got to hang up.
5. con variable is of type Connection. I found this in an example in
google. May it be of type PooledConnection? If so, can I use pc variable
instead of con?
6. I've putted user="test" password="test" in context but it still
doesn't work if I don't put user and password in getPooledConnection.
Currently context.xml is this:
<Context debug="0" reloadable="true">
<Resource
name="jdbc/test" auth="Container"
type="oracle.jdbc.pool.OracleConnectionPoolDataSource"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
maxActive="5" maxIdle="-1" maxWait="-1"
removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"
driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@192.168.1.47:1521:GLOBALDB" />
</Context>
And code that gets the connection is this:
Context initCtx = null;
PooledConnection pc = null;
Connection con = null;
public void init()
{
if(pc == null)
{
try
{
initCtx = new InitialContext();
Context ctx = (Context) initCtx.lookup("java:/comp/env");
OracleConnectionPoolDataSource fuenteDatos =
(OracleConnectionPoolDataSource) ctx.lookup("/jdbc/ganaderia");
pc = fuenteDatos.getPooledConnection(dbUser, dbPassword);
}
catch(Exception e)
{
String mensaje = getMessage(e);
sc.log(mensaje);
}
}
initConnection();
}
void initConnection()
{
try
{
con = pc.getConnection();
}
catch(Exception e)
{
sc.log(getMessage(e));
}
}
public void finishConnection()
{
try
{
if(con != null)
{
con.close();
con = null;
}
}
catch(Exception e)
{
sc.log(getMessage(e));
con = null;
}
}
public void finish()
{
try
{
finishConnection();
if(pc != null)
pc.close();
}
catch(Exception e)
{
sc.log(getMessage(e));
}
}
Currently I can browse the page normally, but when I play stress test, I
see only one connection and two users cannot log in at the same time.
Seva Popov escribió:
Yes, this is Oracle specific.
-----Original Message-----
From: Christopher Schultz [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 19, 2007 12:24 PM
To: Tomcat Users List
Subject: Re: OracleConnectionPoolDataSource
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Seva,
Seva Popov wrote:
You need to use user="test" instead of username="test". This should
work in the context.xml file.
Is this Oracle-specific? I use 'user="username"' in my <Resource>
element and it works perfectly.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGn7pZ9CaO5/Lv0PARAtDYAJ994n4wU0MoNpuNiRWm5twz2q6WKACgsXbK
npQLX/vREfNQFCo+NTLRRY8=
=xKxF
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]