[jOOQ/jOOQ#12951] GenerationTool should handle HSQLDB driver returning
null Connection on Driver::connect
This commit is contained in:
parent
5dd3e641c8
commit
a18294daf4
@ -365,7 +365,13 @@ public class GenerationTool {
|
||||
if (!properties.containsKey("password"))
|
||||
properties.put("password", defaultString(j.getPassword()));
|
||||
|
||||
setConnection(driver.newInstance().connect(defaultString(j.getUrl()), properties));
|
||||
Connection c = driver.newInstance().connect(defaultString(j.getUrl()), properties);
|
||||
|
||||
// [#12951] Some drivers may (illegally) return null if the URL is incorrect?
|
||||
if (c == null)
|
||||
throw new SQLException("Cannot connect to database using JDBC URL: " + j.getUrl() + ". Please review your JDBC configuration in the code generator configuration.");
|
||||
|
||||
setConnection(c);
|
||||
|
||||
if (j.getInitScript() != null)
|
||||
for (String sql : j.getInitScript().split(defaultIfBlank(j.getInitSeparator(), ";")))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user