dcsimg
About connection pool of database
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   a_sd
Posted On:   Thursday, June 24, 2004 05:30 PM

i used this component liked ( used JNDI): Context context = new InitialContext(); DataSource ds = ( Datasource)context.lookup("JNDI/MYDS"); Connection con = ds.getConnection(); //..... do something con.close(); as i known,the principium of connection pool was that: Open some connection with a certain number configured before , come into being pool,retrieve a connection from the pool when a client request coming,and push back connection into the pool which had used by client. look at the code above,am i whether only call con.flush() when ended my operation with the connection,instead of calling con.close(); i must call con.flush() at least since the influence of operation was comm   More>>

i used this component liked ( used JNDI):
Context context = new InitialContext();
DataSource ds = ( Datasource)context.lookup("JNDI/MYDS");
Connection con = ds.getConnection();
//..... do something
con.close();

as i known,the principium of connection pool was that:
Open some connection with a certain number configured before , come into being pool,retrieve a connection from the pool when a client request coming,and push back connection into the pool which had used by client.
look at the code above,am i whether only call con.flush() when ended my operation with the connection,instead of calling con.close();
i must call con.flush() at least since the influence of operation was committed until doing that.
the following puzzled me:
1,if i only call con.flush(),could the container of connection pool put the connection into the pool and sighed it can be retrieved by another request?
2,if i call con.close(),is it whether that closed the connection really?if sure,is it whether that the connection pool will re-open connection from database,and have a pool like this any effect?

can some one give me some introduction about it or some principium in database connection pool implement?

thx very much.

   <<Less
About | Sitemap | Contact