db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1364042 - in /db/derby/code/trunk/java: client/org/apache/derby/client/am/ client/org/apache/derby/client/net/ client/org/apache/derby/jdbc/ testing/org/apache/derbyTesting/functionTests/tests/jdbc4/
Date Sat, 21 Jul 2012 08:20:51 GMT
Author: kahatlen
Date: Sat Jul 21 08:20:50 2012
New Revision: 1364042

URL: http://svn.apache.org/viewvc?rev=1364042&view=rev
Log:
DERBY-5868: Move java.sql.Wrapper implementations to base classes on the client

Moved isWrapperFor() and unwrap() implementations to base classes to
reduce duplication of code.

Also moved some other methods that were duplicated in PreparedStatement40
and CallableStatement40 to their common base class PreparedStatement.

Removed:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData40.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData40.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement40.java
Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalCallableStatement40.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalPreparedStatement40.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalStatementEntity.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement40.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl40.java
    db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource.java
    db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource40.java
    db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource.java
    db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource40.java
    db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource.java
    db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource40.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/JDBC4FromJDBC3DataSourceTest.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java?rev=1364042&r1=1364041&r2=1364042&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java Sat Jul 21 08:20:50 2012
@@ -34,8 +34,6 @@ import java.sql.SQLXML;
 import java.sql.Time;
 import java.sql.Timestamp;
 import org.apache.derby.client.ClientPooledConnection;
-import org.apache.derby.client.am.SqlException;
-import org.apache.derby.client.am.ClientMessageId;
 import org.apache.derby.shared.common.reference.SQLState;
 
 
@@ -173,40 +171,16 @@ public class CallableStatement40 extends
     
     /**************************************************************************
      * The methods from PreparedStatement for JDBC 4.0.                       *
-     * These are added here because we can't inherit                          *
-     * PreparedStatement40.java. Instead of moving the non-implemented        *
-     * classes to PreparedStatement.java, we duplicate them here.             *
+     * These are added here because we can't inherit PreparedStatement40.     *
+     * Since the methods reference classes that did not exist prior to        *
+     * JDBC 4.0, we cannot implement them in PreparedStatement, so we         *
+     * duplicate them here.                                                   *
      **************************************************************************/
-    public void setNString(int index, String value) throws SQLException {
-        throw SQLExceptionFactory.notImplemented ("setNString (int, String)");
-    }
-    
-    public void setNCharacterStream(int parameterIndex, Reader value)
-            throws SQLException {
-        throw SQLExceptionFactory.notImplemented("setNCharacterStream" +
-                "(int,Reader)");
-    }
 
-    public void setNCharacterStream(int index, Reader value, long length) throws SQLException {
-        throw SQLExceptionFactory.notImplemented ("setNCharacterStream " +
-                "(int,Reader,long)");
-    }
-    
     public void setNClob(int index, NClob value) throws SQLException {
         throw SQLExceptionFactory.notImplemented ("setNClob (int, NClob)");
     }
-    
-    public void setNClob(int parameterIndex, Reader reader)
-            throws SQLException {
-        throw SQLExceptionFactory.notImplemented("setNClob(int,Reader)");
-    }
 
-    public void setNClob(int parameterIndex, Reader reader, long length)
-    throws SQLException {
-        throw SQLExceptionFactory.notImplemented ("setNClob (int, " +
-                "Reader, long)");
-    }
-    
     public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {
         throw SQLExceptionFactory.notImplemented ("setSQLXML (int, SQLXML)");
     }
@@ -256,28 +230,6 @@ public class CallableStatement40 extends
     }
 
     /**
-     * Returns <code>this</code> if this class implements the interface
-     *
-     * @param  interfaces a Class defining an interface
-     * @return an object that implements the interface
-     * @throws java.sql.SQLExption if no object if found that implements the 
-     * interface
-     */
-    public <T> T unwrap(java.lang.Class<T> interfaces)
-                                   throws SQLException {
-        try { 
-            checkForClosedStatement();
-            return interfaces.cast(this);
-        } catch (ClassCastException cce) {
-            throw new SqlException(null, new ClientMessageId(SQLState.UNABLE_TO_UNWRAP),
-                    interfaces).getSQLException();
-        } catch (SqlException se) {
-            throw se.getSQLException();
-        }
-    }
-
-
-    /**
      * Sets the designated parameter to the given input stream, which will have
      * the specified number of bytes.
      *

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData.java?rev=1364042&r1=1364041&r2=1364042&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData.java Sat Jul 21 08:20:50 2012
@@ -841,4 +841,37 @@ public class ColumnMetaData implements j
         return (sqlCcsid_[index] != 1208);
     }
 
+    // JDBC 4.0 java.sql.Wrapper interface methods
+
+    /**
+     * Check whether this instance wraps an object that implements the interface
+     * specified by {@code iface}.
+     *
+     * @param iface a class defining an interface
+     * @return {@code true} if this instance implements {@code iface}, or
+     * {@code false} otherwise
+     * @throws SQLException if an error occurs while determining if this
+     * instance implements {@code iface}
+     */
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        return iface.isInstance(this);
+    }
+
+    /**
+     * Returns {@code this} if this class implements the specified interface.
+     *
+     * @param  iface a class defining an interface
+     * @return an object that implements the interface
+     * @throws SQLException if no object is found that implements the
+     * interface
+     */
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        try {
+            return iface.cast(this);
+        } catch (ClassCastException cce) {
+            throw new SqlException(null,
+                    new ClientMessageId(SQLState.UNABLE_TO_UNWRAP),
+                    iface).getSQLException();
+        }
+    }
 }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalCallableStatement40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalCallableStatement40.java?rev=1364042&r1=1364041&r2=1364042&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalCallableStatement40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalCallableStatement40.java Sat Jul 21 08:20:50 2012
@@ -28,11 +28,8 @@ import java.sql.NClob;
 import java.sql.RowId;
 import java.sql.SQLException;
 import java.sql.SQLXML;
-
 import org.apache.derby.client.am.stmtcache.StatementKey;
 
-import org.apache.derby.shared.common.reference.SQLState;
-
 /**
  * JDBC 4 specific wrapper class for a Derby physical callable statement.
  *
@@ -167,28 +164,6 @@ public class LogicalCallableStatement40
         return getPhysCs().isPoolable();
     }
 
-    public <T> T unwrap(Class<T> arg0)
-            throws SQLException {
-        try {
-            if (getPhysCs().isClosed()) {
-                throw (new SqlException(null,
-                    new ClientMessageId(SQLState.ALREADY_CLOSED),
-                                        "CallableStatement")).getSQLException();
-            }
-            return arg0.cast(this);
-        } catch (ClassCastException cce) {
-            throw new SqlException(
-                    null,
-                    new ClientMessageId(SQLState.UNABLE_TO_UNWRAP),
-                    arg0).getSQLException();
-        }
-    }
-
-    public boolean isWrapperFor(Class<?> arg0)
-            throws SQLException {
-        return getPhysCs().isWrapperFor(arg0);
-    }
-
     public RowId getRowId(int arg0)
             throws SQLException {
         return getPhysCs().getRowId(arg0);

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalPreparedStatement40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalPreparedStatement40.java?rev=1364042&r1=1364041&r2=1364042&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalPreparedStatement40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalPreparedStatement40.java Sat Jul 21 08:20:50 2012
@@ -22,16 +22,12 @@ package org.apache.derby.client.am;
 
 import java.io.InputStream;
 import java.io.Reader;
-
 import java.sql.NClob;
 import java.sql.RowId;
 import java.sql.SQLException;
 import java.sql.SQLXML;
-
 import org.apache.derby.client.am.stmtcache.StatementKey;
 
-import org.apache.derby.shared.common.reference.SQLState;
-
 /**
  * JDBC 4 specific wrapper class for a Derby physical prepared statement.
  *
@@ -166,25 +162,4 @@ public class LogicalPreparedStatement40
         return getPhysPs().isPoolable();
     }
 
-    public <T> T unwrap(Class<T> arg0)
-            throws SQLException {
-        try {
-            if (getPhysPs().isClosed()) {
-                throw (new SqlException(null,
-                    new ClientMessageId(SQLState.ALREADY_CLOSED),
-                                        "PreparedStatement")).getSQLException();
-            }
-            return arg0.cast(this);
-        } catch (ClassCastException cce) {
-            throw new SqlException(
-                    null,
-                    new ClientMessageId(SQLState.UNABLE_TO_UNWRAP),
-                    arg0).getSQLException();
-        }
-    }
-
-    public boolean isWrapperFor(Class<?> arg0)
-            throws SQLException {
-        return getPhysPs().isWrapperFor(arg0);
-    }
 }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalStatementEntity.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalStatementEntity.java?rev=1364042&r1=1364041&r2=1364042&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalStatementEntity.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalStatementEntity.java Sat Jul 21 08:20:50 2012
@@ -21,10 +21,9 @@
 package org.apache.derby.client.am;
 
 import java.sql.SQLException;
-
 import org.apache.derby.client.am.stmtcache.JDBCStatementCache;
 import org.apache.derby.client.am.stmtcache.StatementKey;
-import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.shared.common.reference.SQLState;
 import org.apache.derby.shared.common.sanity.SanityManager;
 
 /**
@@ -219,6 +218,49 @@ abstract class LogicalStatementEntity
         return (physicalPs == null);
     }
     
+    // JDBC 4.0 java.sql.Wrapper interface methods
+
+    /**
+     * Check whether this instance wraps an object that implements the interface
+     * specified by {@code iface}.
+     *
+     * @param iface a class defining an interface
+     * @return {@code true} if this instance implements {@code iface}, or
+     * {@code false} otherwise
+     * @throws SQLException if an error occurs while determining if this
+     * instance implements {@code iface}
+     */
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        return ((org.apache.derby.client.am.Statement) getPhysStmt())
+                .isWrapperFor(iface);
+    }
+
+    /**
+     * Returns an instance of the specified interface if this instance is
+     * a wrapper for the interface.
+     *
+     * @param  iface a class defining an interface
+     * @return an object that implements the interface
+     * @throws SQLException if no object is found that implements the
+     * interface
+     */
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        if (((org.apache.derby.client.am.Statement) getPhysStmt()).isClosed()) {
+            throw new SqlException(null,
+                new ClientMessageId(SQLState.ALREADY_CLOSED),
+                hasCallableStmt ? "CallableStatement" : "PreparedStatement")
+                    .getSQLException();
+        }
+
+        try {
+            return iface.cast(this);
+        } catch (ClassCastException cce) {
+            throw new SqlException(null,
+                new ClientMessageId(SQLState.UNABLE_TO_UNWRAP), iface)
+                    .getSQLException();
+        }
+    }
+
     ////////////////////////////////////////////////////////////////////
     //
     // INTRODUCED BY JDBC 4.1 IN JAVA 7

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData.java?rev=1364042&r1=1364041&r2=1364042&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData.java Sat Jul 21 08:20:50 2012
@@ -22,6 +22,7 @@
 package org.apache.derby.client.am;
 
 import java.sql.SQLException;
+import org.apache.derby.shared.common.reference.SQLState;
 
 // Parameter meta data as used internally by the driver is always a column meta data instance.
 // We will only create instances of this class when getParameterMetaData() is called.
@@ -89,6 +90,37 @@ public class ParameterMetaData implement
         return columnMetaData_.getScale(param);
     }
 
-}
-
+    // JDBC 4.0 java.sql.Wrapper interface methods
 
+    /**
+     * Check whether this instance wraps an object that implements the interface
+     * specified by {@code iface}.
+     *
+     * @param iface a class defining an interface
+     * @return {@code true} if this instance implements {@code iface}, or
+     * {@code false} otherwise
+     * @throws SQLException if an error occurs while determining if this
+     * instance implements {@code iface}
+     */
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        return iface.isInstance(this);
+    }
+
+    /**
+     * Returns {@code this} if this class implements the specified interface.
+     *
+     * @param  iface a class defining an interface
+     * @return an object that implements the interface
+     * @throws SQLException if no object is found that implements the
+     * interface
+     */
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        try {
+            return iface.cast(this);
+        } catch (ClassCastException cce) {
+            throw new SqlException(null,
+                    new ClientMessageId(SQLState.UNABLE_TO_UNWRAP),
+                    iface).getSQLException();
+        }
+    }
+}

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java?rev=1364042&r1=1364041&r2=1364042&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java Sat Jul 21 08:20:50 2012
@@ -21,10 +21,6 @@
 
 package org.apache.derby.client.am;
 
-import org.apache.derby.shared.common.reference.JDBC40Translation;
-import org.apache.derby.shared.common.reference.SQLState;
-import org.apache.derby.shared.common.sanity.SanityManager;
-
 import java.io.InputStream;
 import java.io.Reader;
 import java.sql.Date;
@@ -36,6 +32,9 @@ import java.util.Arrays;
 import java.util.Calendar;
 import org.apache.derby.client.ClientPooledConnection;
 import org.apache.derby.jdbc.ClientDriver;
+import org.apache.derby.shared.common.reference.JDBC40Translation;
+import org.apache.derby.shared.common.reference.SQLState;
+import org.apache.derby.shared.common.sanity.SanityManager;
 
 public class PreparedStatement extends Statement
         implements java.sql.PreparedStatement,
@@ -2541,7 +2540,7 @@ public class PreparedStatement extends S
         	connection_.CommitAndRollbackListeners_.remove(this);
     }
     
-    //jdbc 4.0 methods
+    // JDBC 4.0 methods
 
     /**
      * Sets the designated parameter to the given input stream.
@@ -2740,6 +2739,34 @@ public class PreparedStatement extends S
         }
     }    
  
+    public void setNString(int index, String value) throws SQLException {
+        throw SQLExceptionFactory.notImplemented("setNString(int, String)");
+    }
+
+    public void setNCharacterStream(int parameterIndex, Reader value)
+            throws SQLException {
+        throw SQLExceptionFactory.notImplemented(
+                "setNCharacterStream(int, Reader)");
+    }
+
+    public void setNCharacterStream(int index, Reader value, long length)
+            throws SQLException {
+        throw SQLExceptionFactory.notImplemented(
+                "setNCharacterStream(int, Reader, long)");
+    }
+
+    public void setNClob(int parameterIndex, Reader reader)
+            throws SQLException {
+        throw SQLExceptionFactory.notImplemented("setNClob(int, Reader)");
+    }
+
+    public void setNClob(int parameterIndex, Reader reader, long length)
+            throws SQLException {
+        throw SQLExceptionFactory.notImplemented("setNClob(int, Reader, long)");
+    }
+
+    // End of JDBC 4.0 methods
+
         /*
          * Method calls onStatementError occurred on the 
          * BrokeredConnectionControl class after checking the 

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement40.java?rev=1364042&r1=1364041&r2=1364042&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement40.java Sat Jul 21 08:20:50 2012
@@ -21,16 +21,11 @@
 
 package org.apache.derby.client.am;
 
-import java.sql.RowId;
 import java.sql.NClob;
+import java.sql.RowId;
 import java.sql.SQLException;
 import java.sql.SQLXML;
-import java.io.Reader;
-import java.io.InputStream;
 import org.apache.derby.client.ClientPooledConnection;
-import org.apache.derby.client.am.SqlException;
-import org.apache.derby.client.am.ClientMessageId;
-import org.apache.derby.shared.common.reference.SQLState;
 
 public class  PreparedStatement40 extends  org.apache.derby.client.am.PreparedStatement{
 
@@ -100,64 +95,16 @@ public class  PreparedStatement40 extend
                 columnNames, columnIndexes, cpc);
     }
     
-    
     public void setRowId(int parameterIndex, RowId x) throws SQLException{
         throw SQLExceptionFactory.notImplemented ("setRowId (int, RowId)");
     }
     
-    public void setNString(int index, String value) throws SQLException{
-        throw SQLExceptionFactory.notImplemented ("setNString (int, String)");
-    }
-
-    public void setNCharacterStream(int parameterIndex, Reader value)
-            throws SQLException {
-        throw SQLExceptionFactory.notImplemented("setNCharacterStream" +
-                "(int,Reader)");
-    }
-
-    public void setNCharacterStream(int index, Reader value, long length) 
-                throws SQLException{
-        throw SQLExceptionFactory.notImplemented ("setNCharacterStream " +
-                "(int,Reader,long)");
-    }
-
-    public void setNClob(int parameterIndex, Reader reader)
-            throws SQLException {
-        throw SQLExceptionFactory.notImplemented("setNClob(int,Reader)");
-    }
-
     public void setNClob(int index, NClob value) throws SQLException{
         throw SQLExceptionFactory.notImplemented ("setNClob (int, NClob)");
     }
     
-    public void setNClob(int parameterIndex, Reader reader, long length)
-    throws SQLException{
-        throw SQLExceptionFactory.notImplemented ("setNClob (int, Reader, long)");
-    }
-    
     public void setSQLXML(int parameterIndex, SQLXML xmlObject) 
                 throws SQLException{
         throw SQLExceptionFactory.notImplemented ("setSQLXML (int, SQLXML)");
     }
-    
-    /**
-     * Returns <code>this</code> if this class implements the interface
-     *
-     * @param  interfaces a Class defining an interface
-     * @return an object that implements the interface
-     * @throws java.sql.SQLExption if no object if found that implements the 
-     * interface
-     */
-    public <T> T unwrap(java.lang.Class<T> interfaces)
-                                   throws SQLException {
-        try { 
-            checkForClosedStatement();
-            return interfaces.cast(this);
-        } catch (ClassCastException cce) {
-            throw new SqlException(null,new ClientMessageId(SQLState.UNABLE_TO_UNWRAP),
-                    interfaces).getSQLException();
-        } catch (SqlException se) {
-            throw se.getSQLException();
-        }
-    }
 }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java?rev=1364042&r1=1364041&r2=1364042&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java Sat Jul 21 08:20:50 2012
@@ -529,7 +529,7 @@ public class Statement implements java.s
      *                                whether this is a wrapper for an object 
      *                                with the given interface.
      */
-    public boolean isWrapperFor(Class iface) throws SQLException {
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
         try {
             checkForClosedStatement();
         } catch (SqlException se) {
@@ -539,6 +539,28 @@ public class Statement implements java.s
     }
 
     /**
+     * Returns {@code this} if this class implements the specified interface.
+     *
+     * @param  iface a class defining an interface
+     * @return an object that implements the interface
+     * @throws SQLException if no object is found that implements the
+     * interface
+     */
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        try {
+            checkForClosedStatement();
+            try {
+                return iface.cast(this);
+            } catch (ClassCastException cce) {
+                throw new SqlException(
+                  null, new ClientMessageId(SQLState.UNABLE_TO_UNWRAP), iface);
+            }
+        } catch (SqlException se) {
+            throw se.getSQLException();
+        }
+    }
+
+    /**
      * Tell whether the statement has been closed or not.
      *
      * @return <code>true</code> if closed, <code>false</code> otherwise.

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl40.java?rev=1364042&r1=1364041&r2=1364042&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl40.java Sat Jul 21 08:20:50 2012
@@ -21,49 +21,40 @@
 
 package org.apache.derby.client.net;
 
+import java.sql.SQLException;
 import org.apache.derby.client.ClientPooledConnection;
 import org.apache.derby.client.ClientPooledConnection40;
 import org.apache.derby.client.ClientXAConnection;
 import org.apache.derby.client.ClientXAConnection40;
+import org.apache.derby.client.am.Agent;
 import org.apache.derby.client.am.CachingLogicalConnection40;
 import org.apache.derby.client.am.CallableStatement;
 import org.apache.derby.client.am.CallableStatement40;
-import org.apache.derby.client.am.ColumnMetaData;
-import org.apache.derby.client.am.ColumnMetaData40;
-import org.apache.derby.client.am.ClientJDBCObjectFactory;
-import org.apache.derby.client.am.LogicalConnection;
-import org.apache.derby.client.am.LogicalConnection40;
-import org.apache.derby.client.am.PreparedStatement;
-import org.apache.derby.client.am.PreparedStatement40;
-import org.apache.derby.client.am.ParameterMetaData;
-import org.apache.derby.client.am.ParameterMetaData40;
+import org.apache.derby.client.am.Cursor;
+import org.apache.derby.client.am.LogWriter;
 import org.apache.derby.client.am.LogicalCallableStatement;
 import org.apache.derby.client.am.LogicalCallableStatement40;
+import org.apache.derby.client.am.LogicalConnection;
+import org.apache.derby.client.am.LogicalConnection40;
 import org.apache.derby.client.am.LogicalPreparedStatement;
 import org.apache.derby.client.am.LogicalPreparedStatement40;
-import org.apache.derby.client.am.LogWriter;
-import org.apache.derby.client.am.Agent;
+import org.apache.derby.client.am.PreparedStatement;
+import org.apache.derby.client.am.PreparedStatement40;
 import org.apache.derby.client.am.SQLExceptionFactory40;
 import org.apache.derby.client.am.Section;
-import org.apache.derby.client.am.Statement;
-import org.apache.derby.client.am.Statement40;
-import org.apache.derby.client.am.StatementCacheInteractor;
 import org.apache.derby.client.am.SqlException;
-import org.apache.derby.client.am.Cursor;
+import org.apache.derby.client.am.StatementCacheInteractor;
 import org.apache.derby.client.am.stmtcache.JDBCStatementCache;
 import org.apache.derby.client.am.stmtcache.StatementKey;
-import org.apache.derby.client.net.NetLogWriter;
-import org.apache.derby.jdbc.ClientDataSource;
 import org.apache.derby.jdbc.ClientBaseDataSource;
 import org.apache.derby.jdbc.ClientXADataSource;
 
-import java.sql.SQLException;
-
 /**
- * Implements the ClientJDBCObjectFactory interface
- * and returns the JDBC4.0 specific classes
+ * Implements the ClientJDBCObjectFactory interface and returns the JDBC 4.0
+ * specific classes. If specific classes are not needed for JDBC 4.0, the calls
+ * are delegated to ClientJDBCObjectFactoryImpl by inheritance.
  */
