equal
deleted
inserted
replaced
76 } else { |
76 } else { |
77 log.log(Level.FINE, "Using custom Driver „{0}“ to create connection for „{1}“", new Object[]{driverClassName, url}); |
77 log.log(Level.FINE, "Using custom Driver „{0}“ to create connection for „{1}“", new Object[]{driverClassName, url}); |
78 try { |
78 try { |
79 Class<Driver> driverClass = (Class<Driver>) Class.forName(driverClassName); |
79 Class<Driver> driverClass = (Class<Driver>) Class.forName(driverClassName); |
80 Driver driver = driverClass.newInstance(); |
80 Driver driver = driverClass.newInstance(); |
81 return driver.connect(url, javaProperties); |
81 Connection connection = driver.connect(url, javaProperties); |
|
82 if (connection == null) { |
|
83 log.log(Level.SEVERE, "Driver „{0}“ returend null → it does not accept the URL: „{1}“", new Object[]{driverClassName, url}); |
|
84 throw new SQLException("Unable to connect: driver returned null."); |
|
85 } else { |
|
86 return connection; |
|
87 } |
82 } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | SQLException e) { |
88 } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | SQLException e) { |
83 throw new SQLException("Unable to connect usig specific driver: " + driverClassName, e); |
89 throw new SQLException("Unable to connect usig specific driver: " + driverClassName, e); |
84 } |
90 } |
85 } |
91 } |
86 } |
92 } |