db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r574917 - in /db/derby/code/branches/10.3/java: engine/org/apache/derby/impl/jdbc/EmbedConnection.java testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DboPowersTest.java
Date Wed, 12 Sep 2007 12:35:23 GMT
Author: dag
Date: Wed Sep 12 05:35:22 2007
New Revision: 574917

URL: http://svn.apache.org/viewvc?rev=574917&view=rev
Log:
DERBY-3038 SYSCS_IMPORT_TABLE FAILS with No current connection after shutdown/reconnect to
encrypted database : 10.3.1.4 regression

Patch DERBY-3038-2 merged from trunk as:

svn merge -r 574732:574733 https://svn.apache.org/repos/asf/db/derby/code/trunk/

All regression tests passed.

Modified:
    db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DboPowersTest.java

Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java?rev=574917&r1=574916&r2=574917&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
(original)
+++ db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
Wed Sep 12 05:35:22 2007
@@ -326,6 +326,7 @@
 				tr = new TransactionResourceImpl(driver, url, info);
 				active = true;
 				setupContextStack();
+				context = pushConnectionContext(tr.getContextManager());
 
 				if (!bootDatabase(info, false))
 				{

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DboPowersTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DboPowersTest.java?rev=574917&r1=574916&r2=574917&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DboPowersTest.java
(original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DboPowersTest.java
Wed Sep 12 05:35:22 2007
@@ -22,6 +22,7 @@
 package org.apache.derbyTesting.functionTests.tests.jdbcapi;
 
 import java.sql.SQLException;
+import java.sql.Connection;
 import javax.sql.DataSource;
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -445,8 +446,9 @@
         JDBCDataSource.setBeanProperty(ds, "user", user);
         JDBCDataSource.setBeanProperty(ds, "password", password);
 
+        Connection con = null;
         try {
-            ds.getConnection();
+            con = ds.getConnection();
             vetEncryptionAttempt(user, null);
         } catch (SQLException e) {
             vetEncryptionAttempt(user, e);
@@ -454,6 +456,12 @@
             return;
         }
 
+        try {
+            derby3038(con);
+        } catch (SQLException e) {
+            fail("derby3038 regression: " + e);
+        } 
+
         // we managed to encrypt: bring db down and up again to verify
         bringDbDown();
         bringDbUp(bootPassword);
@@ -752,5 +760,36 @@
             fail("test error: invalid authLevel: " + _authLevel);
             break;
         }
+    }
+
+
+    /**
+     * Make and call a stored procedure which opens a nested
+     * connection to expose DERBY-3038.
+     */
+    private void derby3038(Connection con) throws SQLException {
+
+        java.sql.Statement s = con.createStatement();
+
+        try {
+            s.executeUpdate
+                ("CREATE PROCEDURE DERBY3038PROC () " + 
+                 "LANGUAGE JAVA PARAMETER STYLE JAVA EXTERNAL NAME '" +
+                 DboPowersTest.class.getName() + ".derby3038Proc' " + 
+                 "READS SQL DATA");
+            s.executeUpdate("CALL DERBY3038PROC()");
+        } finally {
+            s.close();
+        }
+    }
+
+
+    public static void derby3038Proc() 
+        throws SQLException {
+
+        // Before fixing DERNY-3038 this connect would fail.
+        Connection con = java.sql.DriverManager.
+            getConnection("jdbc:default:connection");
+        con.close();
     }
 }



Mime
View raw message