use of com.ibm.db2.jcc.DB2XADataSource in project API by ca-cwds.
the class Db2XASample method buildDB2DataSource.
private static DB2XADataSource buildDB2DataSource(String user, String password, String serverName, int port, String databaseName) {
DB2XADataSource ds = new DB2XADataSource();
ds.setUser(user);
ds.setPassword(password);
ds.setServerName(serverName);
ds.setPortNumber(port);
ds.setDatabaseName(databaseName);
ds.setDriverType(4);
try {
ds.getProperties().setProperty(DB2XADataSource.propertyKey_serverName, serverName);
ds.getProperties().setProperty(DB2XADataSource.propertyKey_portNumber, String.valueOf(port));
ds.getProperties().setProperty(DB2XADataSource.propertyKey_databaseName, databaseName);
ds.getProperties().setProperty(DB2XADataSource.propertyKey_driverType, "4");
} catch (SQLException e) {
e.printStackTrace();
throw new ApiException("datasource property error", e);
}
return ds;
}
use of com.ibm.db2.jcc.DB2XADataSource in project API by ca-cwds.
the class XASample method buildDB2DataSource.
private static DB2XADataSource buildDB2DataSource(String user, String password, String serverName, int port, String databaseName) {
DB2XADataSource ds = new DB2XADataSource();
ds.setUser(user);
ds.setPassword(password);
ds.setServerName(serverName);
ds.setPortNumber(port);
ds.setDatabaseName(databaseName);
ds.setDriverType(4);
try {
ds.getProperties().setProperty(DB2XADataSource.propertyKey_serverName, serverName);
ds.getProperties().setProperty(DB2XADataSource.propertyKey_portNumber, String.valueOf(port));
ds.getProperties().setProperty(DB2XADataSource.propertyKey_databaseName, databaseName);
ds.getProperties().setProperty(DB2XADataSource.propertyKey_driverType, "4");
} catch (SQLException e) {
e.printStackTrace();
throw new ApiException("datasource property error", e);
}
return ds;
}
Aggregations