use of org.talend.core.model.metadata.builder.database.HotClassLoader in project tdq-studio-se by Talend.
the class ManagedDriver method instanceJdbcDriver.
/**
* create a new jdbc instance.
*
* @param dbType
* @param dbVersion
* @throws ClassNotFoundException
* @throws InstantiationException
* @throws IllegalAccessException
*/
private void instanceJdbcDriver(String dbType, String dbVersion) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
unregisterSQLDriver();
JDBCDriverLoader jdbcDriverClassLoader = new JDBCDriverLoader();
HotClassLoader hotClassLoader = jdbcDriverClassLoader.getHotClassLoader(jars.toArray(new String[jars.size()]), dbType, dbVersion);
Class<?> classDriver = Class.forName(driverClassName, true, hotClassLoader);
if (classDriver != null) {
jdbcDriver = (Driver) classDriver.newInstance();
}
}
use of org.talend.core.model.metadata.builder.database.HotClassLoader in project tdq-studio-se by Talend.
the class ManagedDriver method registerSQLDriver.
/**
* regist jdbc driver except Hive by HotClassLoader.
*
* @param dbConnection
* @return
* @throws ClassNotFoundException
* @throws IllegalAccessException
* @throws InstantiationException
* @deprecated using registerSQLDriver(DatabaseConnection dbConn) instead of.
*/
@Deprecated
public void registerSQLDriver(String dbType, String dbVersion) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
boolean isODBC = dbType.equalsIgnoreCase(EDatabaseTypeName.GODBC.getXmlName());
if (driverClassName != null && !dbType.equalsIgnoreCase(EDatabaseTypeName.HIVE.getXmlName()) && (isODBC || isValidatedJars())) {
unregisterSQLDriver();
JDBCDriverLoader jdbcDriverClassLoader = new JDBCDriverLoader();
HotClassLoader hotClassLoader = jdbcDriverClassLoader.getHotClassLoader(jars.toArray(new String[jars.size()]), dbType, dbVersion);
Class<?> classDriver = Class.forName(driverClassName, true, hotClassLoader);
if (classDriver != null) {
jdbcDriver = (Driver) classDriver.newInstance();
}
}
if (jdbcDriver == null) {
log.error("fail to regist jdbc driver in SQLExplorer");
}
}
Aggregations