db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1482405 [2/2] - in /db/derby/code/trunk: java/client/ java/client/org/apache/derby/client/ java/client/org/apache/derby/client/am/ java/client/org/apache/derby/client/net/ java/client/org/apache/derby/jdbc/ java/testing/org/apache/derbyTes...
Date Tue, 14 May 2013 15:40:25 GMT
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java?rev=1482405&r1=1482404&r2=1482405&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java Tue May
14 15:40:24 2013
@@ -25,6 +25,14 @@ import java.io.OutputStream;
 import java.net.SocketTimeoutException;
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
+import java.sql.Array;
+import java.sql.NClob;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLClientInfoException;
+import java.sql.SQLException;
+import java.sql.SQLXML;
+import java.sql.Struct;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Properties;
@@ -45,7 +53,9 @@ import org.apache.derby.jdbc.ClientDrive
 import org.apache.derby.client.ClientPooledConnection;
 import org.apache.derby.client.am.Agent;
 import org.apache.derby.client.am.ClientConnection;
+import org.apache.derby.client.am.FailedProperties40;
 import org.apache.derby.client.am.LogWriter;
+import org.apache.derby.client.am.SQLExceptionFactory;
 import org.apache.derby.client.am.Section;
 import org.apache.derby.client.am.SectionManager;
 import org.apache.derby.jdbc.ClientDataSourceInterface;
@@ -169,6 +179,13 @@ public class NetConnection extends Clien
     private List<Xid> indoubtTransactions_ = null;
     protected int currXACallInfoOffset_ = 0;
 
+    /**
+     * Prepared statement that is used each time isValid() is called on this
+     * connection. The statement is created the first time isValid is called
+     * and closed when the connection is closed (by the close call).
+     */
+    private PreparedStatement isValidStmt;
+
     //---------------------constructors/finalizer---------------------------------
 
     NetConnection(NetLogWriter netLogWriter,
@@ -1759,5 +1776,249 @@ public class NetConnection extends Clien
             throws SqlException {
         xares_.netXAConn_.writeTransactionStart(statement);
     }
-}
 
