1. what and where you are connecting from?
2. what and where you are connecting to?
Original Message:
Sent: Mon May 29, 2023 11:52 AM
From: Eric M
Subject: DbProviderFactories.RegisterFactory parameters for Net.IBM.Data.Db2 for .NET 7.0
Your suggestion gave me an idea. Once I was able to straighten out the namespaces I was able to use this to get the values I was looking for:
using IBM.Data.Db2;
DbProviderFactories.RegisterFactory("Net.IBM.Data.DB2", DB2Factory.Instance);
DataTable dt = DbProviderFactories.GetFactoryClasses();
This provided me with the following for the factoryTypeAssemblyQualifiedName parameter:
"IBM.Data.Db2.DB2Factory, IBM.Data.Db2, Version=7.0.0.200, Culture=neutral, PublicKeyToken=7c307b91aa13d208"
Thanks for your help.
Now I am getting the following on connection.Open():
ERROR [58009] [IBM] SQL30020N Execution of the command or SQL statement failed because of a syntax error in the communication data stream that will affect the successful execution of subsequent commands and SQL statements: Reason Code "0x124C"("0209")"". SQLSTATE=58009
------------------------------
Eric M
Original Message:
Sent: Thu May 25, 2023 10:14 AM
From: Jan Nelken
Subject: DbProviderFactories.RegisterFactory parameters for Net.IBM.Data.Db2 for .NET 7.0
And this eample also does not help you?
RegisterFactory(String, String)
Registers a DbProviderFactory with the given assembly-qualified name under the specified invariant provider name.
public static void RegisterFactory (string providerInvariantName, string factoryTypeAssemblyQualifiedName);
Parameters
- providerInvariantName
- String
The invariant provider name under which to register the provider.
------------------------------
Jan Nelken
Original Message:
Sent: Thu May 25, 2023 09:42 AM
From: Eric M
Subject: DbProviderFactories.RegisterFactory parameters for Net.IBM.Data.Db2 for .NET 7.0
Unfortunately with .NET 7.0 you cannot use DbProviderFactories.GetFactory()
without manually registering the factory first. Previously (.NET Framework 4.8) you could use DbProviderFactories.GetFactory()
to get one of the ones already registered on the machine, but not anymore. Therefore I'm still looking for the correct parameter values for DbProviderFactores.RegisterFactory()
.
------------------------------
Eric M
Original Message:
Sent: Wed May 24, 2023 11:43 AM
From: Jan Nelken
Subject: DbProviderFactories.RegisterFactory parameters for Net.IBM.Data.Db2 for .NET 7.0
Did you try something like this:
DbProviderFactory factory = DbProviderFactories.GetFactory("IBM.Data.DB2"); DbConnection conn = factory.CreateConnection(); DbConnectionStringBuilder sb = factory.CreateConnectionStringBuilder(); if( sb.ContainsKey( "Database" ) ) { sb.Remove( "database" ); sb.Add( "database", "SAMPLE" ); } conn.ConnectionString = sb.ConnectionString; conn.Open();
------------------------------
Jan Nelken
Original Message:
Sent: Tue May 23, 2023 11:27 AM
From: Eric M
Subject: DbProviderFactories.RegisterFactory parameters for Net.IBM.Data.Db2 for .NET 7.0
Previously, for .NET Framework 4.8 I was able to use (something like) the following to register the IBM iSeries factory using C#:
DbProviderFactories.RegisterFactory("IBM.Data.DB2.iSeries", "IBM.Data.DB2.iSeries.iDB2Factory, IBM.Data.DB2.iSeries, Version=12.0.0.0, Culture=neutral, PublicKeyToken=9cdb2ebfb1f93a26");
I understand that to connect using .NET 7.0 I now need to use the Net.IBM.Data.Db2
drivers.
What would be the equivalent parameter values for DbProviderFactories.RegisterFactory()
for Net.IBM.Data.Db2
? I can't seem to find it online.
I have installed the Net.IBM.Data.Db2 NuGet package.
Thanks
------------------------------
Eric M
------------------------------