summaryrefslogtreecommitdiff
path: root/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ConnectionPool.java
diff options
context:
space:
mode:
authorBarry Lind <barry@xythos.com>2002-09-25 07:01:31 +0000
committerBarry Lind <barry@xythos.com>2002-09-25 07:01:31 +0000
commit7bf1c8b0ad5f2534362fb6938be28bb041d79c90 (patch)
tree4e12707f3fb34f61d91c24f6b4b86cee49596c62 /src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ConnectionPool.java
parent65bf5a39e08ed5ae395725c8353714482a8ec132 (diff)
downloadpostgresql-7bf1c8b0ad5f2534362fb6938be28bb041d79c90.tar.gz
Applied patch from Aaron Mulder (ammulder@alumni.princeton.edu) that fixes
jdbc datasource support for jdk1.4/jdbc3 Modified Files: jdbc/build.xml jdbc/org/postgresql/Driver.java.in jdbc/org/postgresql/jdbc2/optional/BaseDataSource.java jdbc/org/postgresql/jdbc2/optional/PGObjectFactory.java jdbc/org/postgresql/jdbc2/optional/PooledConnectionImpl.java jdbc/org/postgresql/jdbc2/optional/PoolingDataSource.java jdbc/org/postgresql/test/jdbc2/optional/BaseDataSourceTest.java jdbc/org/postgresql/test/jdbc2/optional/OptionalTestSuite.java jdbc/org/postgresql/test/jdbc3/Jdbc3TestSuite.java Added Files: jdbc/org/postgresql/jdbc3/Jdbc3ConnectionPool.java jdbc/org/postgresql/jdbc3/Jdbc3ObjectFactory.java jdbc/org/postgresql/jdbc3/Jdbc3PooledConnection.java jdbc/org/postgresql/jdbc3/Jdbc3PoolingDataSource.java jdbc/org/postgresql/jdbc3/Jdbc3SimpleDataSource.java jdbc/org/postgresql/test/jdbc2/optional/PoolingDataSourceTest.java jdbc/org/postgresql/test/jdbc3/Jdbc3ConnectionPoolTest.java jdbc/org/postgresql/test/jdbc3/Jdbc3PoolingDataSourceTest.java jdbc/org/postgresql/test/jdbc3/Jdbc3SimpleDataSourceTest.java jdbc/org/postgresql/test/util/MiniJndiContext.java jdbc/org/postgresql/test/util/MiniJndiContextFactory.java
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ConnectionPool.java')
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ConnectionPool.java61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ConnectionPool.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ConnectionPool.java
new file mode 100644
index 0000000000..1f739d5eb9
--- /dev/null
+++ b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ConnectionPool.java
@@ -0,0 +1,61 @@
+package org.postgresql.jdbc3;
+
+import org.postgresql.jdbc2.optional.ConnectionPool;
+
+import javax.sql.PooledConnection;
+import javax.naming.Reference;
+import java.sql.SQLException;
+
+/**
+ * Jdbc3 implementation of ConnectionPoolDataSource. This is
+ * typically the interface used by an app server to interact
+ * with connection pools provided by a JDBC driver. PostgreSQL
+ * does not support XADataSource, the other common connection
+ * pooling interface (for connections supporting the two-phase
+ * commit protocol).
+ *
+ * @author Aaron Mulder (ammulder@alumni.princeton.edu)
+ * @version $Revision: 1.1 $
+ */
+public class Jdbc3ConnectionPool extends ConnectionPool
+{
+ /**
+ * Gets a description of this DataSource.
+ */
+ public String getDescription()
+ {
+ return "Jdbc3ConnectionPool from " + org.postgresql.Driver.getVersion();
+ }
+
+ /**
+ * Gets a connection which may be pooled by the app server or middleware
+ * implementation of DataSource.
+ *
+ * @throws java.sql.SQLException
+ * Occurs when the physical database connection cannot be established.
+ */
+ public PooledConnection getPooledConnection() throws SQLException
+ {
+ return new Jdbc3PooledConnection(getConnection(), isDefaultAutoCommit());
+ }
+
+ /**
+ * Gets a connection which may be pooled by the app server or middleware
+ * implementation of DataSource.
+ *
+ * @throws java.sql.SQLException
+ * Occurs when the physical database connection cannot be established.
+ */
+ public PooledConnection getPooledConnection(String user, String password) throws SQLException
+ {
+ return new Jdbc3PooledConnection(getConnection(user, password), isDefaultAutoCommit());
+ }
+
+ /**
+ * Generates a JDBC object factory reference.
+ */
+ protected Reference createReference()
+ {
+ return new Reference(getClass().getName(), Jdbc3ObjectFactory.class.getName(), null);
+ }
+}