From 83cc7f27097f92d2c68abb42891ad62ade64adf5 Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Mon, 7 Jan 2008 07:18:13 +0000
Subject: [PATCH] Specify JDBC driver class by name and not by class in order
 to avoid adding all JDBC driver jars to the classpath

SVN: 3324
---
 .../dbmigration/DatabaseConfigurationContext.java    |  2 +-
 .../ch/systemsx/cisd/dbmigration/DatabaseEngine.java | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseConfigurationContext.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseConfigurationContext.java
index 30a1ebac52c..e8de544dc6a 100644
--- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseConfigurationContext.java
+++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseConfigurationContext.java
@@ -156,7 +156,7 @@ public class DatabaseConfigurationContext implements DisposableBean
     private final String getDriver() throws ConfigurationFailureException
     {
         checkDatabaseEngine();
-        return databaseEngine.getDriverClass().getCanonicalName();
+        return databaseEngine.getDriverClass();
     }
 
     /**
diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseEngine.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseEngine.java
index 323b5e3fc05..7096e8e0bb9 100644
--- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseEngine.java
+++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseEngine.java
@@ -38,11 +38,11 @@ import ch.systemsx.cisd.dbmigration.postgresql.PostgreSQLDAOFactory;
  */
 public enum DatabaseEngine
 {
-    POSTGRESQL("postgresql", org.postgresql.Driver.class, PostgreSQLDAOFactory.class, new DefaultLobHandler(),
+    POSTGRESQL("postgresql", "org.postgresql.Driver", PostgreSQLDAOFactory.class, new DefaultLobHandler(),
             new PostgreSQLSequencerHandler(), "jdbc:postgresql:{0}", "jdbc:postgresql:{0}{1}", "//localhost/",
             "postgres"),
 
-    H2("h2", org.h2.Driver.class, H2DAOFactory.class, new DefaultLobHandler(),
+    H2("h2", "org.h2.Driver", H2DAOFactory.class, new DefaultLobHandler(),
             new PostgreSQLSequencerHandler(), "jdbc:h2:{0}{1};DB_CLOSE_DELAY=-1",
             "jdbc:h2:{0}{1};DB_CLOSE_DELAY=-1", "mem:", "");
 
@@ -50,7 +50,7 @@ public enum DatabaseEngine
 
     private final String code;
 
-    private final Class<java.sql.Driver> driverClass;
+    private final String driverClass;
 
     private final Class<ch.systemsx.cisd.dbmigration.IDAOFactory> daoFactoryClass;
 
@@ -69,7 +69,7 @@ public enum DatabaseEngine
     private final String defaultAdminUser;
 
     @SuppressWarnings("unchecked")
-    DatabaseEngine(String code, Class<?> driver, Class<?> daoFactoryClass, LobHandler lobHandler,
+    DatabaseEngine(String code, String driver, Class<?> daoFactoryClass, LobHandler lobHandler,
             ISequencerHandler sequenceHandler, String adminUrlTemplate, String urlTemplate, String defaultURLHostPart,
             String defaultAdminUser)
     {
@@ -88,7 +88,7 @@ public enum DatabaseEngine
         this.urlTemplate = urlTemplate;
         this.defaultURLHostPart = defaultURLHostPart;
         this.defaultAdminUser = defaultAdminUser;
-        this.driverClass = (Class<java.sql.Driver>) driver;
+        this.driverClass = driver;
         this.lobHandler = lobHandler;
         this.sequenceHandler = sequenceHandler;
         this.daoFactoryClass = (Class<ch.systemsx.cisd.dbmigration.IDAOFactory>) daoFactoryClass;
@@ -126,7 +126,7 @@ public enum DatabaseEngine
     /**
      * @return the class of the driver.
      */
-    public final Class<java.sql.Driver> getDriverClass()
+    public final String getDriverClass()
     {
         return driverClass;
     }
-- 
GitLab