db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Monroe" <Greg.Mon...@DukeCE.com>
Subject RE: Pooled Connections Question - V 3.2 RC-2 -= Java/DB2
Date Wed, 01 Feb 2006 19:52:27 GMT
According to the JDBC 3.0 specs, rollbacks shouldn't close a
connection.  When I checked the Spec pdf quickly, I saw it 
has some examples of using connections after a rollback call 
in the text describing what rollback and savepoints do.

With a pool, you definitely need to do an explicit close.
This doesn't really close the connection, just makes it 
available for others to use.  Garbage collection of 
unclosed PoolConnections should release the connection
back to the pool, but that may take a fair amount of time.

> -----Original Message-----
> From: Jim Caserta [mailto:smoothie_jc@yahoo.com] 
> Sent: Wednesday, February 01, 2006 2:20 PM
> To: Apache Torque Users List
> Subject: RE: Pooled Connections Question - V 3.2 RC-2 -= Java/DB2
> 
> 
> Greg,
> 
> I do have
> torque.dsfactory.eMarine.pool.testOnBorrow=true
> torque.dsfactory.eMarine.pool.validationQuery=SELECT 1
> But I did not list all of the properties.. I believe
> the con.rollback will close the connection??
> 
> Thanks!
> Jim
> 
> --- Greg Monroe <Greg.Monroe@DukeCE.com> wrote:
> 
> > These are not Torque settings but Java Virtual
> > Machine
> > settings.  The Sun defaults are kind of small and
> > for
> > any large active application, you need to increase
> > them
> > by starting your Java VM with larger values.
> > 
> > These are set by the command line parameters of:
> > 
> > -Xms<size>  Initial heap size
> > -Xmx<size>  Maximum heap size
> > 
> > E.g:  JVM -Xms512m -Xmx1024m ...
> > 
> > Most environments have a way to set or add JVM
> > parameters,
> > for example Tomcat 5, has a nice monitor/config tool
> > that lets you set this in a gui.  Older versions had
> > an
> > environment variable you could set.
> > 
> > Going back thru my load testing notes (from a year
> > ago),
> > I also logged that we needed to increase the number
> > of
> > threads the server could handle on the Tomcat web 
> > server connectors elements in the server.xml.  The
> > issue
> > I'm remembering might have been related to there not
> > 
> > being enough threads available when pool asked for
> > one.
> > 
> > Another though is that you might add the following
> > to
> > your torque properties:
> > 
> > torque.dsfactory.eMarine.pool.testOnBorrow=true
> > torque.dsfactory.eMarine.pool.validationQuery=SELECT
> > 1
> > 
> > This will add a little overhead, i.e. SELECT 1 query
> > before each pool checkout.  But it will catch any
> > connections
> > that have timed out at the server end or were
> > established
> > in the pool prior to the DB server being restarted. 
> > The pooling software will then create a new
> > connection
> > object for you.
> > 
> > Re - Closing connections.  A connection.commit()
> > should
> > not close a connection.  It is only a transaction
> > commit
> > action.  You may still want to use it to do more db 
> > actions using the same connection. You should always
> > 
> > close any connections to return them to the pool.
> > FWIW,
> > I believe that a close will also force a commit, but
> > that
> > would be jdbc driver specific.  To be safe, do a
> > commit
> > then close.
> > 
> > Also, you might want to consider using Torque's
> > Transaction
> > class instead of getting connections directly.  This
> > has
> > some logic that handle various DB specific
> > transaction
> > oddities.  This would make your code more portable.
> > 
> > 
> > > -----Original Message-----
> > > From: Jim Caserta [mailto:smoothie_jc@yahoo.com]
> > > Sent: Wednesday, February 01, 2006 8:31 AM
> > > To: Apache Torque Users List
> > > Subject: RE: Pooled Connections Question - V 3.2
> > RC-2 -= Java/DB2
> > > 
> > > 
> > > When you say the "maximum memory pool", you are
> > > refering to the "pool.maxActive" number.. correct?
> > > 
> > > And leave the "maxidle" where it is? I'm a little
> > > fuzzy on how the maxidle affects how many
> > connections
> > > are available in the pool..
> > > 
> > > Thanks!
> > > 
> > > --- Greg Monroe <Greg.Monroe@DukeCE.com> wrote:
> > > 
> > > > I seem to remember getting this error when load
> > > > testing an application.  I think the solution
> > was
> > > > to bump up the JVM initial memory pool and
> > > > maximum memory pool (good thing to do by
> > default).
> > > > 
> > > > But then again, my neural net sometimes makes
> > the
> > > > wrong connections as I get older.
> > > > 
> > > > > -----Original Message-----
> > > > > From: Jim Caserta
> > [mailto:smoothie_jc@yahoo.com]
> > > > > Sent: Tuesday, January 31, 2006 8:25 AM
> > > > > To: Apache Torque Users List
> > > > > Subject: Pooled Connections Question - V 3.2
> > RC-2
> > > > -= Java/DB2
> > > > > 
> > > > > 
> > > > > Hi all,
> > > > > 
> > > > > Occasionally we receive the following
> > connection
> > > > error
> > > > > message: Torque Exception Message: .  Error
> > > > Message
> > > > > is:
> > org.apache.commons.dbcp.SQLNestedException:
> > > > Could
> > > > > not retrieve connection info from pool
> > > > >  
> > > > > Occasionally we also find that a connection
> > does
> > > > not
> > > > > close after a commit. Our code is basic..
> > > > > 
> > > > > con =
> > > > Torque.getConnection(db2.torque.environment));
> > > > > //do  stuff
> > > > > con.commit();
> > > > > }finally {
> > > > > if (con != null) { //this is prob never null
> > > > >     if (!con.isClosed()) {
> > > > >         // send a message the con is NOT
> > closed
> > > > > 	Torque.closeConnection(con);  }
> > > > > 
> > > > > Here is a portion of the prop file:
> > > > >
> > > >
> > >
> >
> torque.dsfactory.eMarine.factory=org.apache.torque.dsfactory.S
> > > > > haredPoolDataSourceFactory
> > > > > torque.dsfactory.eMarine.connection.driver = 
> > > > > COM.ibm.db2.jdbc.app.DB2Driver
> > > > > 
> > > > > torque.defaults.pool.initialSize = 1 
> > > > > torque.defaults.pool.maxIdle = 40
> > > > torque.defaults.pool.maxActive = 60
> > > > > 
> > > > > torque.defaults.pool.maxWait = 50000
> > > > >
> > > >
> > torque.defaults.pool.timeBetweenEvictionRunsMillis=
> > > > > 200000
> > > > >
> > torque.defaults.pool.minEvictableIdleTimeMillis =
> > > > > 2000000
> > > > > torque.defaults.connection.driver = 
> > > > > COM.ibm.db2.jdbc.app.DB2Driver
> > > > torque.idbroker.clever.quantity=true
> > > > > torque.manager.useCache = true
> > > > torque.database.eMarine.adapter=db2app
> > > > > torque.defaults.connection.driver = 
> > > > > COM.ibm.db2.jdbc.app.DB2Driver
> > > > torque.defaults.connection.url
> > > > > = jdbc:db2:DB2B
> > > > > 
> > > > > 
> > > > > Does anything jump out that might be set
> > wrong?
> > > > > 
> > > > > Thank you for any help!
> > > > > Jim
> > > > > 
> > > > > 
> > > > > 
> > > > > 			 
> > > > > 
> > > > >
> > __________________________________________________
> > > > > Do You Yahoo!?
> > > > > Tired of spam?  Yahoo! Mail has the best spam
> > > > protection around
> > > > > http://mail.yahoo.com
> > > > > 
> > > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > > torque-user-unsubscribe@db.apache.org
> > > > > For additional commands, e-mail:
> > 
> === message truncated ===
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are confidential communication
or may otherwise be privileged or confidential and are intended solely for the individual
or entity to whom they are addressed.  If you are not the intended recipient you may not rely
on the contents of this email or any attachments, and we ask that you  please not read, copy
or retransmit this communication, but reply to the sender and destroy the email, its contents,
and all copies thereof immediately.  Any unauthorized dissemination, distribution or copying
of this communication is strictly prohibited.



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


Mime
View raw message