microsoft / microsoft/go-sqlcmd
Implement -D flag for ODBC DSN (Data Source Name) support
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 595
- Forks
- 91
- Avg merge
- 9h 35m
- Merged PRs (30d)
- 1
Description
Summary
The ODBC sqlcmd supports a -D flag that allows connecting using an ODBC Data Source Name (DSN) instead of specifying connection parameters directly.
Current State
- The -D flag is not implemented in go-sqlcmd
- Linux ODBC sqlcmd supports this for using pre-configured DSNs
Requested Behavior
When -D is specified, the -S parameter should be interpreted as a DSN name rather than a server name. The DSN would be looked up from the system's ODBC configuration (e.g., /etc/odbc.ini\ on Linux or ODBC Data Source Administrator on Windows).
Considerations
- go-sqlcmd uses go-mssqldb directly, not ODBC, so implementing DSN support would require:
- Parsing ODBC ini files to extract connection parameters
- Or, using CGO to call ODBC APIs (which would add complexity)
- This may require a design discussion to determine the best approach
References
- ODBC sqlcmd usage: -S <DSN_name> -D\ indicates that -S\ refers to a DSN
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the command-line handling for -D and -S and how go-sqlcmd passes connection parameters to go-mssqldb. Compare parsing ODBC ini files with calling ODBC APIs through CGO, then clarify the design choice. Done means -D makes -S resolve a configured DSN on supported systems, with the connection behavior and platform scope defined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100