la44578
la44578

Reputation: 1

Using cockroachdb / postgresql in an iOS swift app

I'm trying to connect to a cockroachdb instance from within an iOS app being developed on Xcode. I am using the PostgresClientKit. I get an error saying:

localizedSeverity: Fatal
code: 0C800
message: codeProxyRefusedConnection: connection refused 

Has anyone used this library or any other to successfully pull data from cockroach into an iOS app?

I tried the following code:

import PostgresClientKit

var configuration = PostgresClientKit.ConnectionConfiguration()
configuration.host = “host.cockroachlabs.cloud"
configuration.database = “server.table”
configuration.user = “username”
configuration.port = 12345
configuration.credential = .scramSHA256(password: “pass”)
let connection = try PostgresClientKit.Connection(configuration: configuration)

I was expecting it to connect successfully.

Upvotes: 0

Views: 119

Answers (1)

alyshan
alyshan

Reputation: 176

I think you need to specify the host parameter correctly. Where did you get host.cockroachlabs.cloud from?

You should see the hostname for connecting to your CRDB cluster from the connect modal in the cluster overview page.

For example it could look something like this: klutzy-ent-6246.g8z.cockroachlabs.cloud

connect modal for my serverless cluster

Upvotes: 0

Related Questions