Skip to content

Commit 8eb5dea

Browse files
authored
Remove 1024 character limit on ODBC connection strings (#73149)
Fixes #63630
1 parent 2f78734 commit 8eb5dea

File tree

3 files changed

+3
-21
lines changed

3 files changed

+3
-21
lines changed

src/libraries/System.Data.Odbc/src/Resources/Strings.resx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,6 @@
386386
<data name="ADP_OdbcNoTypesFromProvider" xml:space="preserve">
387387
<value>The ODBC provider did not return results from SQLGETTYPEINFO.</value>
388388
</data>
389-
<data name="OdbcConnection_ConnectionStringTooLong" xml:space="preserve">
390-
<value>Connection string exceeds maximum allowed length of {0}.</value>
391-
</data>
392389
<data name="Odbc_UnknownSQLType" xml:space="preserve">
393390
<value>Unknown SQL type - {0}.</value>
394391
</data>

src/libraries/System.Data.Odbc/src/System/Data/Odbc/Odbc32.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,17 @@ internal static Exception UnknownSQLType(ODBC32.SQL_TYPE sqltype)
2424
{
2525
return ADP.Argument(SR.GetString(SR.Odbc_UnknownSQLType, sqltype.ToString()));
2626
}
27-
internal static Exception ConnectionStringTooLong()
28-
{
29-
return ADP.Argument(SR.GetString(SR.OdbcConnection_ConnectionStringTooLong, ODBC32.MAX_CONNECTION_STRING_LENGTH));
30-
}
27+
3128
internal static ArgumentException GetSchemaRestrictionRequired()
3229
{
3330
return ADP.Argument(SR.GetString(SR.ODBC_GetSchemaRestrictionRequired));
3431
}
32+
3533
internal static ArgumentOutOfRangeException NotSupportedEnumerationValue(Type type, int value)
3634
{
3735
return ADP.ArgumentOutOfRange(SR.GetString(SR.ODBC_NotSupportedEnumerationValue, type.Name, value.ToString(System.Globalization.CultureInfo.InvariantCulture)), type.Name);
3836
}
37+
3938
internal static ArgumentOutOfRangeException NotSupportedCommandType(CommandType value)
4039
{
4140
#if DEBUG
@@ -664,12 +663,6 @@ internal enum SQL_DRIVER
664663
COMPLETE_REQUIRED = 3,
665664
}
666665

667-
// todo:move
668-
// internal const. not odbc specific
669-
//
670-
// Connection string max length
671-
internal const int MAX_CONNECTION_STRING_LENGTH = 1024;
672-
673666
// Column set for SQLPrimaryKeys
674667
internal enum SQL_PRIMARYKEYS : short
675668
{

src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcConnectionString.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ internal OdbcConnectionString(string connectionString, bool validate) : base(con
2222
int position = 0;
2323
_expandedConnectionString = ExpandDataDirectories(ref filename, ref position);
2424
}
25-
if (validate || (null == _expandedConnectionString))
26-
{
27-
// do not check string length if it was expanded because the final result may be shorter than the original
28-
if ((null != connectionString) && (ODBC32.MAX_CONNECTION_STRING_LENGTH < connectionString.Length))
29-
{ // MDAC 83536
30-
throw ODBC.ConnectionStringTooLong();
31-
}
32-
}
3325
}
3426
}
3527
}

0 commit comments

Comments
 (0)