Skip to content

SQL Server Instance Help #6776

Answered by iTanken
bedirhanmanim asked this question in Q&A
Jan 4, 2024 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

https://github.com/microsoft/go-mssqldb#connection-parameters-and-dsn

// dbConfig is the database connection configuration information struct
if strings.Contains(dbConfig.Host, `\`) {
	// Compatibility Backslash Instance Path
	dbConfig.Host = strings.ReplaceAll(dbConfig.Host, `\`, `/`)
}

query := url.Values{}
query.Add("database", dbConfig.Database)
query.Add("app name", dbConfig.AppName)
query.Add("encrypt", "disable")
query.Add("connection timeout", "90")
query.Add("dial timeout", "30")
query.Add("keepalive", "30")

sqlserverUrl := &url.URL{
	Scheme:   `sqlserver`,
	User:     url.UserPassword(dbConfig.Username, dbConfid.Password),
	RawQuery: query.Encode(), // Connection parameters
}

if 

Replies: 1 comment 3 replies

Comment options

@BEDIRHANSAMSA
Comment options

@iTanken
Comment options

Answer selected by bedirhanmanim
@bedirhanmanim
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants