View | Details | Raw Unified | Return to bug 53853
Collapse All | Expand All

(-)modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java (-6 / +14 lines)
Lines 242-258 Link Here
242
                if (log.isDebugEnabled()) {
242
                if (log.isDebugEnabled()) {
243
                    log.debug("Instantiating driver using class: "+poolProperties.getDriverClassName()+" [url="+poolProperties.getUrl()+"]");
243
                    log.debug("Instantiating driver using class: "+poolProperties.getDriverClassName()+" [url="+poolProperties.getUrl()+"]");
244
                }
244
                }
245
                driver = (java.sql.Driver) Class.forName(poolProperties.getDriverClassName(),
245
                
246
                                                         true, PooledConnection.class.getClassLoader()
246
                Class<?> clazz = null;
247
                                                         ).newInstance();
247
                try {
248
                    clazz = Class.forName(poolProperties.getDriverClassName());
249
                } catch (ClassNotFoundException e) {
250
                    ClassLoader tcl = Thread.currentThread().getContextClassLoader();
251
                    if (tcl == null) {
252
                        throw new Exception("No thread context ClassLoader set");
253
                    }
254
                    clazz = tcl.loadClass(poolProperties.getDriverClassName());
255
                }
256
                
257
                driver = (java.sql.Driver) clazz.newInstance();
248
            }
258
            }
249
        } catch (java.lang.Exception cn) {
259
        } catch (java.lang.Exception cn) {
250
            if (log.isDebugEnabled()) {
260
            if (log.isDebugEnabled()) {
251
                log.debug("Unable to instantiate JDBC driver.", cn);
261
                log.debug("Unable to instantiate JDBC driver.", cn);
252
            }
262
            }
253
            SQLException ex = new SQLException(cn.getMessage());
263
            throw new SQLException(cn.getMessage(), cn);
254
            ex.initCause(cn);
255
            throw ex;
256
        }
264
        }
257
        String driverURL = poolProperties.getUrl();
265
        String driverURL = poolProperties.getUrl();
258
        String usr = null;
266
        String usr = null;

Return to bug 53853