use of lucee.commons.io.res.type.datasource.core.MSSQL in project Lucee by lucee.
the class DatasourceResourceProvider method getCore.
private Core getCore(ConnectionData data) throws PageException {
Core core = (Core) cores.get(data.datasourceName);
if (core == null) {
DatasourceConnection dc = getManager().getConnection(ThreadLocalPageContext.get(), data.getDatasourceName(), data.getUsername(), data.getPassword());
try {
dc.getConnection().setAutoCommit(false);
dc.getConnection().setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
if ("com.microsoft.jdbc.sqlserver.SQLServerDriver".equals(dc.getDatasource().getClassDefinition().getClassName()))
core = new MSSQL(dc, data.getPrefix());
else if ("com.microsoft.sqlserver.jdbc.SQLServerDriver".equals(dc.getDatasource().getClassDefinition().getClassName()))
core = new MSSQL(dc, data.getPrefix());
else if ("net.sourceforge.jtds.jdbc.Driver".equals(dc.getDatasource().getClassDefinition().getClassName()))
core = new MSSQL(dc, data.getPrefix());
else if ("org.gjt.mm.mysql.Driver".equals(dc.getDatasource().getClassDefinition().getClassName()))
core = new MySQL(dc, data.getPrefix());
else
throw new ApplicationException("there is no DatasourceResource driver for this database [" + data.getPrefix() + "]");
cores.put(data.datasourceName, core);
} catch (SQLException e) {
throw new DatabaseException(e, dc);
} finally {
release(dc);
// manager.releaseConnection(CONNECTION_ID,dc);
}
}
return core;
}
Aggregations