denisenkom / go-mssqldb

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

Login failed. The login is from an untrusted domain and cannot be used with Integrated authentication. #694

Open kostinalextransam opened 3 years ago

kostinalextransam commented 3 years ago

Hi, Today is my first day with GoLang.

I cannot connect to MSSQL (third party server, so please do not ask me to change its settings, I do not have an access to them).

The error reads: "login error: mssql: Login failed. The login is from an untrusted domain and cannot be used with Integrated authentication."

Here is the code that I'm using.

        db, err = sql.Open("mssql", "server=s25.winhost.com;user=DB_135931_golangtest_user;password=goLangTestWelcomeToGoLang;")
        if err != nil {
            log.Println("Error creating connection pool: ", err.Error())
            return
        }
        ctx := context.Background()
        err = db.PingContext(ctx)
        if err != nil {
            log.Println(err.Error())
            return
        }
        log.Println("Connected!")

And here is the original connection string in "normal" format.

"Data Source=tcp:s25.winhost.com;Initial Catalog=DB_135931_golangtest;User ID=DB_135931_golangtest_user;Password=goLangTestWelcomeToGoLang;Integrated Security=False;"

So do you guys have something like "Integrated Security=False;" parameter in you connection string in GoLang or am I missing something?

Thanks in advance.

AmarsDing commented 2 years ago

me too