From 02bc52037e9ccccca672d6156d9c325c74fe28b3 Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Mon, 1 Jul 2024 17:27:48 -0400 Subject: 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" --- .../src/main/java/net/wotonomy/jdbcadaptor/JDBCContext.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCContext.java') 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 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) { -- cgit v1.2.3