From 292cce25337e3e4053f319824d8078484f1a11e6 Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Tue, 15 May 2018 07:24:57 -0400 Subject: [PATCH] Manually load drivers pre-java8 --- .../com/moparisthebest/jdbc/QueryMapperTest.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test/src/test/java/com/moparisthebest/jdbc/QueryMapperTest.java b/test/src/test/java/com/moparisthebest/jdbc/QueryMapperTest.java index a8ba909..5804a7d 100644 --- a/test/src/test/java/com/moparisthebest/jdbc/QueryMapperTest.java +++ b/test/src/test/java/com/moparisthebest/jdbc/QueryMapperTest.java @@ -83,12 +83,23 @@ public class QueryMapperTest { } else { jUrls.add(jdbcUrl); } - for(final String extraJdbcUrlProp : new String[]{"postgresqlJdbcUrl", "mariadbJdbcUrl", "mysqlJdbcUrl"}) { - final String extrajdbcUrl = System.getProperty(extraJdbcUrlProp); + for(int x = 1; ; ++x) { + final String extrajdbcUrl = System.getProperty("jdbcUrl" + x); if(extrajdbcUrl != null) jUrls.add(extrajdbcUrl); + else + break; } jdbcUrls = Collections.unmodifiableCollection(jUrls); + /*IFJAVA6_START + // this seems to only be needed for java <8 + for(final String driverClass : new String[]{"org.hsqldb.jdbc.JDBCDriver", "org.h2.Driver"}) + try { + Class.forName(driverClass); + } catch(Exception e) { + // ignore, any real errors will be caught during test running + } + IFJAVA6_END*/ } public static void insertPerson(final QueryMapper qm, final Person person) throws SQLException { @@ -100,7 +111,6 @@ public class QueryMapperTest { } public static Connection getConnection(final String url) throws SQLException { - // don't need Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); anymore? final Connection conn = DriverManager.getConnection(url); QueryMapper qm = null; try {