db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r154375 - incubator/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java
Date Sat, 19 Feb 2005 00:52:03 GMT
Author: djd
Date: Fri Feb 18 16:52:02 2005
New Revision: 154375

URL: http://svn.apache.org/viewcvs?view=rev&rev=154375
Log:
Obtain connections in system procedures using InternalDriver and
not DriverManager, so that they can be called in JSR 169.

Modified:
    incubator/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java?view=diff&r1=154374&r2=154375
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java
Fri Feb 18 16:52:02 2005
@@ -26,7 +26,6 @@
 import org.apache.derby.iapi.error.PublicAPI;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.SQLState;
-import java.sql.DriverManager;
 import java.sql.ResultSet;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
@@ -35,9 +34,10 @@
 import java.util.StringTokenizer;
 import java.util.NoSuchElementException;
 
-
+import org.apache.derby.jdbc.InternalDriver;
 import org.apache.derby.iapi.db.Factory;
 import org.apache.derby.iapi.db.PropertyInfo;
+import org.apache.derby.impl.jdbc.Util;
 import org.apache.derby.impl.load.Export;
 import org.apache.derby.impl.load.Import;
 
@@ -138,9 +138,24 @@
 		}
 	}
 	
+	/**
+	 * Get the default or nested connection corresponding to the URL
+	 * jdbc:default:connection. We do not use DriverManager here
+	 * as it is not supported in JSR 169. IN addition we need to perform
+	 * more checks for null drivers or the driver returing null from connect
+	 * as that logic is in DriverManager.
+	 * @return The nested connection
+	 * @throws SQLException Not running in a SQL statement
+	 */
 	private static Connection getDefaultConn()throws SQLException
 	{
-		return DriverManager.getConnection("jdbc:default:connection");
+		InternalDriver id = InternalDriver.activeDriver();
+		if (id != null) { 
+			Connection conn = id.connect("jdbc:default:connection", null);
+			if (conn != null)
+				return conn;
+		}
+		throw Util.noCurrentConnection();
 	}
 
 	/**



Mime
View raw message