use of net.idea.modbcum.c.MySQLSingleConnection in project ambit-mirror by ideaconsult.
the class Context method getConnection.
protected DBConnectionConfigurable<Context> getConnection(String configFile) throws SQLException, AmbitException {
try {
Context context = initContext();
String driver = context.get(Preferences.DRIVERNAME);
if ((driver != null) && (driver.contains("mysql")))
return new MySQLSingleConnection(context, configFile);
else
throw new AmbitException("Driver not supported");
} catch (Exception x) {
x.printStackTrace();
throw new AmbitException(x);
}
}
use of net.idea.modbcum.c.MySQLSingleConnection in project ambit-mirror by ideaconsult.
the class Context method getConnection.
protected DBConnectionConfigurable<Context> getConnection(String configFile) throws SQLException, AmbitException {
try {
Context context = initContext();
String driver = context.get(Preferences.DRIVERNAME);
if ((driver != null) && (driver.contains("mysql"))) {
MySQLSingleConnection<Context> mc = new MySQLSingleConnection<Context>(context, configFile) {
@Override
protected void configurefromContext(LoginInfo li, Context context) {
if (context.get(Preferences.DATABASE) != null)
li.setDatabase(context.get(Preferences.DATABASE));
if (context.get(Preferences.USER) != null)
li.setUser(context.get(Preferences.USER));
if (context.get(Preferences.PASSWORD) != null)
li.setPassword(context.get(Preferences.PASSWORD));
if (context.get(Preferences.HOST) != null)
li.setHostname(context.get(Preferences.HOST));
if (context.get(Preferences.PORT) != null)
li.setPort(context.get(Preferences.PORT));
if (context.get(Preferences.DRIVERNAME) != null)
li.setDriverClassName(context.get(Preferences.DRIVERNAME));
}
@Override
protected Logger getLogger() {
return logger_cli;
}
};
return mc;
} else
throw new AmbitException("Driver not supported");
} catch (AmbitException x) {
throw x;
} catch (Exception x) {
throw new AmbitException(x);
}
}
use of net.idea.modbcum.c.MySQLSingleConnection in project ambit-mirror by ideaconsult.
the class Context method getConnection.
protected DBConnectionConfigurable<Context> getConnection(File configFile) throws SQLException, AmbitException {
try {
Context context = initContext();
String driver = context.get(Preferences.DRIVERNAME);
if ((driver != null) && (driver.contains("mysql")))
return new MySQLSingleConnection(context, configFile);
else
throw new AmbitException("Driver not supported");
} catch (Exception x) {
x.printStackTrace();
throw new AmbitException(x);
}
}
Aggregations