void ConnectToAS400() {
String IPAS400 = "172.20.15.5";
String Id = "yourid";
String Pw = "yourpw";
this.myLog.info("Connessione ad AS400");
try {
DriverManager.registerDriver(new AS400JDBCDriver());
} catch (SQLException e) {
e.printStackTrace();
}
String name = "jdbc:as400://" + IPAS400;
try {
this.connection = DriverManager.getConnection(name, Id, Pw);
} catch (SQLException e) {
e.printStackTrace();
this.myLog.errorException(e);
}
}
public void closeAS400Connection() {
try {
this.connection.close();
this.myLog.info("Disconnessione da AS400");
} catch (SQLException e) {
e.printStackTrace();
this.myLog.errorException(e);
}
}
*******ALTERNATIVA*********
public Connection connectToAS400() {
Connection connection = null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException e) {e.printStackTrace();}
String url = "jdbc:odbc:DRIVER={Client Access ODBC Driver (32-bit)};SYSTEM=172.20.15.5;USERID=yourid;PWD=yourpw";
try {
connection = DriverManager.getConnection(url);
} catch (SQLException e) {e.printStackTrace();
}
return connection;
}