diff options
| author | Benjamin Culkin <scorpress@gmail.com> | 2024-07-01 17:27:48 -0400 |
|---|---|---|
| committer | Benjamin Culkin <scorpress@gmail.com> | 2024-07-01 17:27:48 -0400 |
| commit | 02bc52037e9ccccca672d6156d9c325c74fe28b3 (patch) | |
| tree | db022b83c90562f461f4a27412caa9936a8dfd04 /projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCContext.java | |
| parent | c75d7dbd613a47b217499f7a856c469a8bc59e2a (diff) | |
Update a whole bunch of things
Yeah... not a great commit message. t.b.h, I could maybe've split the
commit into more parts; but that would be quite a lot off effort and
would have a pretty decent chance of at least one of the commits leaving
the repository in a non-working state.
For the future, will want to try and commit more often so there aren't
these mega-commits where it's just "a whole bunch of stuff changed"
Diffstat (limited to 'projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCContext.java')
| -rw-r--r-- | projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCContext.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCContext.java b/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCContext.java index 9e6df6c..87c33fe 100644 --- a/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCContext.java +++ b/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCContext.java @@ -25,6 +25,7 @@ import java.sql.SQLException; import net.wotonomy.access.EOAdaptor; import net.wotonomy.access.EOAdaptorChannel; import net.wotonomy.access.EOAdaptorContext; +import net.wotonomy.foundation.NSDictionary; /** * Concrete implementation of EOAdaptorContext for use with JDBC. @@ -51,11 +52,14 @@ public class JDBCContext extends EOAdaptorContext { if (_jdbcConnection != null && !_jdbcConnection.isClosed()) throw new JDBCAdaptorException("Attempt to connect when already connected.", null); Class.forName(((JDBCAdaptor) adaptor()).driverName()); - String url = (String) adaptor().connectionDictionary().objectForKey("URL"); + NSDictionary<String, Object> connectionDictionary = adaptor().connectionDictionary(); + String url = (String) connectionDictionary.objectForKey("URL"); Driver driver = DriverManager.getDriver(url); java.util.Properties props = new java.util.Properties(); - props.setProperty("user", (String) adaptor().connectionDictionary().objectForKey("username")); - props.setProperty("password", (String) adaptor().connectionDictionary().objectForKey("password")); + if (connectionDictionary.containsKey("username")) + props.setProperty("user", (String) connectionDictionary.objectForKey("username")); + if (connectionDictionary.containsKey("password")) + props.setProperty("password", (String) connectionDictionary.objectForKey("password")); _jdbcConnection = driver.connect(url, props); _jdbcConnection.setAutoCommit(false); } catch (SQLException ex) { |
