Use the resilient data source in torque.properties instead of the classic datasource, and then set your validation query.
Note: The example validation query SELECT 1 may not be enough, we found that on database startup (Sybase) if a connection attempt was made the SELECT 1 would pass but the actual database hadn't been fully recovered - this then gave us duff connections - so we changed our SELECT 1 to SELECT from a single column table with only ever one entry. This seems to do fine for us. Damien -----Original Message----- From: Jinsong Hu [mailto:[EMAIL PROTECTED] Sent: 20 April 2005 06:41 To: [email protected] Subject: connection recovery Hi, There, I have been using torque in our project.I am trying to get this to work: 1. use Torque.init(); 2. use the torque connections for various tasks. 3. shutdown the database manually. at this stage, no connection can be used. 4. start database manually, and in the java code, try to use db connection again. what happens is that for oracle database, in step 4, the connection will work, and I can continue to select/insert data without special effort. but if the database is ms sql, then the connections will always fail, saying broken pipe. I have to restart my application to get connection work again. I wonder if in torque there is a method to ask the torque to re-establish db connection. it looks trying shutdown() then init() doesn't do the trick. I am using torque 3.1 Jinsong This e-mail transmission may contain information that is proprietary, privileged and/or confidential and is intended exclusively for the person(s) to whom it is addressed. Any use, copying, retention or disclosure by any person other than the intended recipient or the intended recipient's designees is strictly prohibited. If you are the intended recipient, you must treat the information in confidence and in accordance with all laws related to the privacy and confidentiality of such information. If you are not the intended recipient or their designee, please notify the sender immediately by return e-mail and delete all copies of this email, including all attachments. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