+    // JDBC 4.0 methods
+
+    public Array createArrayOf(String typeName, Object[] elements)
+        throws SQLException {
+        throw SQLExceptionFactory.notImplemented ("createArrayOf(String,Object[])");
+    }
+
+    public NClob createNClob() throws SQLException {
+        throw SQLExceptionFactory.notImplemented ("createNClob ()");
+    }
+
+    public SQLXML createSQLXML() throws SQLException {
+        throw SQLExceptionFactory.notImplemented ("createSQLXML ()");
+    }
+
+    public Struct createStruct(String typeName, Object[] attributes)
+        throws SQLException {
+        throw SQLExceptionFactory.notImplemented ("createStruct(String,Object[])");
+    }
+
+    /**
+     * Checks if the connection has not been closed and is still valid.
+     * The validity is checked by running a simple query against the
+     * database.
+     *
+     * The timeout specified by the caller is implemented as follows:
+     * On the server: uses the queryTimeout functionality to make the
+     * query time out on the server in case the server has problems or
+     * is highly loaded.
+     * On the client: uses a timeout on the socket to make sure that
+     * the client is not blocked forever in the cases where the server
+     * is "hanging" or not sending the reply.
+     *
+     * @param timeout The time in seconds to wait for the database
+     * operation used to validate the connection to complete. If the
+     * timeout period expires before the operation completes, this
+     * method returns false. A value of 0 indicates a timeout is not
+     * applied to the database operation.
+     * @return true if the connection is valid, false otherwise
+     * @exception SQLException if the parameter value is illegal or if a
+     * database error has occurred
+     */
+    public boolean isValid(int timeout) throws SQLException {
+        // Validate that the timeout has a legal value
+        if (timeout < 0) {
+            throw new SqlException(agent_.logWriter_,
+                               new ClientMessageId(SQLState.INVALID_API_PARAMETER),
+                               timeout, "timeout",
+                               "java.sql.Connection.isValid" ).getSQLException();
+        }
+
+        // Check if the connection is closed
+        if (isClosed()) {
+            return false;
+        }
+
+        // Do a simple query against the database
+        synchronized(this) {
+            try {
+                // Save the current network timeout value
+                int oldTimeout = netAgent_.getTimeout();
+
+                // Set the required timeout value on the network connection
+                netAgent_.setTimeout(timeout);
+
+                // If this is the first time this method is called on this
+                // connection we prepare the query
+                if (isValidStmt == null) {
+                    isValidStmt = prepareStatement("VALUES (1)");
+                }
+
+                // Set the query timeout
+                isValidStmt.setQueryTimeout(timeout);
+
+                // Run the query against the database
+                ResultSet rs = isValidStmt.executeQuery();
+                rs.close();
+
+                // Restore the previous timeout value
+                netAgent_.setTimeout(oldTimeout);
+            } catch(SQLException e) {
+                // If an SQL exception is thrown the connection is not valid,
+                // we ignore the exception and return false.
+                return false;
+            }
+     }
+
+        return true;  // The connection is valid
+    }
+
+    /**
+     * Close the connection and release its resources.
+     * @exception SQLException if a database-access error occurs.
+     */
+    synchronized public void close() throws SQLException {
+        // Release resources owned by the prepared statement used by isValid
+        if (isValidStmt != null) {
+            isValidStmt.close();
+            isValidStmt = null;
+        }
+        super.close();
+    }
+
+    /**
+     * <code>setClientInfo</code> will always throw a
+     * <code>SQLClientInfoException</code> since Derby does not support
+     * any properties.
+     *
+     * @param name a property key <code>String</code>
+     * @param value a property value <code>String</code>
+     * @exception SQLException always.
+     */
+    public void setClientInfo(String name, String value)
+    throws SQLClientInfoException{
+        Properties p = FailedProperties40.makeProperties(name,value);
+    try { checkForClosedConnection(); }
+    catch (SqlException se) {
+            throw new SQLClientInfoException
+                (se.getMessage(), se.getSQLState(),
+                        se.getErrorCode(),
+                        new FailedProperties40(p).getProperties());
+        }
+
+        if (name == null && value == null) {
+            return;
+        }
+        setClientInfo(p);
+    }
+
+    /**
+     * <code>setClientInfo</code> will throw a
+     * <code>SQLClientInfoException</code> unless the <code>properties</code>
+     * parameter is empty, since Derby does not support any
+     * properties. All the property keys in the
+     * <code>properties</code> parameter are added to failedProperties
+     * of the exception thrown, with REASON_UNKNOWN_PROPERTY as the
+     * value.
+     *
+     * @param properties a <code>Properties</code> object with the
+     * properties to set.
+     * @exception SQLClientInfoException unless the properties
+     * parameter is null or empty.
+     */
+    public void setClientInfo(Properties properties)
+    throws SQLClientInfoException {
+    FailedProperties40 fp = new FailedProperties40(properties);
+    try { checkForClosedConnection(); }
+    catch (SqlException se) {
+        throw new SQLClientInfoException(se.getMessage(), se.getSQLState(),
+                se.getErrorCode(),
+                fp.getProperties());
+    }
+
+    if (properties == null || properties.isEmpty()) {
+            return;
+        }
+
+    SqlException se =
+        new SqlException(agent_.logWriter_,
+                 new ClientMessageId
+                 (SQLState.PROPERTY_UNSUPPORTED_CHANGE),
+                 fp.getFirstKey(), fp.getFirstValue());
+        throw new SQLClientInfoException(se.getMessage(),
+                se.getSQLState(),
+                se.getErrorCode(),
+                fp.getProperties());
+    }
+
+    /**
+     * <code>getClientInfo</code> always returns a
+     * <code>null String</code> since Derby doesn't support
+     * ClientInfoProperties.
+     *
+     * @param name a <code>String</code> value
+     * @return a <code>null String</code> value
+     * @exception SQLException if the connection is closed.
+     */
+    public String getClientInfo(String name)
+    throws SQLException{
+    try {
+        checkForClosedConnection();
+        return null;
+    }
+    catch (SqlException se) { throw se.getSQLException(); }
+    }
+
+    /**
+     * <code>getClientInfo</code> always returns an empty
+     * <code>Properties</code> object since Derby doesn't support
+     * ClientInfoProperties.
+     *
+     * @return an empty <code>Properties</code> object.
+     * @exception SQLException if the connection is closed.
+     */
+    public Properties getClientInfo()
+    throws SQLException{
+    try {
+        checkForClosedConnection();
+        return new Properties();
+    }
+    catch (SqlException se) { throw se.getSQLException(); }
+    }
+
+    /**
+     * 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 {
+        try {
+            checkForClosedConnection();
+        } catch (SqlException se) {
+            throw se.getSQLException();
+        }
+        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.SQLException if no object if found that implements the
+     * interface
+     */
+    public <T> T unwrap(Class<T> interfaces)
+                                   throws SQLException {
+        try {
+            checkForClosedConnection();
+            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/net/NetResultSet42.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet42.java?rev=1482405&r1=1482404&r2=1482405&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet42.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet42.java Tue May
14 15:40:24 2013
@@ -28,7 +28,7 @@ import org.apache.derby.client.am.SqlExc
 import org.apache.derby.client.am.Utils42;
 
 
-class NetResultSet42 extends NetResultSet40
+class NetResultSet42 extends NetResultSet
 {
     
     NetResultSet42(NetAgent netAgent,

Modified: db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDriver.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDriver.java?rev=1482405&r1=1482404&r2=1482405&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDriver.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDriver.java Tue May 14 15:40:24
2013
@@ -28,8 +28,10 @@ import java.sql.DriverPropertyInfo;
 import java.util.Enumeration;
 import java.util.Properties;
 import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
 import java.util.NoSuchElementException;
 import java.util.StringTokenizer;
+import java.util.logging.Logger;
 import org.apache.derby.client.am.Configuration;
 import org.apache.derby.client.am.SqlException;
 import org.apache.derby.client.am.Utils;
@@ -60,18 +62,7 @@ public class ClientDriver implements Dri
 
     static
     {
-        try {
-            //
-            // We'd rather load this slightly more capable driver.
-            // But if the vm level doesn't support it, then we fall
-            // back on the JDBC3 level driver.
-            //
-            Class.forName( "org.apache.derby.jdbc.ClientDriver40" );
-        }
-        catch (Throwable e)
-        {
-            registerMe( new ClientDriver() );
-        }
+        registerMe(new ClientDriver());
     }
 
     protected static void   registerMe( ClientDriver me )
@@ -295,6 +286,22 @@ public class ClientDriver implements Dri
         return Configuration.jdbcCompliant;
     }
 
+    ////////////////////////////////////////////////////////////////////
+    //
+    // INTRODUCED BY JDBC 4.1 IN JAVA 7
+    //
+    ////////////////////////////////////////////////////////////////////
+
+    public  Logger getParentLogger()
+        throws SQLFeatureNotSupportedException
+    {
+        getFactory();
+        throw (SQLFeatureNotSupportedException)
+            (
+             new SqlException( null, new ClientMessageId(SQLState.NOT_IMPLEMENTED), "getParentLogger"
)
+             ).getSQLException();
+    }
+
     // ----------------helper methods---------------------------------------------
 
     // Tokenize one of the following:
@@ -425,7 +432,7 @@ public class ClientDriver implements Dri
      *Currently it returns either
      *ClientJDBCObjectFactoryImpl
      *(or)
-     *ClientJDBCObjectFactoryImpl40
+     *ClientJDBCObjectFactoryImpl42
      */
     
     public static ClientJDBCObjectFactory getFactory() {
@@ -435,8 +442,6 @@ public class ClientDriver implements Dri
             return factoryObject;
         if (Configuration.supportsJDBC42()) {
             factoryObject = createJDBC42FactoryImpl();
-        } else if (Configuration.supportsJDBC40()) {
-            factoryObject = createJDBC40FactoryImpl();
         } else {
             factoryObject = createDefaultFactoryImpl();
         }
@@ -505,6 +510,3 @@ public class ClientDriver implements Dri
     }
 
 }
-
-
-

Modified: db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDriver40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDriver40.java?rev=1482405&r1=1482404&r2=1482405&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDriver40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDriver40.java Tue May 14 15:40:24
2013
@@ -21,38 +21,17 @@
 
 package org.apache.derby.jdbc;
 
-import java.sql.SQLFeatureNotSupportedException;
-import java.util.logging.Logger;
-
-import org.apache.derby.client.am.ClientMessageId;
-import org.apache.derby.client.am.SqlException;
-import org.apache.derby.shared.common.reference.SQLState;
-
 /**
  * <p>
  * Adds driver functionality which is only visible from JDBC 4.0 onward.
  * </p>
+ *
+ * <p>
+ * This class was part of Derby's public API up to Derby 10.10. Even though
+ * it doesn't provide any more functionality than {@code ClientDriver}, it
+ * is preserved for backward compatibility.
+ * </p>
  */
 public class ClientDriver40 extends ClientDriver
 {
-    static
-    {
-        registerMe( new ClientDriver40() );
-    }
-
-    ////////////////////////////////////////////////////////////////////
-    //
-    // INTRODUCED BY JDBC 4.1 IN JAVA 7
-    //
-    ////////////////////////////////////////////////////////////////////
-
-    public  Logger getParentLogger()
-        throws SQLFeatureNotSupportedException
-    {
-        getFactory();
-        throw (SQLFeatureNotSupportedException)
-            (
-             new SqlException( null, new ClientMessageId(SQLState.NOT_IMPLEMENTED), "getParentLogger"
)
-             ).getSQLException();
-    }
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/Wrapper41.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/Wrapper41.java?rev=1482405&r1=1482404&r2=1482405&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/Wrapper41.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/Wrapper41.java
Tue May 14 15:40:24 2013
@@ -22,13 +22,12 @@
 package org.apache.derbyTesting.functionTests.tests.jdbc4;
 
 import java.sql.SQLException;
-
-import org.apache.derby.impl.jdbc.EmbedResultSet40;
-import org.apache.derby.client.net.NetResultSet40;
-import org.apache.derby.impl.jdbc.EmbedCallableStatement40;
-import org.apache.derby.client.am.ClientCallableStatement40;
+import org.apache.derby.client.am.ClientCallableStatement;
+import org.apache.derby.client.am.ClientResultSet;
+import org.apache.derby.client.am.LogicalCallableStatement;
 import org.apache.derby.iapi.jdbc.BrokeredCallableStatement40;
-import org.apache.derby.client.am.LogicalCallableStatement40;
+import org.apache.derby.impl.jdbc.EmbedCallableStatement40;
+import org.apache.derby.impl.jdbc.EmbedResultSet40;
 
 /**
  * A wrapper around the getObject() overloads added by JDBC 4.1.
@@ -44,11 +43,11 @@ public  class   Wrapper41
     ///////////////////////////////////////////////////////////////////////
 
     private EmbedResultSet40    _embedded;
-    private NetResultSet40      _netclient;
+    private ClientResultSet      _netclient;
     private EmbedCallableStatement40 _embedCallableStatement;
-    private ClientCallableStatement40 _callableStatement;
+    private ClientCallableStatement _callableStatement;
     private BrokeredCallableStatement40 _brokeredCallableStatement;
-    private LogicalCallableStatement40 _logicalCallableStatement;
+    private LogicalCallableStatement _logicalCallableStatement;
     
     ///////////////////////////////////////////////////////////////////////
     //
@@ -61,9 +60,9 @@ public  class   Wrapper41
         if ( wrapped instanceof EmbedResultSet40 ) { _embedded = (EmbedResultSet40) wrapped;
}
         else if ( wrapped instanceof EmbedCallableStatement40 ) { _embedCallableStatement
= (EmbedCallableStatement40) wrapped; }
         else if ( wrapped instanceof BrokeredCallableStatement40 ) { _brokeredCallableStatement
= (BrokeredCallableStatement40) wrapped; }
-        else if ( wrapped instanceof NetResultSet40 ) { _netclient = (NetResultSet40) wrapped;
}
-        else if ( wrapped instanceof ClientCallableStatement40 ) { _callableStatement = (ClientCallableStatement40)
wrapped; }
-        else if ( wrapped instanceof LogicalCallableStatement40 ) { _logicalCallableStatement
= (LogicalCallableStatement40) wrapped; }
+        else if ( wrapped instanceof ClientResultSet ) { _netclient = (ClientResultSet) wrapped;
}
+        else if ( wrapped instanceof ClientCallableStatement ) { _callableStatement = (ClientCallableStatement)
wrapped; }
+        else if ( wrapped instanceof LogicalCallableStatement ) { _logicalCallableStatement
= (LogicalCallableStatement) wrapped; }
         else { throw nothingWrapped(); }
     }
     

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/Wrapper41Conn.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/Wrapper41Conn.java?rev=1482405&r1=1482404&r2=1482405&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/Wrapper41Conn.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/Wrapper41Conn.java
Tue May 14 15:40:24 2013
@@ -27,8 +27,8 @@ import java.util.concurrent.Executor;
 
 import org.apache.derby.impl.jdbc.EmbedConnection40;
 import org.apache.derby.iapi.jdbc.BrokeredConnection40;
-import org.apache.derby.client.net.NetConnection40;
-import org.apache.derby.client.am.LogicalConnection40;
+import org.apache.derby.client.am.LogicalConnection;
+import org.apache.derby.client.net.NetConnection;
 
 /**
  * A wrapper around the abort(Executor) method added by JDBC 4.1.
@@ -44,9 +44,9 @@ public  class   Wrapper41Conn
     ///////////////////////////////////////////////////////////////////////
 
     private EmbedConnection40    _embedded;
-    private NetConnection40      _netclient;
+    private NetConnection      _netclient;
     private BrokeredConnection40 _brokeredConnection;
-    private LogicalConnection40 _logicalConnection;
+    private LogicalConnection _logicalConnection;
     
     ///////////////////////////////////////////////////////////////////////
     //
@@ -58,8 +58,8 @@ public  class   Wrapper41Conn
     {
         if ( wrapped instanceof EmbedConnection40 ) { _embedded = (EmbedConnection40) wrapped;
}
         else if ( wrapped instanceof BrokeredConnection40 ) { _brokeredConnection = (BrokeredConnection40)
wrapped; }
-        else if ( wrapped instanceof NetConnection40 ) { _netclient = (NetConnection40) wrapped;
}
-        else if ( wrapped instanceof LogicalConnection40 ) { _logicalConnection = (LogicalConnection40)
wrapped; }
+        else if ( wrapped instanceof NetConnection) { _netclient = (NetConnection) wrapped;
}
+        else if ( wrapped instanceof LogicalConnection ) { _logicalConnection = (LogicalConnection)
wrapped; }
         else { throw nothingWrapped(); }
     }
     

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/Wrapper41Driver.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/Wrapper41Driver.java?rev=1482405&r1=1482404&r2=1482405&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/Wrapper41Driver.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/Wrapper41Driver.java
Tue May 14 15:40:24 2013
@@ -26,7 +26,7 @@ import java.sql.SQLException;
 import java.util.logging.Logger;
 
 import org.apache.derby.jdbc.AutoloadedDriver40;
-import org.apache.derby.jdbc.ClientDriver40;
+import org.apache.derby.jdbc.ClientDriver;
 import org.apache.derby.jdbc.Driver40;
 
 /**
@@ -44,7 +44,7 @@ public  class   Wrapper41Driver
 
     private AutoloadedDriver40    _embedded;
     private Driver40            _driver40;
-    private ClientDriver40      _netclient;
+    private ClientDriver      _netclient;
     
     ///////////////////////////////////////////////////////////////////////
     //
@@ -56,7 +56,7 @@ public  class   Wrapper41Driver
     {
         if ( wrapped instanceof AutoloadedDriver40 ) { _embedded = (AutoloadedDriver40) wrapped;
}
         else if ( wrapped instanceof Driver40 ) { _driver40 = (Driver40) wrapped; }
-        else if ( wrapped instanceof ClientDriver40 ) { _netclient = (ClientDriver40) wrapped;
}
+        else if ( wrapped instanceof ClientDriver ) { _netclient = (ClientDriver) wrapped;
}
         else { throw nothingWrapped( wrapped ); }
     }
     

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AutoloadTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AutoloadTest.java?rev=1482405&r1=1482404&r2=1482405&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AutoloadTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AutoloadTest.java
Tue May 14 15:40:24 2013
@@ -338,8 +338,7 @@ public class AutoloadTest extends BaseJD
     }
     private String  getClientDriverName()
     {
-        if ( JDBC.vmSupportsJDBC4() ) { return "org.apache.derby.jdbc.ClientDriver40"; }
-        else { return "org.apache.derby.jdbc.ClientDriver"; }
+        return "org.apache.derby.jdbc.ClientDriver";
     }
     
     /**

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DriverTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DriverTest.java?rev=1482405&r1=1482404&r2=1482405&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DriverTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DriverTest.java
Tue May 14 15:40:24 2013
@@ -223,7 +223,12 @@ public class DriverTest extends BaseJDBC
         // test that the driver is one of the special 40 versions if we are running
         // on Java 6 or higher
         println( "Driver is a " + driver.getClass().getName() );
-        assertEquals( JDBC.vmSupportsJDBC4(), driver.getClass().getName().endsWith( "40"
) );
+        if (usingEmbedded()) {
+            assertEquals( JDBC.vmSupportsJDBC4(), driver.getClass().getName().endsWith( "40"
) );
+        } else {
+            // The same client driver class is used regardless of JDBC version.
+            assertEquals("ClientDriver", driver.getClass().getSimpleName());
+        }
 
         // test that null connection URLs raise a SQLException per JDBC 4.2 spec clarification
         try {

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/StatementPoolingTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/StatementPoolingTest.java?rev=1482405&r1=1482404&r2=1482405&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/StatementPoolingTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/StatementPoolingTest.java
Tue May 14 15:40:24 2013
@@ -187,7 +187,7 @@ public class StatementPoolingTest
             {
                 expectedName += "42";
             }
-            else
+            else if (usingEmbedded())
             {
                 expectedName += "40";
             }

Modified: db/derby/code/trunk/tools/jar/dnc.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/tools/jar/dnc.properties?rev=1482405&r1=1482404&r2=1482405&view=diff
==============================================================================
--- db/derby/code/trunk/tools/jar/dnc.properties (original)
+++ db/derby/code/trunk/tools/jar/dnc.properties Tue May 14 15:40:24 2013
@@ -33,8 +33,4 @@ derby.module.client.xads=org.apache.derb
 derby.module.client.40xads=org.apache.derby.jdbc.ClientXADataSource40
 derby.module.client.40njxads=org.apache.derby.jdbc.BasicClientXADataSource40
 
-derby.module.client.40cp=org.apache.derby.client.ClientPooledConnection40
-derby.module.client.40nc=org.apache.derby.client.net.NetConnection40
-derby.module.client.40cjof=org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40
-
 derby.module.shared.threaddump=org.apache.derby.shared.common.sanity.ThreadDump



Mime
View raw message