idle timeout and max wait time in j2ee db connection pool

T

Tiwkiz

There two parameters( idel timeout, max wait time) can be configure at Sun
Application Server console in j2ee.
However, seemingly no timeout is generated even i set both parameters to be
2 seconds.
Is there any place in my program where i can set sleep so that timeout can
be generated when
two parameters are set to 1 second.

Thanks in advance.

TW

Pool Settings
Idle Timeout:
Maximum time that a connection can remain idle in the pool. (default is
300)
Max Wait Time:
Amount of time caller waits before connection timeout is sent

private static javax.sql.DataSource dataSource_;
private SessionContext context;
private static String JNDI_NAME = "java:comp/env/jdbc/TestDB2";
private static javax.sql.DataSource dataSource_;
private static String SELECT_USER_DB = "SELECT * FROM IIMS2_USERS";
private Connection connection_;

try{
javax.naming.Context c = new javax.naming.InitialContext();
dataSource_ = (javax.sql.DataSource) c.lookup("jdbc/myoracle");

Statement st = connection_.createStatement();
ResultSet rs = st.executeQuery(SELECT_USER_DB);

while(rs.next()){
User us = new
User(rs.getString("id"),rs.getString("ACC_NAME"));
vec.add( us );
}
try{
Thread.sleep(5000);
}catch( Exception e){

}
st.close();
rs.close();
}catch( SQLException e ){
e.printStackTrace();
}finally{
if( connection_ != null ){
try{
connection_.close();
}catch(SQLException e ){
e.printStackTrace();
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top