Skip to content

Failed to get driver instance for jdbcUrl=jdbc:postgresql:/// error for CloudSQL

I am trying to connect to my GCP projects PostgreSQL CloudSQL instance from my local machine. The PostgreSQL doesn’t have a public IP, only private.

    Properties connProps = new Properties();
    connProps.setProperty("user", "");
    connProps.setProperty("password", "password");
    connProps.setProperty("sslmode", "disable");
    connProps.setProperty("socketFactory", "");
    connProps.setProperty("cloudSqlInstance", "coral-XXX-XXXX:us-central1:mdm");
    connProps.setProperty("enableIamAuth", "true");

    HikariConfig config = new HikariConfig();
    config.setConnectionTimeout(10000); // 10s

    HikariDataSource connectionPool = new HikariDataSource(config);

I get the below error

Failed to get driver instance for jdbcUrl=jdbc:postgresql:///mdm

java.sql.SQLException: No suitable driver

I have verified that my username, instancename, IAM connectivity is all working fine. The IAM service account I am using is my compute engine’s default service account.

Should I be able to connect to this PostgreSQL instance from my local machine?



First, make sure you’re configuring your JDBC URL correctly.

The URL should look like this:


See the docs for details.

Second, if your Cloud SQL instance is Private IP only, your local machine won’t have a network path to it, unless you’ve explicitly configured one (see this answer for options).

Generally, the simplest way to connect to a private IP instance is to run a VM in the same VPC as the instance, and connect from that VM.