-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when connecting to sqlserver database #142
Comments
|
Thank you very much for your reply. This password is not real. How to use sqlx? |
` package main import ( func main() {
} ` I wrote a simple go program and then executed it and reported an error this is error: But using the same authentication information, you can log in normally using the navicat client. |
` import (
) func main() {
} ` I used this code and it was ok. I could connect to the sqlserver database normally and output metrics normally. |
Use the latest version of docker version 0.5.7, use the following method to connect to the sqlserver database and report an error.
`
connections:
`
The error message is as follows:
`
sql_exporter | 2024/10/18 17:55:29 maxprocs: Leaving GOMAXPROCS=32: CPU quota undefined
sql_exporter | {"build_context":"(go=go1.21.13, platform=linux/amd64, user=, date=, tags=unknown)","caller":"main.go:58","msg":"Starting sql_exporter","ts":"2024-10-18T09:55:29.251726806Z","version_info":"(version=, branch=, revision=e69d565d5ad3b09c002040f3462399e1022de2a3)"}
sql_exporter | {"caller":"exporter.go:103","interval":"5m0s","level":"info","msg":"Started periodically execution of job","name":"example","ts":"2024-10-18T09:55:29.252221881Z"}
sql_exporter | {"caller":"main.go:81","level":"info","listenAddress":":9237","msg":"Listening","ts":"2024-10-18T09:55:29.252336169Z"}
sql_exporter | {"caller":"job.go:408","job":"example","level":"debug","msg":"Starting","ts":"2024-10-18T09:55:29.252356894Z"}
sql_exporter | {"Query:":"SET lock_timeout = 1000","caller":"job.go:551","job":"example","level":"debug","msg":"StartupSQL","ts":"2024-10-18T09:55:30.529707916Z"}
sql_exporter | panic: mssql: Incorrect syntax near '='.
sql_exporter |
sql_exporter | goroutine 24 [running]:
sql_exporter | github.com/jmoiron/sqlx.MustExec(...)
sql_exporter | /src/vendor/github.com/jmoiron/sqlx/sqlx.go:725
sql_exporter | github.com/jmoiron/sqlx.(*DB).MustExec(0xc000918730?, {0xc000964048?, 0x4?}, {0x0?, 0xc0000eedb0?, 0xc0000eede0?})
sql_exporter | /src/vendor/github.com/jmoiron/sqlx/sqlx.go:369 +0x45
sql_exporter | main.(*connection).connect(0xc00097ae00, 0xc0009740b0)
sql_exporter | /src/job.go:552 +0x8e5
sql_exporter | main.(*Job).runOnceConnection(0xc0009740b0, 0xc00097ae00, 0xc0009740b0?)
sql_exporter | /src/job.go:423 +0xa5
sql_exporter | created by main.(*Job).runOnce in goroutine 41
sql_exporter | /src/job.go:474 +0x5d
sql_exporter exited with code 0
`
The text was updated successfully, but these errors were encountered: