DebugFile.incIdent();
}
if (oConn!=null || isConnected()) {
if (DebugFile.trace) DebugFile.decIdent();
throw new MessagingException("DBStore is already connected");
}
String dburl = Environment.getProfileVar(host, "dburl");
String dbusr = Environment.getProfileVar(host, "dbuser");
String dbpwd = Environment.getProfileVar(host, "dbpassword");
String schema = Environment.getProfileVar(host, "schema", "");
try {
if (DebugFile.trace)
DebugFile.writeln("DriverManager.getConnection("+dburl+", "+dbusr+", ...)");
if (schema.length()>0)
oConn = new JDCConnection(DriverManager.getConnection(dburl, dbusr, dbpwd), null, schema);
else
oConn = new JDCConnection(DriverManager.getConnection(dburl, dbusr, dbpwd), null);
short iAuth = ACL.autenticate(oConn, user, password, ACL.PWD_CLEAR_TEXT);
if (iAuth<0) {
oConn.close();
oConn = null;
if (DebugFile.trace) DebugFile.decIdent();
throw new AuthenticationFailedException(ACL.getErrorMessage(iAuth) + " (" + user + ")");
}
else {
oUser = new ACLUser(oConn, user);
setConnected(true);
oConn.setAutoCommit(false);
}
}
catch (SQLException sqle) {
if (DebugFile.trace) DebugFile.decIdent();
throw new MessagingException(sqle.getMessage(), sqle);
}
if (DebugFile.trace) {
try { if (oConn!=null) DebugFile.writeln("Connection process id. is "+oConn.pid()); } catch (Exception ignore ) { }
DebugFile.decIdent();