Invalid Oracle Data Source Length

Error

Error Text

Oracle error: Invalid length for connection option 'Data Source', maximum length is 128.

Scenario

You run an SQL script that attempts to connect to an Oracle DB using the System.Data.OracleClient.OracleConnectionStringBuilder.set_DataSource(String value) call. The script runs from the local site as a database account, and an error occurs.

The error stack trace from the logs looks similar to this:

Copy
 2020-05-20 11:24:16,149 [CID:] [C:] [TID:PriorityScheduler Thread @ Normal] ERROR <Secret Server URL />.PasswordChangers.DependencyChangers.Sql.SqlScriptRunner - Invalid length for connection option 'Data Source', maximum length is 128.
System.ArgumentException: Invalid length for connection option 'Data Source', maximum length is 128.
  at System.Data.OracleClient.OracleConnectionStringBuilder.set_DataSource(String value)
  at System.Data.OracleClient.OracleConnectionStringBuilder.set_Item(String keyword, Object value)
  at System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(String value)
  at <Secret Server URL />.PasswordChangers.DependencyChangers.Sql.SqlScriptRunner.BuildConnection(DbProviderFactory dbProviderFactory, String connectionString, IDictionary2 additionalConnectionItems)
  at <Secret Server URL />.PasswordChangers.DependencyChangers.Sql.SqlScriptRunner.ExecuteScript(String providerName, String connectionString, IDictionary2 additionalConnectionItems, String commandText, IEnumerable`1 parameters)

Resolution

This error is an Oracle issue. Oracle has built-in string length restrictions on data source strings. One possible workaround is to use IP addresses for the Oracle server instead of FQDNs. Failing that, search the Internet for "Invalid length for connection option 'Data Source', maximum length is 128" to discover the latest information and workarounds.

Related Topics

  • Oracle Database: choosing an Oracle secret template and finding every Oracle topic