Skip to content

#73155 Remove 1024 character limit on ODBC connection strings Fix works in .NET 6 but not in Framework 4.X #76094

Open
@rjschulte

Description

@rjschulte

Description

Thank you for releasing the system.data.odbc v 6.0.9 last week - my request Remove 1024 character limit on ODBC connection strings #73155 was included
from NuGet I have updated my code to use System.Data.Odbc v 6.0.9
I have since tested in .NET 6.0 and it works great, I can put a connection string as big as length of 2k
unfortunately, it does not in .NET Framework 4.x I still get the 1024-character error
System.ArgumentException: 'Connection string exceeds maximum allowed length of 1024.'

do not know if this is related to Framework having system.data.odbc also in system.data.dll if that is the case is there a way to bypass the references in system.data? and point directly to the new version. I tried aliasing the Dll but did not work

Reproduction Steps

Tried both directly and aliasing the ODBC.DLL

using System.Data;
//using System.Data.Odbc;
using ODBC2 = System.Data.Odbc;

string connetionString = "Driver={SomeDriver};server=us-east-1.server;warehouse=;authenticator=oauth;tracing=4;TOKEN=SUzI1NiIsIng1dCI6Ik1yNS1BVWliZkJpaTdOZDFqQmViYXhib1hXMCIsImtpZCI6Ik1yNS1BVWliZkJpaTdOZDFqQmViYXhib1hXMCJ9.eyJhdWQiOiI1YTMzOWY4Mi0yMjZkLTQ0MmMtYjBjNi03YzYxNzZlMGM3ZjEiLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC82YzdlYzU3NC01OTA0LTRkNDktYmQxOC02YWIzZDQzMmFkMmQvIiwiaWF0IjoxNjQzNjQ4NTYyLCJuYmYiOjE2NDM2NDg1NjIsImV4cCI6MTY0MzY1MzIyNSwiYWNyIjoiMSIsImFpbyI6IkFUUUF5LzhUQUFBQURrOHltTk9vVXhUZWhYSHpXTmxDVGVjbU1KaHZkTERtczZxK01FN2RwRHVOeERRMFBsMnRERHltWVczVkkxQVYiLCJhbXIiOlsicHdkIl0sImFwcGlkIjoiYTYyZTdmOWMtYjNmZi00YjQxLWFkMWMtNGQwZTA2OTA1NzkxIiwiYXBwaWRhY3IiOiIwIiwiZmFtaWx5X25hbWUiOiJTY2h1bHRlIiwiZ2l2ZW5fbmFtZSI6IlJpY2hhcmQiLCJpcGFkZHIiOiIxNzAuMjE4LjQ2LjIzIiwibmFtZSI6IlJpY2hhcmQgSiBTY2h1bHRlIiwib2lkIjoiMWEwYmRmMTUtZTE4Yy00YTQ0LTljY2ItZDYyY2ZhYTY2Y2M1Iiwib25wcmVtX3NpZCI6IlMtMS01LTIxLTg2MTU2NzUwMS0xNTQ3MTYxNjQyLTE4MDE2NzQ1MzEtMzEwMjA4IiwicmgiOiIwLkFS";

ODBC2.OdbcConnection cnn; < - error here!
System.ArgumentException: 'Connection string exceeds maximum allowed length of 1024.'

Expected behavior

successful connection with ODBC driver to database server in the cloud using an Azure Token that has a length of 1650

like we new get in .NET 6

Actual behavior

System.ArgumentException: 'Connection string exceeds maximum allowed length of 1024.'

same error we were getting before the fix

Regression?

see above System.Data.Odbc v 6.0.9 released last week only work in .NET 6

Known Workarounds

We have many data applications still using Framework that need to access cloud databases via ODBC and cannot

Configuration

No response

Other information

Again thanks for fixing System.Data.Odbc in .NET 6 but we REALLY need to also have it Work in Framework 4.X

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Data.Odbctracking-external-issueThe issue is caused by external problem (e.g. OS) - nothing we can do to fix it directly

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions