db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r948244 - in /db/derby/code/branches/10.4: ./ java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java
Date Tue, 25 May 2010 23:03:56 GMT
Author: kmarsden
Date: Tue May 25 23:03:56 2010
New Revision: 948244

URL: http://svn.apache.org/viewvc?rev=948244&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.4/   (props changed)
    db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java

Propchange: db/derby/code/branches/10.4/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 25 23:03:56 2010
@@ -1,2 +1,2 @@
 /db/derby/code/branches/10.5:814216
-/db/derby/code/trunk:788436,793588,794303,796316,796372,797147,798347,798742,800523,803548,805696,809643,812669,816536,835286,882732,915733
+/db/derby/code/trunk:788436,793588,794303,796316,796372,797147,798347,798742,800523,803548,805696,809643,812669,816536,835286,882732,915733,946794

Modified: db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java?rev=948244&r1=948243&r2=948244&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java
(original)
+++ db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java
Tue May 25 23:03: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