When you test a SQL Server connection for a Ranorex Studio SQL data source, the connection may fail with the message “The connection string is invalid.” This can happen when the same connection works in a .NET Framework 4.8 environment but fails in a .NET 10 environment.
Cause
The SQL client used in .NET Framework 4.8 and the client used in .NET 10 have different encryption defaults.
The .NET Framework 4.8 connection uses System.Data.SqlClient, which defaults to
.
The newer connection uses Microsoft.Data.SqlClient, which defaults to Encrypt=Mandatory and validates the SQL Server certificate. If the certificate is self-signed, untrusted, or does not match the server name in the connection string, validation can fail.
Resolution
Configure SQL Server with a certificate trusted by the computer running Ranorex Studio. Make sure the server name in the connection string matches the name on the certificate.
For an isolated development or test environment that uses a self-signed or untrusted certificate, add these settings to the SQL Server connection string:
Encrypt=True;TrustServerCertificate=TrueThis keeps the connection encrypted but skips validation of the server certificate. Use it only when you understand and accept that security tradeoff. Microsoft recommends keeping certificate validation enabled for production connections.
Verify the connection
- Open the SQL data connector’s connection settings in Ranorex Studio.
- Update the connection string with the appropriate certificate settings.
- Test the connection.
- Run the query and confirm that the results are returned.
Ranorex Studio connects to the SQL Server data source and displays the query results.