Connection Pooling Question
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Daniel_Baylon
Posted On:   Tuesday, February 10, 2004 03:27 PM

I know that Tomcat uses JNDI to provide database access through connection pooling services. I'm migrating a Client/Server Application to Tomcat Web application. Client/Server application uses session tables which only retains information while database session is active. When using database applications, programs doesn't open directly database connections, instead uses an intance from tomcat like this: import java.sql.*; import javax.naming.*; import javax.sql.*; public class MyData{ private DataSource dsData; private Connection dbData; public void openDB(){   Context ctx   More>>

I know that Tomcat uses JNDI to provide database access through connection pooling services.



I'm migrating a Client/Server Application to Tomcat Web application.



Client/Server application uses session tables which only retains information while database session is active.



When using database applications, programs doesn't open directly database connections, instead uses an intance from tomcat like this:





import java.sql.*;

import javax.naming.*;

import javax.sql.*;


public class MyData{


private DataSource dsData;

private Connection dbData;


public void openDB(){

  Context ctxEnv;

  Context ctxData;


  ctxEnv = new InitialContext();

  ctxData = (Context) ctxEnv.lookup("java:comp/env");

  dsData = (DataSource) ctxData.lookup("jdbc/MyAppDB");

}


public void getData(){

  dbData = dsData.getConnection();

...

  dbData.close();

}


}



My question is, when database session starts and ends?



Session tables presents a stnager behavior.



I appreciate some help.



Best Regards

   <<Less
About | Sitemap | Contact