can not load certificate

Hello,

I want to connect to the database with cmd.

I used this connection string but I got this 2 errors:

  1. Can not load ceritifacte are you sure it is in correct folder
  2. The Command “sslrootcert” is either misspelled

What I am do wrong ?

cockroach sql --url=postgres://username:password@cloud-host:26257/cluster-data.defaultdb?sslmode=verify-full&sslrootcert=C:\Users\thomas\Desktop\cockroach-v21.1.2.windows-6.2-amd64/cc-ca.crt

To fix error #1, I would make sure that the certificate file is at the same path that you specified in the “url” argument.

To fix error #2, can you try quoting or escaping the URL string? I think it’s interpreting the & as a special character so it thinks that sslrootcert=C:\Users\thomas\Desktop\cockroach-v21.1.2.windows-6.2-amd64/cc-ca.crt is its own command. Try:

cockroach sql "--url=postgres://username:password@cloud-host:26257/cluster-data.defaultdb?sslmode=verify-full&sslrootcert=C:\Users\thomas\Desktop\cockroach-v21.1.2.windows-6.2-amd64/cc-ca.crt"