docUK
08-01-02, 06:03
| I'm trying to create a pool of database connections (basically don't have access to J2EE technology) using the java.sql, javax.sql and jConnect5-2 packages with a Sybase database. Question! I've seen several exmaples of connection pooling where the 'author' has suggested using traditional methods of JDBC connection, storing them in a Hashtable, then implenting a checkout/checkin procedure for usage. However, within the jConnect package, there are classes such as SybConnectionPoolDataSource etc. Unfortunately, there seems to be no documentation supporting these classes. Through trial and error, I see that the above name class returns a PooledConnection.class when I call method getPooledConnection, and calling getConnection on the PooledConnection class returns a Connection class. Also, after I call close on the Connection class, it is very quick to re-obtain the Connection by again calling getConnection on the PooledConnection class. So, what is the benefit of using this method; storing a collection of PooledConnection classes that I can lease out to users, as opposed to just storing a collection of Connections that can be leased out? Have I missed some major point, or is there a better way to do this? Your help would be truly appreciated. docUK |