adding mssqldb import in sqlusergo to see if it makes a difference
@@ -11,6 +11,7 @@ import (
"fmt"
"strings"
+ _ "github.com/denisenkom/go-mssqldb"
"github.com/go-logr/logr"
"github.com/prometheus/common/log"
)
@@ -29,7 +30,7 @@ type AzureSqlUserManager struct {
func (m *AzureSqlUserManager) ConnectToSqlDb(ctx context.Context, drivername string, server string, database string, port int, user string, password string) (*sql.DB, error) {
fullServerAddress := fmt.Sprintf("%s.database.windows.net", server)
- connString := fmt.Sprintf("server=%s;user id=%s;password=%s;port=%d;Initial Catalog=%s;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30", fullServerAddress, user, password, port, database)
+ connString := fmt.Sprintf("server=%s;user id=%s;password=%s;port=%d;database=%s;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30", fullServerAddress, user, password, port, database)
m.Log.Info("ConnectToSqlDb:", "conn string:", connString)
db, err := sql.Open(drivername, connString)
@@ -38,7 +39,7 @@ func (m *AzureSqlUserManager) ConnectToSqlDb(ctx context.Context, drivername str
return db, err
}
- err = db.Ping()
+ err = db.PingContext(ctx)
if err != nil {
m.Log.Info("ConnectToSqlDb", "error from db.Ping is:", err.Error())
return db, err
