use of com.twosigma.beakerx.sql.DBConnectionException in project beakerx by twosigma.
the class DbExplorerFactory method getDbInfo.
// private static final String VENDOR_JDBC_ORACLE = "jdbc:oracle:";
// private static final String VENDOR_JDBC_MSSQL = "jdbc:sqlserver:";
public static DbInfo getDbInfo(String txt, JDBCClient jdbcClient, String sessionId, ConnectionStringHolder defaultConnectionString, Map<String, ConnectionStringHolder> namedConnectionString) {
final NamespaceClient namespaceClient = NamespaceClient.getBeaker(sessionId);
final BeakerParser beakerParser;
try {
beakerParser = new BeakerParser(txt, namespaceClient, defaultConnectionString, namedConnectionString, jdbcClient);
final String uri = beakerParser.getDbURI().getActualConnectionString();
if (uri != null) {
final DataSource ds = jdbcClient.getDataSource(uri);
if (uri.startsWith(VENDOR_JDBC_MYSQL)) {
return new MysqlDbExplorer(ds);
}
}
} catch (IOException | DBConnectionException e) {
logger.error(e.getMessage());
}
return null;
}
Aggregations