-public class ClientJDBCObjectFactoryImpl40 implements ClientJDBCObjectFactory{
+public class ClientJDBCObjectFactoryImpl40 extends ClientJDBCObjectFactoryImpl {
     
     /**
      * Sets SQLExceptionFactpry40  om SqlException to make sure jdbc40 
@@ -345,77 +336,4 @@ public class ClientJDBCObjectFactoryImpl
         return new NetDatabaseMetaData40((NetAgent)netAgent,
                 (NetConnection)netConnection);
     }
-    
-     /**
-     * This method provides an instance of Statement40 
-     * @param  agent      Agent
-     * @param  connection Connection
-     * @return a java.sql.Statement implementation 
-     * @throws SqlException
-     *
-     */
-     public Statement newStatement(Agent agent, org.apache.derby.client.am.Connection connection) 
-                                            throws SqlException {
-         return new Statement40(agent,connection);
-     }
-     
-     /**
-     * This method provides an instance of Statement40 
-     * @param  agent            Agent
-     * @param  connection       Connection
-     * @param  type             int
-     * @param  concurrency      int
-     * @param  holdability      int
-     * @param autoGeneratedKeys int
-     * @param columnNames       String[]
-     * @param columnIndexes     int[]
-     * @return a java.sql.Statement implementation 
-     * @throws SqlException
-     *
-     */
-     public Statement newStatement(Agent agent, 
-                     org.apache.derby.client.am.Connection connection, int type, 
-                     int concurrency, int holdability,
-                     int autoGeneratedKeys, String[] columnNames,
-                     int[] columnIndexes) 
-                     throws SqlException {
-         return new Statement40(agent,connection,type,concurrency,holdability,
-                 autoGeneratedKeys,columnNames, columnIndexes);
-     }
-     
-     /**
-     * Returns an instanceof ColumnMetaData 
-     *
-     * @param logWriter LogWriter
-     * @return a ColumnMetaData implementation
-     *
-     */
-    public ColumnMetaData newColumnMetaData(LogWriter logWriter) {
-        return new ColumnMetaData40(logWriter);
-    }
-
-    /**
-     * Returns an instanceof ColumnMetaData or ColumnMetaData40 depending 
-     * on the jdk version under use
-     *
-     * @param logWriter  LogWriter
-     * @param upperBound int
-     * @return a ColumnMetaData implementation
-     *
-     */
-    public ColumnMetaData newColumnMetaData(LogWriter logWriter, int upperBound) {
-        return new ColumnMetaData40(logWriter,upperBound);
-    }
-    
-    /**
-     * 
-     * returns an instance of ParameterMetaData40 
-     *
-     * @param columnMetaData ColumnMetaData
-     * @return a ParameterMetaData implementation
-     *
-     */
-    public ParameterMetaData newParameterMetaData(ColumnMetaData columnMetaData) {
-        return new ParameterMetaData40(columnMetaData);
-    }
 }

Modified: db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource.java?rev=1364042&r1=1364041&r2=1364042&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource.java Sat Jul 21 08:20:50 2012
@@ -37,11 +37,11 @@ import org.apache.derby.shared.common.re
  * will typically be registered with a naming service that is based on the
  * Java Naming and Directory Interface (JNDI). Use
  * ClientConnectionPoolDataSource if your application runs under
- * JDBC3.0 or JDBC2.0, that is, on the following Java Virtual Machines:
+ * JDBC 3.0 or JDBC 4.0, that is, on the following Java Virtual Machines:
  * <p/>
  * <UL>
- * <LI> JDBC 3.0 - Java 2 - JDK 1.4, J2SE 5.0
- * <LI> JDBC 2.0 - Java 2 - JDK 1.2,1.3
+ * <LI> JDBC 4.0 - Java SE 6
+ * <LI> JDBC 3.0 - J2SE 5.0
  * </UL>
  */
 public class ClientConnectionPoolDataSource extends ClientDataSource 

Modified: db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource40.java?rev=1364042&r1=1364041&r2=1364042&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource40.java Sat Jul 21 08:20:50 2012
@@ -21,10 +21,8 @@
 
 package org.apache.derby.jdbc;
 
-import java.sql.SQLException;
 import java.sql.SQLFeatureNotSupportedException;
 import java.util.logging.Logger;
-import javax.sql.DataSource;
 import org.apache.derby.client.am.ClientMessageId;
 import org.apache.derby.client.am.SqlException;
 import org.apache.derby.shared.common.reference.SQLState;
@@ -34,51 +32,17 @@ import org.apache.derby.shared.common.re
  * An object that implements this interface
  * will typically be registered with a naming service that is based on the
  * Java Naming and Directory Interface (JNDI). Use this factory
- * if your application runs at JDBC level 4.0 (or higher).
- * Use
+ * if your application runs at JDBC level 4.1 (or higher). Use
  * ClientConnectionPoolDataSource, instead, if your application runs under
- * JDBC3.0 or JDBC2.0, that is, on the following Java Virtual Machines:
+ * JDBC 4.0 or JDBC 3.0, that is, on the following Java Virtual Machines:
  * <p/>
  * <UL>
- * <LI> JDBC 3.0 - Java 2 - JDK 1.4, J2SE 5.0
- * <LI> JDBC 2.0 - Java 2 - JDK 1.2,1.3
+ * <LI> JDBC 4.0 - Java SE 6
+ * <LI> JDBC 3.0 - J2SE 5.0
  * </UL>
  */
 public class ClientConnectionPoolDataSource40
         extends ClientConnectionPoolDataSource {
-    /**
-     * Returns false unless <code>interfaces</code> is implemented 
-     * 
-     * @param  interfaces             a Class defining an interface.
-     * @return true                   if this implements the interface or 
-     *                                directly or indirectly wraps an object 
-     *                                that does.
-     * @throws java.sql.SQLException  if an error occurs while determining 
-     *                                whether this is a wrapper for an object 
-     *                                with the given interface.
-     */
-    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
-        return interfaces.isInstance(this);
-    }
-    
-    /**
-     * Returns <code>this</code> if this class implements the interface
-     *
-     * @param  interfaces a Class defining an interface
-     * @return an object that implements the interface
-     * @throws java.sql.SQLExption if no object if found that implements the 
-     * interface
-     */
-    public <T> T unwrap(java.lang.Class<T> interfaces)
-                                   throws SQLException {
-        try { 
-            return interfaces.cast(this);
-        } catch (ClassCastException cce) {
-            throw new SqlException(null,new ClientMessageId(
-                    SQLState.UNABLE_TO_UNWRAP), interfaces).getSQLException();
-        }
-    }    
-
     ////////////////////////////////////////////////////////////////////
     //
     // INTRODUCED BY JDBC 4.1 IN JAVA 7

Modified: db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource.java?rev=1364042&r1=1364041&r2=1364042&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource.java Sat Jul 21 08:20:50 2012
@@ -24,10 +24,11 @@ package org.apache.derby.jdbc;
 import java.sql.Connection;
 import java.sql.SQLException;
 import javax.sql.DataSource;
-
+import org.apache.derby.client.am.ClientMessageId;
 import org.apache.derby.client.am.LogWriter;
 import org.apache.derby.client.am.SqlException;
 import org.apache.derby.client.net.NetLogWriter;
+import org.apache.derby.shared.common.reference.SQLState;
 
 /**
  * ClientDataSource is a simple data source implementation
@@ -36,11 +37,11 @@ import org.apache.derby.client.net.NetLo
  * The class ClientConnectionPoolDataSource can be used in a connection pooling environment,
  * and the class ClientXADataSource can be used in a distributed, and pooling
  * environment. Use these DataSources if your application runs under
- * JDBC3.0 or JDBC2.0, that is, on the following Java Virtual Machines:
+ * JDBC 3.0 or JDBC 4.0, that is, on the following Java Virtual Machines:
  * <p/>
  * <UL>
- * <LI> JDBC 3.0 - Java 2 - JDK 1.4, J2SE 5.0
- * <LI> JDBC 2.0 - Java 2 - JDK 1.2,1.3
+ * <LI> JDBC 4.0 - Java SE 6
+ * <LI> JDBC 3.0 - J2SE 5.0
  * </UL>
  *
  * <p>The example below registers a DNC data source object with a JNDI naming service.
@@ -214,5 +215,40 @@ public class ClientDataSource extends Cl
                 (NetLogWriter)dncLogWriter, user, password, this, -1, false);
 
     }
+
+    // JDBC 4.0 java.sql.Wrapper interface methods
+
+    /**
+     * Check whether this instance wraps an object that implements the interface
+     * specified by {@code iface}.
+     *
+     * @param iface a class defining an interface
+     * @return {@code true} if this instance implements {@code iface}, or
+     * {@code false} otherwise
+     * @throws SQLException if an error occurs while determining if this
+     * instance implements {@code iface}
+     */
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        return iface.isInstance(this);
+    }
+
+    /**
+     * Returns {@code this} if this class implements the specified interface.
+     *
+     * @param  iface a class defining an interface
+     * @return an object that implements the interface
+     * @throws SQLException if no object is found that implements the
+     * interface
+     */
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        try {
+            return iface.cast(this);
+        } catch (ClassCastException cce) {
+            throw new SqlException(null,
+                    new ClientMessageId(SQLState.UNABLE_TO_UNWRAP),
+                    iface).getSQLException();
+        }
+    }
+
 }
 

