This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I read the Microsoft SQL Server 2000 Driver for JDBC help documents:
The pool implementation creates "real" database connections using the getPooledConnection() method of ConnectionPoolDataSource. Then, the pool implementation registers itself as a listener to the PooledConnection. When a client application requests a connection, the pool implementation (Pool Manager) assigns one of its available connections. If there is no connection available, the Pool Manager establishes a new connection and assigns it to that application. When the client application closes the connection, the Pool Manager is notified by the driver through the ConnectionEventListener interface that the connection is free and available for reuse. The pool implementation is also notified by the ConnectionEventListener interface when the client somehow corrupts the database connection, so that the pool implementation can remove that connection from the pool.
Once a SQL Server 2000 Driver for JDBC data source has been registered with JNDI, it can be used by your JDBC application as shown in the following example, typically through a third-party connection pool tool:
In this example, the JNDI environment is first initialized. Next, the initial naming context is used to find the logical name of the JDBC data source (EmployeeDB). The Context.lookup() method returns a reference to a Java object, which is narrowed to a javax.sql.ConnectionPoolDataSource object. Finally, the ConnectionPoolDataSource.getPooledConnection() method is called to establish a connection with the underlying database.
NOTE: JDBC drivers do not manage connection pooling. You must use an external connection pool manager.
I need to create a pool and the create method is:
I added breakpoint and saw that the following code did not execute and finally return a nullpointerexception.
Q.1 I am not sure "Once a SQL Server 2000 Driver for JDBC data source has been registered with JNDI", how can I register with JNDI?
Q.2 I saw that the help document mentioned ConnectionPoolDataSource.getPooledConnection(), my connectionpool java class does not has getPooledConnection() method.
I have only the public synchronized java.sql.Connection getConnection() which seems not use javax.sql.ConnectionPoolDataSource, it only uses java.sql.Connection.
May I ask where can I download the connection pool manager java source?