1 21 22 package org.apache.derby.jdbc; 23 24 import java.sql.SQLException ; 25 import javax.sql.ConnectionPoolDataSource ; 26 import javax.sql.DataSource ; 27 import javax.sql.PooledConnection ; 28 import org.apache.derby.client.am.LogWriter; 29 import org.apache.derby.client.am.SqlException; 30 31 44 public class ClientConnectionPoolDataSource extends ClientDataSource 45 implements ConnectionPoolDataSource { 46 private static final long serialVersionUID = -539234282156481377L; 47 public static final String className__ = "org.apache.derby.jdbc.ClientConnectionPoolDataSource"; 48 49 public ClientConnectionPoolDataSource() { 50 super(); 51 } 52 53 55 public PooledConnection getPooledConnection() throws SQLException { 57 try 58 { 59 LogWriter dncLogWriter = super.computeDncLogWriterForNewConnection("_cpds"); 60 if (dncLogWriter != null) { 61 dncLogWriter.traceEntry(this, "getPooledConnection"); 62 } 63 PooledConnection pooledConnection = getPooledConnectionX(dncLogWriter, this, getUser(), getPassword()); 64 if (dncLogWriter != null) { 65 dncLogWriter.traceExit(this, "getPooledConnection", pooledConnection); 66 } 67 return pooledConnection; 68 } 69 catch ( SqlException se ) 70 { 71 throw se.getSQLException(); 72 } 73 } 74 75 public PooledConnection getPooledConnection(String user, String password) throws SQLException { 77 try 78 { 79 LogWriter dncLogWriter = super.computeDncLogWriterForNewConnection("_cpds"); 80 if (dncLogWriter != null) { 81 dncLogWriter.traceEntry(this, "getPooledConnection", user, "<escaped>"); 82 } 83 PooledConnection pooledConnection = getPooledConnectionX(dncLogWriter, this, user, password); 84 if (dncLogWriter != null) { 85 dncLogWriter.traceExit(this, "getPooledConnection", pooledConnection); 86 } 87 return pooledConnection; 88 } 89 catch ( SqlException se ) 90 { 91 throw se.getSQLException(); 92 } 93 } 94 95 private PooledConnection getPooledConnectionX(LogWriter dncLogWriter, 98 ClientBaseDataSource ds, String user, 99 String password) throws SQLException { 100 return ClientDriver.getFactory().newClientPooledConnection(ds, 101 dncLogWriter, user, password); 102 } 103 } 104 | Popular Tags |