2

I develop app on GAE using Kotlin, Ktor. Database is CloudSQL. For connect to it use Exposed library

Database.connect(
            "jdbc:postgresql://cloudsql/<project-id>:<zone-name>:<instance-name>",
            driver="org.postgresql.Driver",
            user="postgres",
            password="********"
        )

But I get error:

org.postgresql.core.v3.ConnectionFactoryImpl log: IOException occurred while connecting to cloudsql:5432 (ConnectionFactoryImpl.java:317) java.net.UnknownHostException: cloudsql

.......

I try change url on:

    jdbc:postgresql://google/<project-id>:<zone-name>:<instance-name>
    jdbc:postgresql://cloudsql/<project-id>:<zone-name>:<instance-name>/.s.PGSQL.5432

But also can this error.

Error is geted both on local and server

1 Answers1

2

I resolve my issue. Url should be like:

jdbc:postgresql://<public_ip>/postgres