denisenkom / go-mssqldb

Microsoft SQL server driver written in go language
BSD 3-Clause "New" or "Revised" License
1.82k stars 497 forks source link

Support "Application Name" for improved compatibility with .NET connection strings #645

Open cgillum opened 3 years ago

cgillum commented 3 years ago

Is your feature request related to a problem? Please describe. I'm working with Kubernetes deployments where apps and components written in different languages share common connection strings. One of the components in the KEDA mssql scaler, which uses this library to connect to an mssql database. The problem I have is that connection strings used by .NET are not necessarily compatible with connection strings supported by go-mssqldb.

For example, in .NET applications, the way to specify the name of an app in the connection string is "Application Name=XYZ". However, the way to do this in go-mssqldb is to use "App Name=XYZ". These differences mean that the same connection string cannot be used for both the Go code and the .NET code.

Describe the solution you'd like Ideally go-mssqldb would support both "App Name=XYZ" and "Application Name=XYZ" for specifying the name of the app. This would improve compatibility with .NET apps without breaking backwards compatibility.

Describe alternatives you've considered We could use different connection strings between Go apps and .NET apps, but this results in duplicated secret configuration, which is not ideal. In some cases, tools are used to automate the configuration of secrets and these kinds of workarounds become very difficult.

Additional context There are other incompatibilities, such as go-mssqldb not supporting the "tcp:" prefix or the ",{portNumber}" suffix for the server name, but those can be tracked separately.

Also, I'd be happy to try and contribute this support if I can be pointed to the right code to update.

shueybubbles commented 3 years ago

I'll take a crack at this in github.com/shueybubbles/go-mssqldb as I am learning go