*) better error message if jdbc driver could not be loaded

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2229 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 19 years ago
parent 07aa779e6d
commit f55d3d0d79

@ -333,23 +333,26 @@ final class dbTable implements kelondroIndex {
}
private void openDatabaseConnection(String dbType) throws Exception{
try {
if (dbType == null) throw new IllegalArgumentException();
String dbDriverStr = null, dbConnStr = null;
if (dbType.equalsIgnoreCase("mysql")) {
dbDriverStr = db_driver_str_mysql;
dbConnStr = db_conn_str_mysql;
} else if (dbType.equalsIgnoreCase("pgsql")) {
dbDriverStr = db_driver_str_pgsql;
dbConnStr = db_conn_str_pgsql;
}
if (dbType == null) throw new IllegalArgumentException();
String dbDriverStr = null, dbConnStr = null;
if (dbType.equalsIgnoreCase("mysql")) {
dbDriverStr = db_driver_str_mysql;
dbConnStr = db_conn_str_mysql;
} else if (dbType.equalsIgnoreCase("pgsql")) {
dbDriverStr = db_driver_str_pgsql;
dbConnStr = db_conn_str_pgsql;
}
try {
Class.forName(dbDriverStr).newInstance();
} catch (Exception e) {
throw new Exception ("Unable to load the jdbc driver: " + e.getMessage(),e);
}
try {
this.theDBConnection = DriverManager.getConnection (dbConnStr,this.db_usr_str,this.db_pwd_str);
} catch (Exception e) {
throw new Exception ("Unable to establish a database connection.");
throw new Exception ("Unable to establish a database connection: " + e.getMessage(),e);
}
}

Loading…
Cancel
Save