日期:2014-05-20 浏览次数:20960 次
private static Connection getConnection(String paramString, Properties paramProperties, ClassLoader paramClassLoader)
throws SQLException
{
synchronized (DriverManager.class)
{
if (paramClassLoader == null)
paramClassLoader = Thread.currentThread().getContextClassLoader();
}
if (paramString == null)
throw new SQLException("The url cannot be null", "08001");
println("DriverManager.getConnection(\"" + paramString + "\")");
??? = null;
Iterator localIterator = registeredDrivers.iterator();
while (localIterator.hasNext())
{
DriverInfo localDriverInfo = (DriverInfo)localIterator.next();
if (isDriverAllowed(localDriverInfo.driver, paramClassLoader))
try
{
println(" trying " + localDriverInfo.driver.getClass().getName());
Connection localConnection = localDriverInfo.driver.connect(paramString, paramProperties);
if (localConnection != null)
{
println("getConnection returning " + localDriverInfo.driver.getClass().getName());
return localConnection;
}
}
catch (SQLException localSQLException)
{
if (??? == null)
??? = localSQLException;
}
else
println(" skipping: " + localDriverInfo.getClass().getName());
}
if (??? != null)
{
println("getConnection failed: " + ???);
throw ???;
}
println("getConnection: no suitable driver found for " + paramString);
throw new SQLException("No suitable driver found for " + paramString, "08001");
}