db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r948206 - in /db/derby/code/branches/10.6: ./ java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java
Date Tue, 25 May 2010 21:06:34 GMT
Author: kmarsden
Date: Tue May 25 21:06:34 2010
New Revision: 948206

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

Propchange: db/derby/code/branches/10.6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 25 21:06:34 2010
@@ -1 +1 @@
-/db/derby/code/trunk:938547,938796,938959,939231,940462,940469,941627,942031,944152
+/db/derby/code/trunk:938547,938796,938959,939231,940462,940469,941627,942031,944152,946794

Modified: db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java?rev=948206&r1=948205&r2=948206&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java
(original)
+++ db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java
Tue May 25 21:06:34 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