From 3570573f93dea7b91d9c97d7dab3d17b4e76900c Mon Sep 17 00:00:00 2001 From: Randy Kerber Date: Thu, 27 Apr 2017 20:53:17 -0400 Subject: [PATCH] Update how MySQLAccess passes user+password to get Connection. --- .../src/org/bridgedb/mysql/MySQLAccess.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/org.bridgedb.sql/src/org/bridgedb/mysql/MySQLAccess.java b/org.bridgedb.sql/src/org/bridgedb/mysql/MySQLAccess.java index 94da5060e..31e74b974 100644 --- a/org.bridgedb.sql/src/org/bridgedb/mysql/MySQLAccess.java +++ b/org.bridgedb.sql/src/org/bridgedb/mysql/MySQLAccess.java @@ -27,7 +27,7 @@ /** * MYSQL specific wrapper. - * + * * @author Christian */ public class MySQLAccess implements SQLAccess{ @@ -37,10 +37,10 @@ public class MySQLAccess implements SQLAccess{ private String username;// = "irs"; /** password for the database */ private String password;// = "irs"; - + /** * Instantiate a connection to the database - * + * * @throws IMSException If there is a problem connecting to the database. */ public MySQLAccess(String dbUrl, String username, String password) throws BridgeDBException { @@ -65,14 +65,20 @@ public MySQLAccess(String dbUrl, String username, String password) throws Bridge /** * Retrieve an active connection to the database - * + * * @return database connection * @throws IMSException if there is a problem establishing a connection */ @Override public Connection getConnection() throws BridgeDBException { try { - Connection conn = DriverManager.getConnection(dbUrl, username, password); + java.util.Properties info = new java.util.Properties(); + + info.put("user", username); + info.put("password", password); + info.put("protocol", "tcp"); + + Connection conn = DriverManager.getConnection(dbUrl, info); return conn; } catch (SQLException ex) { System.err.println(ex); @@ -81,5 +87,5 @@ public Connection getConnection() throws BridgeDBException { throw new BridgeDBException(msg, ex); } } - + }