Question

I'm using:

  • Advantage Database Server 10
  • Advantage.Data.Provider.dll (v.9.10.2.9)

Everything works pretty stable on most of workstations, but today one of our new customers had reported that he experiencing troubles with our app. The logs shows the following strage exception:

System.ArgumentException: Unrecognized property 'user id' in connection string. at Advantage.Data.Provider.AdsConnectionStringHandler.ParseConnectionString(String strConnect) at Advantage.Data.Provider.AdsPoolManager.GetConnection(String strConnectionString, AdsInternalConnection& internalConnection, AdsConnectionPool& pool) at Advantage.Data.Provider.AdsConnection.Open()

As soon as the same code works well by all other customers, I guess the problem could be related to the running environment, but I'm still trying to figure out what exactly can cause this problem.

Any ideas?

UPDATE

I just looked through the Advantage.Data.Provider.dll code and found that they are using a Hashtable to match the connection string properties and Hashtable's initialization looks a little strange for me:

public static Hashtable CreateCaseInsensitiveHashtable()
{
  return new Hashtable((IEqualityComparer) StringComparer.CurrentCultureIgnoreCase);
}

I guess StringComparer.CurrentCultureIgnoreCase could be a trouble here, but I need to check.

Était-ce utile?

La solution

This has been fixed in versions 9.10.0.21 and later of the client. From the page with the download link:

2 - Fixed a bug in the Advantage .NET Data Provider that caused connection strings not to be parsed correctly for some locales (tr-TR specifically).

Autres conseils

Oh, year, StringComparer.CurrentCultureIgnoreCase was the issue. It looks like the bug in the Advantage.Data.Provider.dll. The StringComparer.InvariantCultureIgnoreCase should be used instead. The following code shows the issue:

foreach (var culture in CultureInfo.GetCultures(CultureTypes.AllCultures))
{
    Thread.CurrentThread.CurrentCulture = culture;
    Thread.CurrentThread.CurrentUICulture = culture;

    var isEquals = StringComparer.CurrentCultureIgnoreCase
                                 .Compare("user id", "User ID") == 0;

    if (!isEquals)
        Console.WriteLine("culture: {0}; equals: {1}", culture.Name, isEquals);
}

it gives an output:

culture: tr; equals: False
culture: az; equals: False
culture: tr-TR; equals: False
culture: az-Latn-AZ; equals: False
culture: az-Latn; equals: False

The workaround should be simple - use User ID in the connection string. I will ask a customer which culture is currently set in the system.

UPDATE

The customer confirmed that he has the Turkish culture.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top