db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r946794 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java
Date Thu, 20 May 2010 21:25:57 GMT
Author: kmarsden
Date: Thu May 20 21:25:56 2010
New Revision: 946794

URL: http://svn.apache.org/viewvc?rev=946794&view=rev
Log:
DERBY-4664 Change Derby internal stored procedures to avoid DriverManager.getConnection("jdbc:default:connection")
as it may be recognized by other Drivers

This fix is really a work around for  DERBY-4668 for internal procedures.


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java?rev=946794&r1=946793&r2=946794&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java Thu
May 20 21:25:56 2010
@@ -23,12 +23,14 @@ package org.apache.derby.impl.jdbc;
 
 import java.sql.Blob;
 import java.sql.Clob;
+import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
 
 import org.apache.derby.iapi.jdbc.EngineLOB;
 import org.apache.derby.iapi.reference.Limits;
 import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.jdbc.InternalDriver;
 
 /**
  * Contains the stored procedures that will be used in the
@@ -389,8 +391,16 @@ public class LOBStoredProcedure {
      * @throws SQLException.
      */
     private static EmbedConnection getEmbedConnection() throws SQLException {
-        return (EmbedConnection)DriverManager
-            .getConnection("jdbc:default:connection");
+        //DERBY-4664 Do not use DriverManager("jdbc:default:connection") because
+        // some other product's Driver might hijack our stored procedure.
+        InternalDriver id = InternalDriver.activeDriver();
+        if (id != null) { 
+            EmbedConnection conn = (EmbedConnection) id.connect("jdbc:default:connection",
null);
+            if (conn != null)
+                return conn;
+        }
+        throw Util.noCurrentConnection();
+        
     }
 
     /**



Mime
View raw message