Riki Afifuddin
Riki Afifuddin

Reputation: 51

Failed Connect CockroachDB using password include "#"

so I try connect cockroach db using connection string, I have password include # but failed to coonect

here cockroach documentation: https://www.cockroachlabs.com/docs/stable/connection-parameters.html

when I use command below and insert password manually it's working

cockroach sql --url "postgres://[email protected]:26257/sitaxxx?sslmode=verify-full&sslrootcert=E:/ca.crt"

but when include password in connection string it failed to connect

cockroach sql --url "postgres://taperaxxx:#samplepassword#@10.xxx.xx.xx:26257/sitarxxx?sslmode=verify-full&sslrootcert=E:/ca.crt"

here error when execute command with password included

ERROR: cannot load certificates. Check your certificate settings, set --certs-dir, or use --insecure for insecure clusters. problem with CA certificate: not found Failed running "sql"

note: I try connect another cockroach db include password(with no #) in connection string and success.

if this bug or I miss documentation please let me know.

Thanks

Upvotes: 1

Views: 281

Answers (1)

Marc
Marc

Reputation: 21035

# is a special character in URLs and must be encoded.

Use the percent encoding %23 to send an actual #.

Your command line now becomes:

cockroach sql --url "postgres://taperaxxx:%23samplepassword%[email protected]:26257/sitarxxx?sslmode=verify-full&sslrootcert=E:/ca.crt"

Upvotes: 1

Related Questions