You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by jo...@apache.org on 2002/09/06 09:19:54 UTC
cvs commit: xml-xalan/java/src/org/apache/xalan/lib/sql DefaultConnectionPool.java
johng 2002/09/06 00:19:53
Modified: java/src/org/apache/xalan/lib/sql DefaultConnectionPool.java
Log:
Fixed Class loader Problem. Default Connection now uses context Classloader
Revision Changes Path
1.11 +18 -1 xml-xalan/java/src/org/apache/xalan/lib/sql/DefaultConnectionPool.java
Index: DefaultConnectionPool.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/sql/DefaultConnectionPool.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- DefaultConnectionPool.java 7 Jun 2002 17:13:54 -0000 1.10
+++ DefaultConnectionPool.java 6 Sep 2002 07:19:53 -0000 1.11
@@ -59,6 +59,7 @@
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
+import java.sql.Driver;
import java.sql.SQLException;
import java.util.Enumeration;
import java.util.Properties;
@@ -74,6 +75,11 @@
public class DefaultConnectionPool implements ConnectionPool
{
/**
+ * A placeholder thast will keep the driver loaded
+ * between calls.
+ */
+ private Object m_Driver = null;
+ /**
*/
private static final boolean DEBUG = false;
@@ -470,12 +476,23 @@
try
{
- Class.forName( m_driver );
+// We need to implement the context classloader
+// Class.forName( m_driver );
+ Class cls = Thread.currentThread().getContextClassLoader().loadClass(m_driver);
+ // We have also had problems with drivers unloading
+ // load an instance that will get freed with the class.
+ m_Driver = cls.newInstance();
+
+
}
catch(ClassNotFoundException e)
{
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_DRIVER_NAME, null));
// "Invalid Driver Name Specified!");
+ }
+ catch(Exception e)
+ {
+ throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_DRIVER_NAME, null));
}
// IF we are not active, don't actuall build a pool yet
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org