You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by fr...@pfpc.com on 2003/12/23 18:56:42 UTC

Problem with database updates using DBCP

Hello all.  I've recently had a need to implement connection pooling under
Tomcat 4.0.6 (I can't upgrade versions as per a mandate by my employer).  I
have read some posts that indicate that Tyrex does not actually pool
connections.  I don't know for sure if that is true or not (any definitive
answers here?), so I decided to use DBCP, since I knew that did.

I grabbed the latest builds of DBCP, collections and pool (1.1, 2.1 and 1.1
respectively), stuck them in tomcat/common/lib, added my JNDI entry to the
app's context in server.xml, added the proper ref tags in web.xml and put
in the appropriate code to get a connection from the pool (set to
maxActive=50, maxIdle=50000, maxWait=1000 and minIdle=10).

Now, I've got it up and running without much trouble.  Everything SEEMED to
be working fine, until I realized that all my database writes (updates,
inserts, deletes) were NOT hitting the database.

There are NO exceptions being thrown anywhere of any kind.  All the
relevant objects (statements, connection, etc.) are non-null.  Return codes
from SQL executions where applicable seem to be what they should be.
Database reads work perfectly, which indicates everything is OK I think (I
have a single class with a single method that gets the connection out of
the pool and deals with all database access).

My question is simple and obvious: anyone have any ideas why database
writes would be failing (maybe failing is the wrong word... simply not
happening is more accurate) while reads succeed?  It is an Oracle 9.2
database by the way, using the Oracle thin JDBC driver (same driver that is
used when I switch to manually creating connections in code rather than
using JNDI and Tomcat's facilities).

Frank W. Zammetti
Web Architect Consultant





-----------------------------------------
The contents of this email are the property of PNC. If it was not addressed to you, you have no legal right to read it. If you think you received it in error, please notify the sender. Do not forward or copy without permission of the sender.


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


Re: Problem with database updates using DBCP

Posted by Philipp Taprogge <Ph...@gmx.net>.
Hi!

David Ramsey wrote:
> I've not used DBCP specifically but are you sure you are committing
> your writes? Most pools will default rollback connections returned to
> the pool, if I am not mistaken.

Isn't there a parameter autocommit in the ConnectionFactory? I am not 
sure if it's viable to call setAutoCommit() on a connection obtained 
from the pool.
Try specifying autocommit in the DataSource declaration.

	Phil


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


Re: Problem with database updates using DBCP

Posted by David Ramsey <da...@yahoo.com>.
I've not used DBCP specifically but are you sure you are committing
your writes? Most pools will default rollback connections returned to
the pool, if I am not mistaken.



--- frank.zammetti@pfpc.com wrote:
> Hello all.  I've recently had a need to implement connection pooling
> under
> Tomcat 4.0.6 (I can't upgrade versions as per a mandate by my
> employer).  I
> have read some posts that indicate that Tyrex does not actually pool
> connections.  I don't know for sure if that is true or not (any
> definitive
> answers here?), so I decided to use DBCP, since I knew that did.
> 
> I grabbed the latest builds of DBCP, collections and pool (1.1, 2.1
> and 1.1
> respectively), stuck them in tomcat/common/lib, added my JNDI entry
> to the
> app's context in server.xml, added the proper ref tags in web.xml and
> put
> in the appropriate code to get a connection from the pool (set to
> maxActive=50, maxIdle=50000, maxWait=1000 and minIdle=10).
> 
> Now, I've got it up and running without much trouble.  Everything
> SEEMED to
> be working fine, until I realized that all my database writes
> (updates,
> inserts, deletes) were NOT hitting the database.
> 
> There are NO exceptions being thrown anywhere of any kind.  All the
> relevant objects (statements, connection, etc.) are non-null.  Return
> codes
> from SQL executions where applicable seem to be what they should be.
> Database reads work perfectly, which indicates everything is OK I
> think (I
> have a single class with a single method that gets the connection out
> of
> the pool and deals with all database access).
> 
> My question is simple and obvious: anyone have any ideas why database
> writes would be failing (maybe failing is the wrong word... simply
> not
> happening is more accurate) while reads succeed?  It is an Oracle 9.2
> database by the way, using the Oracle thin JDBC driver (same driver
> that is
> used when I switch to manually creating connections in code rather
> than
> using JNDI and Tomcat's facilities).
> 
> Frank W. Zammetti
> Web Architect Consultant
> 
> 
> 
> 
> 
> -----------------------------------------
> The contents of this email are the property of PNC. If it was not
> addressed to you, you have no legal right to read it. If you think
> you received it in error, please notify the sender. Do not forward or
> copy without permission of the sender.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

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