1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| private Connection getConnection(String host, String user, String password) throws Exception {
// Driver Teradata
driver = "com.teradata.jdbc.TeraDriver";
// URL de la connexion
url = "jdbc:teradata://"+host+"/database=WTR_1,tmode=ANSI,charset=UTF8";
try {
Class.forName(driver);
// On obtient la connexion
connection = DriverManager.getConnection(url, user, password);
logger.info("Connection obtenue");
// On retourne la connexion
return connection;
} catch (SQLException e) {
logger.warning("Incorrect Connection Data.");
throw new TechnicalException("No-Connexion-Established-003");
}
catch (ClassNotFoundException e) {
// logger).fatal("Inexistent or Incorrect Driver.");
throw new Exception("Driver-Not-Exist-004");
}
} |
Partager