@Override public DataSource getDataSource() { DB2SimpleDataSource db2Datasource = new com.ibm.db2.jcc.DB2SimpleDataSource(); db2Datasource.setServerName(this.testProperties.getProperty("db2.servername")); db2Datasource.setPortNumber(Integer.parseInt(this.testProperties.getProperty("db2.port"))); db2Datasource.setDatabaseName(this.testProperties.getProperty("db2.db")); db2Datasource.setUser(this.testProperties.getProperty("db2.username")); db2Datasource.setPassword(this.testProperties.getProperty("db2.password")); return db2Datasource; }
public static DataSource getDS(KPIGenProperties p) throws SQLException, IOException { if ("DB2".equalsIgnoreCase(p.get("DB"))) { DB2SimpleDataSource ds = new DB2SimpleDataSource(); ds.setDriverType(4); ds.setLoginTimeout(5); // sec ds.setServerName(p.get("ServerName")); ds.setPortNumber(Integer.parseInt(p.get("PortNumber"))); ds.setDatabaseName(p.get("DatabaseName")); ds.setUser(p.get("User")); ds.setPassword(p.get("Password")); return ds; } else { OracleDataSource ds = new OracleDataSource(); ds.setDriverType("thin"); ds.setServerName(p.get("ServerName")); ds.setPortNumber(Integer.parseInt(p.get("PortNumber"))); ds.setDatabaseName(p.get("DatabaseName")); ds.setUser(p.get("User")); ds.setPassword(p.get("Password")); return ds; } }