From c6affc7d09760d06be742e710a2d36865cf5a215 Mon Sep 17 00:00:00 2001 From: Konstantin Triger Date: Thu, 25 May 2006 16:10:53 +0000 Subject: [PATCH] merge -r 61099:61100 svn path=/trunk/mcs/; revision=61122 --- .../GenericProvider.cs | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/mcs/class/System.Data/Mainsoft.Data.Jdbc.Providers.jvm/GenericProvider.cs b/mcs/class/System.Data/Mainsoft.Data.Jdbc.Providers.jvm/GenericProvider.cs index 2c87681082f..a3d33793a5c 100755 --- a/mcs/class/System.Data/Mainsoft.Data.Jdbc.Providers.jvm/GenericProvider.cs +++ b/mcs/class/System.Data/Mainsoft.Data.Jdbc.Providers.jvm/GenericProvider.cs @@ -80,6 +80,8 @@ namespace Mainsoft.Data.Jdbc.Providers internal java.sql.Connection Connection { get { + java.util.Properties properties = new java.util.Properties (); + string url = (string)_keyMapper["JdbcURL"]; if (url == null) { string jdbcUrlPattern = (string)_provider.ProviderInfo [ConfigurationConsts.JdbcUrlPattern]; @@ -91,8 +93,38 @@ namespace Mainsoft.Data.Jdbc.Providers MatchEvaluator evaluator = new MatchEvaluator (ReplaceEvaluator); url = JdbcUrlPatternRegex.Replace (jdbcUrlPattern, evaluator); } + else { + // hack for backward comatibility: + // if the connection string contains 'Provider', + // the following mapping will hold: + // 'User', 'User Id' --> 'user' + // 'Password' --> 'password' + if (_keyMapper["Provider"] != null) { + + const string USER = "User"; + const string USERID = "User Id"; + const string PASSWORD = "Password"; + + string user = (string)_keyMapper[USER]; + if (user != null) { + properties.put("user", user); + _excludedKeys.Add(USER); + } + else { + user = (string)_keyMapper[USERID]; + if (user != null) { + properties.put("user", user); + _excludedKeys.Add(USERID); + } + } - java.util.Properties properties = new java.util.Properties (); + string password = (string)_keyMapper[PASSWORD]; + if (password != null) { + properties.put("password", password); + _excludedKeys.Add(PASSWORD); + } + } + } if (_provider._excludedKeys != null) _excludedKeys.AddRange(_provider._excludedKeys); -- 2.25.1