SHARE
TWEET

Untitled

a guest Oct 10th, 2019 123 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package main
  2.  
  3. import (
  4.     "fmt"
  5.     "database/sql"
  6.     _ "github.com/denisenkom/go-mssqldb"
  7.     "log"
  8. )
  9.  
  10. var server = "localhost"
  11. var port = 1433
  12. var user = "sa"
  13. var password = "Password1234"
  14.  
  15. func main() {
  16.     connString := fmt.Sprintf("server=%s;user id=%s;password=%s;port=%d", server, user, password, port)
  17.  
  18.     db, err := sql.Open("mssql", connString)
  19.     if err != nil {
  20.         log.Fatal("Open connection failed:", err.Error())
  21.     }
  22.     log.Printf("Connected!\n")
  23.     defer db.Close()
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top