• Post Reply Bookmark Topic Watch Topic
  • New Topic

tomcat 4 jdbc-jndi questions: restart database  RSS feed

Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I setup a jdbc-jndi to informix in my webapp with tomcat 4.0.3. Then I restart the database, and retest my webapp, I am suprise to see that the connection pool is still work, here is my code to get connection whenever I need one:
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)envCtx.lookup("jdbc/informix");
Connection con = ds.getConnection();
My questions:
1) Is a new connection pool created everytime I use the code above? If so, then that is why it works even I restart database.
2) If not, then is tomcat validate the connection object before return it out? (otherwise I will get error when I use the connection object)
3) If it do validate the connection, any info. about how it get validated? i.e. simple select...?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!