Skip to content

Commit

Permalink
ADD comment for go-sql-driver lib DNS
Browse files Browse the repository at this point in the history
ADD comment for go-sql-driver lib DNS
  • Loading branch information
karminski committed Feb 5, 2024
1 parent f235636 commit e066836
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/actionruntime/mysql/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ func (m *MySQLConnector) getConnectionWithOptions(resourceOptions map[string]int
}

func (m *MySQLConnector) connectPure() (db *sql.DB, err error) {
// escapedPassword := url.QueryEscape(m.Resource.DatabasePassword)
// @NOTE: the go-sql-driver lib does NOT need escape the password in DSN
// refer: https://github.com/go-sql-driver/mysql?tab=readme-ov-file#password
dsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s", m.Resource.DatabaseUsername,
m.Resource.DatabasePassword, m.Resource.Host, m.Resource.Port, m.Resource.DatabaseName)
db, err = sql.Open("mysql", dsn+"?timeout=30s")
Expand All @@ -58,7 +59,8 @@ func (m *MySQLConnector) connectPure() (db *sql.DB, err error) {
}

func (m *MySQLConnector) connectViaSSL() (db *sql.DB, err error) {
// escapedPassword := url.QueryEscape(m.Resource.DatabasePassword)
// @NOTE: the go-sql-driver lib does NOT need escape the password in DSN
// refer: https://github.com/go-sql-driver/mysql?tab=readme-ov-file#password
dsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s", m.Resource.DatabaseUsername,
m.Resource.DatabasePassword, m.Resource.Host, m.Resource.Port, m.Resource.DatabaseName)
pool := x509.NewCertPool()
Expand Down

0 comments on commit e066836

Please sign in to comment.