Modified: db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource40.java?rev=1364042&r1=1364041&r2=1364042&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource40.java Sat Jul 21 08:20:50 2012
@@ -21,10 +21,8 @@
 
 package org.apache.derby.jdbc;
 
-import java.sql.SQLException;
 import java.sql.SQLFeatureNotSupportedException;
 import java.util.logging.Logger;
-import javax.sql.DataSource;
 import org.apache.derby.client.am.ClientMessageId;
 import org.apache.derby.client.am.SqlException;
 import org.apache.derby.shared.common.reference.SQLState;
@@ -36,13 +34,13 @@ import org.apache.derby.shared.common.re
  * The class ClientConnectionPoolDataSource40 can be used in a connection pooling environment,
  * and the class ClientXADataSource40 can be used in a distributed, and pooling
  * environment. Use these DataSources if your application runs at
- * JDBC level 4.0 (or higher). Use the corresponding ClientDataSource, ClientConnectionPoolDataSource, and
- * ClientXADataSource classes if 
+ * JDBC level 4.1 (or higher). Use the corresponding ClientDataSource,
+ * ClientConnectionPoolDataSource, and ClientXADataSource classes if
  * your application runs in the following environments:
  * <p/>
  *	<UL>
- *	<LI> JDBC 3.0 - Java 2 - JDK 1.4, J2SE 5.0
- *	<LI> JDBC 2.0 - Java 2 - JDK 1.2,1.3
+ *	<LI> JDBC 4.0 - Java SE 6
+ *	<LI> JDBC 3.0 - J2SE 5.0
  * </UL>
  *
  * <p>The example below registers a DNC data source object with a JNDI naming service.
