db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r947214 - in /db/derby/code/branches/10.3: ./ java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java
Date Fri, 21 May 2010 23:48:16 GMT
Author: kmarsden
Date: Fri May 21 23:48:16 2010
New Revision: 947214

URL: http://svn.apache.org/viewvc?rev=947214&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

Port from trunk. Work around for DERBY-4668


Modified:
    db/derby/code/branches/10.3/   (props changed)
    db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java

Propchange: db/derby/code/branches/10.3/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri May 21 23:48:16 2010
@@ -1 +1 @@
-/db/derby/code/trunk:552046,788436,793588,794303,796316,796372,798347,798742,800523,803548,816536,882732
+/db/derby/code/trunk:552046,788436,793588,794303,796316,796372,798347,798742,800523,803548,816536,882732,946794

Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java?rev=947214&r1=947213&r2=947214&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java
(original)
+++ db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java
Fri May 21 23:48:16 2010
@@ -24,11 +24,13 @@ package org.apache.derby.impl.jdbc;
 import java.sql.Blob;
 import java.sql.Connection;
 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.SQLState;
+import org.apache.derby.jdbc.InternalDriver;
 
 /**
  * Contains the stored procedures that will be used in the
@@ -349,8 +351,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