A couple of thoughts here: 1. The timeout for DB2 should be configurable. If it isn't then there's nothing you can do anyway. If it is configurable, then work with your DBA to get it set to something that you and they agree is reasonable.
2. Don't test the environment. It sounds like your trying to test the database to ensure that it's doing what it should do. Don't. IBM pay lots of clever people to make sure that it does. Let them use their Ph.D.s to do your heavy lifting. :-) 3. What you really want to do, I suspect, is test that your code will handle stale connections correctly. So, if your code is up for it, send in a mock stale connection and see if it responds appropriately. If your data connection code can't handle being fed a mock connection, then take that as a hint that a little refactoring might be appropriate. At the very least the code to obtain a connection and the code to pass that connection back to the rest of the application should be in two pieces, so that you can mock the connection grabber for testing purposes. Hope this helps, Simon On Apr 5, 2005 8:37 AM, Janarthan Sathiamurthy <[EMAIL PROTECTED]> wrote: > Hi Group, > > My backend database is DB2. I have a junit test to > check the time out of a DB2 connection. A snippet of > it is as follows - > Connection con = > DBConnectionManager.getInstance().getConnection(POOL_NAME); > try > { > System.out.println("Thread to sleep.." + new Date()); > Thread.sleep(60000 * 60 * 18); > System.out.println("Thread woke up.."); > } > catch (InterruptedException e) > { > System.out.println("Thread Interrupted.." + new > Date()); > } > > Statement st = con.createStatement(); > ResultSet rs = st.executeQuery("SELECT * from temp"); > if(rs.next()) > { > System.out.println("Value " + rs.getString(1)); > } > > System.out.println("Ending test.." + new Date()); > > I am guessing the value to pass on to Thread.sleep(). > I tried with 10 hours yesterday, but the connection > worked out after 10 hours. Any ideas on what value > would is sufficient that to force a timeout. > > Best Regards, > Janarthan S > > __________________________________ > Yahoo! Messenger > Show us what our next emoticon should look like. Join the fun. > http://www.advision.webevents.yahoo.com/emoticontest > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]