@@ -108,39 +106,6 @@ public class ClientDataSource40 extends 
         super();
     }   
     
-    /**
-     * Returns false unless <code>interfaces</code> is implemented 
-     * 
-     * @param  interfaces             a Class defining an interface.
-     * @return true                   if this implements the interface or 
-     *                                directly or indirectly wraps an object 
-     *                                that does.
-     * @throws java.sql.SQLException  if an error occurs while determining 
-     *                                whether this is a wrapper for an object 
-     *                                with the given interface.
-     */
-    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
-        return interfaces.isInstance(this);
-    }
-    
-    /**
-     * Returns <code>this</code> if this class implements the interface
-     *
-     * @param  interfaces a Class defining an interface
-     * @return an object that implements the interface
-     * @throws java.sql.SQLExption if no object if found that implements the 
-     * interface
-     */
-    public <T> T unwrap(java.lang.Class<T> interfaces)
-                                   throws SQLException {
-        try { 
-            return interfaces.cast(this);
-        } catch (ClassCastException cce) {
-            throw new SqlException(null,new ClientMessageId(SQLState.UNABLE_TO_UNWRAP),
-                    interfaces).getSQLException();
-        }
-    }
-
     ////////////////////////////////////////////////////////////////////
     //
     // INTRODUCED BY JDBC 4.1 IN JAVA 7

Modified: db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource.java?rev=1364042&r1=1364041&r2=1364042&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource.java Sat Jul 21 08:20:50 2012
@@ -24,15 +24,13 @@ package org.apache.derby.jdbc;
 import java.sql.SQLException;
 import javax.sql.XAConnection;
 import javax.sql.XADataSource;
-
-import org.apache.derby.client.net.NetLogWriter;
 import org.apache.derby.client.am.LogWriter;
 import org.apache.derby.client.am.SqlException;
