Forums Register Login

jdbc 2.0 connection pooling

+Pie Number of slices to send: Send
I am using MS SQL Server 2000 and Tomcat 4.0.
I am using Microsoft's JDBC Driver for MS SQL Server 2000.
I have set up a data source in Tomcat and it works fine.
I was reading throught the documentation on the driver I am using and was wondering if I had to execute code like this to take advantage of connection pooling :
Context initialContext = new InitialContext();
Context envCtx = (Context) initialContext.lookup("java:comp/env");
ConnectionPoolDataSource pooledDataSource = (ConnectionPoolDataSource) envCtx.lookup("jdbc/SQLSERVER");
PooledConnection pcon = pooledDataSource.getPooledConnection();
Connection con = pcon.getConnection();
or if I could execute code like this :
Context initialContext = new InitialContext();
Context envCtx = (Context) initialContext.lookup("java:comp/env");
DataSource dataSource = (DataSource) envCtx.lookup("jdbc/SQLSERVER");
Connection con = dataSource.getConnection();
Would the code above that doesnt use the ConnectionPoolDataSource interface still be taking advantage of ConnectionPooling?
Is this true or do you have to cast the jndi lookup of your data source to a ConnectionPoolDataSource to take advantage of connection pooling??
Do all jdbc compliant drivers take care of implementing the ConnectionPoolDataSource for you so all you have to do is define a datasource and it will pool the connections automatically??
Thanks.
Karim

[This message has been edited by karim qazi (edited November 20, 2001).]
That feels good. Thanks. Here's a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1321 times.
Similar Threads
WebSphere - DB2 DataSource Connection Problem
Synchronize DataSource Instance?
Why JNDI for database connection
Simple JDBC problem - Connection throws Nullpointerexception
Cannot create JDBC driver of class '' for connect URL 'null'
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 09:24:36.