*
The moose likes JDBC and the fly likes tomcat 4 jdbc-jndi questions: restart database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "tomcat 4 jdbc-jndi questions: restart database" Watch "tomcat 4 jdbc-jndi questions: restart database" New topic
Author

tomcat 4 jdbc-jndi questions: restart database

david chan
Ranch Hand

Joined: Jun 10, 2002
Posts: 46
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...?
Thanks.
David
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: tomcat 4 jdbc-jndi questions: restart database