Browse Source

修改连接方法

master v0.4.0
guzeng 3 years ago
parent
commit
f0254c8655
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      sqlserver.go

+ 1
- 1
sqlserver.go View File

@ -21,7 +21,6 @@ func MSConnect(DBHOST, DBUSER, DBPWD, DBNAME, DBPORT string, conns ...int) error
if DBHOST != "" && DBUSER != "" && DBPWD != "" && DBPORT != "" { //&& DBNAME != "" if DBHOST != "" && DBUSER != "" && DBPWD != "" && DBPORT != "" { //&& DBNAME != ""
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
time.Sleep(time.Second * 5)
//连接字符串 //连接字符串
@ -35,6 +34,7 @@ func MSConnect(DBHOST, DBUSER, DBPWD, DBNAME, DBPORT string, conns ...int) error
if dbConnErr != nil { if dbConnErr != nil {
log.Println("ERROR", "can not connect to Database, ", dbConnErr) log.Println("ERROR", "can not connect to Database, ", dbConnErr)
time.Sleep(time.Second * 5)
} else { } else {
log.Println("msdb connected") log.Println("msdb connected")


Loading…
Cancel
Save