tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard McKinley <...@randtech.com>
Subject RE: Connection Pool
Date Wed, 31 May 2000 15:48:42 GMT
I don't know if I did this right but I will submit it to everyone's review:

package test;

import javax.sql.PooledConnection;
import oracle.jdbc.pool.OracleConnectionPoolDataSource;
import java.sql.SQLException;

/** Connection object class */
public class ConnPoolDS {
  private static OracleConnectionPoolDataSource ocpdSource;

  public static PooledConnection getPooledConnection() throws SQLException {
    if (ocpdSource == null) {
      synchronized (ConnPoolDS.class) {
        if (ocpdSource == null) {
	      ocpdSource = new OracleConnectionPoolDataSource();
	      ocpdSource.setURL("jdbc:oracle:thin:@servername:1521:ORCL"); 
        }
      }
    }
    return ocpdSource.getPooledConnection("username","password");
  }


}

-----Original Message-----
Can give me a hint as to what strategy to use to implement a connection pool
that is global to the Web Application or possibly global to the JVM,
whichever is better.

Mime
View raw message