-
+import org.apache.derby.client.net.NetLogWriter;
 
 /**
  * <p>
- * This is Derby's network XADataSource for use with JDBC3.0 and JDBC2.0.
+ * This is Derby's network XADataSource for use with JDBC 3.0 and JDBC 4.0.
  * </p>
  * An XADataSource is a factory for XAConnection objects.  It represents a
  * RM in a DTP environment.  An object that implements the XADataSource
@@ -41,8 +39,8 @@ import org.apache.derby.client.am.SqlExc
  * ClientXADataSource automatically supports the correct JDBC specification version
  * for the Java Virtual Machine's environment.
  * <UL>
- * <LI> JDBC 3.0 - Java 2 - JDK 1.4, J2SE 5.0
- * <LI> JDBC 2.0 - Java 2 - JDK 1.2,1.3
+ * <LI> JDBC 4.0 - Java SE 6
+ * <LI> JDBC 3.0 - J2SE 5.0
  * </UL>
  *
  * <P>ClientXADataSource is serializable and referenceable.</p>

Modified: db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource40.java?rev=1364042&r1=1364041&r2=1364042&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource40.java Sat Jul 21 08:20:50 2012
@@ -21,31 +21,26 @@
 
 package org.apache.derby.jdbc;
 
-import java.sql.SQLException;
 import java.sql.SQLFeatureNotSupportedException;
 import java.util.logging.Logger;
-import javax.sql.DataSource;
-import javax.sql.XAConnection;
-import org.apache.derby.client.ClientXAConnection40;
 import org.apache.derby.client.am.ClientMessageId;
 import org.apache.derby.client.am.SqlException;
-import org.apache.derby.client.net.NetLogWriter;
 import org.apache.derby.shared.common.reference.SQLState;
 
 /**
  * <p>
- * This is Derby's network XADataSource for use with JDBC4.0.
+ * This is Derby's network XADataSource for use with JDBC 4.1.
  * </p>
  * An XADataSource is a factory for XAConnection objects.  It represents a
  * RM in a DTP environment.  An object that implements the XADataSource
  * interface is typically registered with a JNDI service provider.   	
  * <P>
- * Use ClientXADataSource40 if your application runs at JDBC level 4.0 (or higher).
- * Use ClientXADataSource
+ * Use ClientXADataSource40 if your application runs at JDBC level 4.1 (or
+ * higher). Use ClientXADataSource
  * if your application runs in the following environments:
  * <UL>
- * <LI> JDBC 3.0 - Java 2 - JDK 1.4, J2SE 5.0
- * <LI> JDBC 2.0 - Java 2 - JDK 1.2,1.3
+ * <LI> JDBC 4.0 - Java SE 6
+ * <LI> JDBC 3.0 - J2SE 5.0
  * </UL>
  *
  * <P>ClientXADataSource40 is serializable and referenceable.</p>
@@ -53,39 +48,6 @@ import org.apache.derby.shared.common.re
  * <P>See ClientDataSource40 for DataSource properties.</p>
  */
 public class ClientXADataSource40 extends ClientXADataSource {
-    
-	/**
-     * Returns false unless <code>interfaces</code> is implemented 
-     * 
-     * @param  interfaces             a Class defining an interface.
-     * @return true                   if this implements the interface or 
-     *                                directly or indirectly wraps an object 
-     *                                that does.
-     * @throws java.sql.SQLException  if an error occurs while determining 
-     *                                whether this is a wrapper for an object 
-     *                                with the given interface.
-     */
-    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
-        return interfaces.isInstance(this);
-    }
-    
-    /**
-     * Returns <code>this</code> if this class implements the interface
-     *
-     * @param  interfaces a Class defining an interface
-     * @return an object that implements the interface
-     * @throws java.sql.SQLExption if no object if found that implements the 
-     * interface
-     */
-    public <T> T unwrap(java.lang.Class<T> interfaces)
-                                   throws SQLException {
-        try { 
-            return interfaces.cast(this);
-        } catch (ClassCastException cce) {
-            throw new SqlException(null,new ClientMessageId(
-                    SQLState.UNABLE_TO_UNWRAP), interfaces).getSQLException();
-        }
-    }
 
     ////////////////////////////////////////////////////////////////////
     //

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/JDBC4FromJDBC3DataSourceTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/JDBC4FromJDBC3DataSourceTest.java?rev=1364042&r1=1364041&r2=1364042&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/JDBC4FromJDBC3DataSourceTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/JDBC4FromJDBC3DataSourceTest.java Sat Jul 21 08:20:50 2012
@@ -41,9 +41,22 @@ import javax.sql.StatementEventListener;
 import javax.sql.XADataSource;
 
 /**
+ * <p>
  * This test ensures that when a JDBC 4 application instantiates a JDBC 3
  * data source, that data source will return JDBC 4 connections even though
  * the data source itself is not a JDBC 4 object.
+ * </p>
+ *
+ * <p>
+ * Note that after DERBY-5868, all the data sources on the client implement
+ * all JDBC 4.0 methods. On embedded, the JDBC 3 variants of the data sources
+ * still don't implement the full JDBC 4.0 interface.
+ * </p>
+ *
+ * <p>
+ * Neither the client nor the embedded variants of the JDBC 3 data sources
+ * implement the full JDBC 4.1 interface.
+ * </p>
  */
 public class JDBC4FromJDBC3DataSourceTest extends BaseJDBCTestCase {
     
@@ -105,6 +118,14 @@ public class JDBC4FromJDBC3DataSourceTes
     private void assertNonJDBC4DataSource(DataSource ds)
         throws SQLException
     {
+        // After DERBY-5868, however, all the data sources on the client
+        // driver implement the JDBC 4.0 interface, so expect this check
+        // to pass.
+        if (usingDerbyNetClient()) {
+            assertTrue(ds.isWrapperFor(DataSource.class));
+            return;
+        }
+
         /* Simplest way is to try to call a JDBC 4 interface method;
          * if it succeeds, then we must have a JDBC 4 data source
          * (which we don't want).



Mime
View raw message