Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connectionAttributes not unescaped #1463

Closed
zhangyangyu opened this issue Jul 19, 2023 · 0 comments · Fixed by #1470
Closed

connectionAttributes not unescaped #1463

zhangyangyu opened this issue Jul 19, 2023 · 0 comments · Fixed by #1470

Comments

@zhangyangyu
Copy link
Contributor

Issue description

Recently, connectionAttributes is supported! Currently, the value is used directly which means some special characters may lead to error, for example / which is special for this driver. If we pass %2f then it is not unescaped.

MySQL Connector/J uses a same configuration style as us. Its url parser is complex but seems finally it just decodes the whole value.

Example code

db, err := sql.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s:4000)/test?tls=tidb&connectionAttributes=program_name:pingcap/serverless-test", user, password, host))

Error log

failed to connect databaseinvalid DSN: did you forget to escape a param value?

Configuration

Driver version (or git SHA):

Go version: run go version in your console

Server version: E.g. MySQL 5.6, MariaDB 10.0.20

Server OS: E.g. Debian 8.1 (Jessie), Windows 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant