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: exception thrown because DB connection not correctly reinited after db server restart
Date Wed, 10 Jan 2007 17:11:42 GMT
The quick fix is to add the following lines to your 
init properties:

torque.dsfactory.web_test_suite.pool.testOnBorrow=true
torque.dsfactory.web_test_suite.pool.validationQuery=SELECT 1

This will cause the common-dbcp code to verify that any 
pooled connection is still valid before passing it to Torque.
Adds the overhead of a single quick DB query each time a 
connection is retrieved but it's a small price to pay to make
Apps independent of DB restarts.

As to the cause... when you say "close the app", do you 
mean just exist the browser pages or actually stop the 
webapp on TomCat via the manager/html app?  

If it's the former, then the webapp / Torque is still active
and has pooled connections still open.  These pooled 
connections are a big performance gain since getting a TCP
connection to an SQL server is time consuming.  But this
means that your apps don't behave like the (slower) "open a 
connection for each page/statement" ones that are common.

If it's the latter, then do you have the Torque lib (and 
support ones) in your common\lib directory and use it
across multiple web-apps? Then the reason is that in this
situation there is only one pool for all web-apps.  
Restarting a single webapp will not restart the pool. You
have to restart Tomcat (or explicitly shutdown and re-init
Torque but that can be problematic...).

> -----Original Message-----
> From: Eustache [mailto:eustache.felenc@idilia.com] 
> Sent: Wednesday, January 10, 2007 11:31 AM
> To: Apache Torque Users List
> Subject: exception thrown because DB connection not correctly 
> reinited after db server restart
> 
> Hi, I wonder if you can help with the following problem:
> I use Tomcat 5.5, postgresql 8.3.1 and Torque.
> I first use the webapp using torque everything is ok. I close 
> the app, a db connection is still there.
> Now I reboot db. Try to relaunch the webapp and has this exception in
> catalina.out:
> 
> DEBUG org.apache.torque.util.SQLBuilder - SELECT 
> app_category.CATEGORY_ID, app_category.NAME FROM app_category WHERE
> app_category.CATEGORY_ID=1028
> org.apache.torque.TorqueException: 
> org.postgresql.util.PSQLException: An I/O error occured while 
> sending to the backend.
> 
> [torque.properties]
> torque.database.default=web_test_suite
> torque.database.web_test_suite.adapter = postgresql 
> torque.dsfactory.web_test_suite.factory = 
> org.apache.torque.dsfactory.SharedPoolDataSourceFactory
> torque.dsfactory.web_test_suite.connection.driver = 
> org.postgresql.Driver 
> torque.dsfactory.web_test_suite.connection.url = 
> jdbc:postgresql://myserver/mydb 
> torque.dsfactory.web_test_suite.connection.user = myuser 
> torque.dsfactory.web_test_suite.connection.password =
> 
> It seems that torque is not able to get a proper db 
> connection after the db server is restarted Any clue ?
> 
> ---------------------------------------------------------------------
> 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