{"record":{"id":"bd7ebf0396646f31","repo":"googleapis/mcp-toolbox","slug":"sql-open-w-bd7ebf","errorCode":null,"errorMessage":"sql.Open: %w","messagePattern":"sql\\.Open: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/oceanbase/oceanbase.go","lineNumber":176,"sourceCode":"}\n\nfunc initOceanBaseConnectionPool(ctx context.Context, tracer trace.Tracer, name, host, port, user, pass, dbname, queryTimeout string) (*sql.DB, error) {\n\t_, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name)\n\tdefer span.End()\n\n\tdsn := fmt.Sprintf(\"%s:%s@tcp(%s:%s)/%s?parseTime=true\", user, pass, host, port, dbname)\n\n\tif queryTimeout != \"\" {\n\t\ttimeout, err := time.ParseDuration(queryTimeout)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid queryTimeout %q: %w\", queryTimeout, err)\n\t\t}\n\t\tdsn += \"&readTimeout=\" + timeout.String()\n\t}\n\n\tpool, err := sql.Open(\"mysql\", dsn)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"sql.Open: %w\", err)\n\t}\n\treturn pool, nil\n}\n","sourceCodeStart":158,"sourceCodeEnd":180,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/oceanbase/oceanbase.go#L158-L180","documentation":"sql.Open validates the driver name and DSN format without connecting. If the mysql driver is not registered or the DSN is malformed, RunSQL's pool setup fails with this error.","triggerScenarios":"initOceanBaseConnectionPool calls sql.Open(\"mysql\", dsn) and receives an error, typically because the DSN built from host/port/user/pass/dbname is malformed (e.g. special characters in password) or the mysql driver import is missing.","commonSituations":"Passwords containing characters that need URL escaping in the DSN; wrong host/port formatting; build-time issue where the mysql driver was not linked.","solutions":["Check the wrapped DSN error for syntax details","URL-escape special characters in the password (e.g. @ -> %40)","Verify host/port values are non-empty and correctly formatted","Ensure the go-sql-driver/mysql package is imported so the driver registers"],"exampleFix":"// before\npass: p@ssw0rd  # DSN: user:p@ssw0rd@tcp(...) -> invalid\n// after\npass: \"p%40ssw0rd\"  # URL-escaped in DSN","handlingStrategy":"validation","validationCode":"import \"net/url\"\nfunc dsnSafe(pass string) string { return url.QueryEscape(pass) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["URL-escape special characters in password/user fields","Verify host and port are populated before building the DSN","Keep go-sql-driver/mysql imported so the driver registers","Test connection pool creation in a startup smoke test"],"tags":["database","dsn","connection-pool","oceanbase"],"backgroundTag":"invalid-dsn","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}