DataGrip won't connect to AWS RDS (PostgreSQL) but psql works fine

Having some trouble getting DataGrip to connect on a fresh Mac install. The database is an AWS RDS PostgreSQL database.

With the same details used and defaults otherwise, DataGrip won't connect but the CLI tool, psql, works fine.

After some time I get the following stacktrace:

2018-10-19 11:15:21,978 [ 335318] WARN - lij.database.util.ErrorHandler - java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
  java.net.ConnectException: Connection refused (Connection refused)
java.lang.RuntimeException: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
  java.net.ConnectException: Connection refused (Connection refused)
  at com.intellij.util.ExceptionUtil.rethrow(ExceptionUtil.java:160)
  at com.intellij.util.ExceptionUtil.rethrowAllAsUnchecked(ExceptionUtil.java:166)
  at com.intellij.database.dataSource.DatabaseConnectionManager$Executor.createInner(DatabaseConnectionManager.java:371)
  at com.intellij.database.dataSource.DatabaseConnectionManager$Executor.lambda$sync$2(DatabaseConnectionManager.java:325)
  at com.intellij.database.dataSource.AsyncUtil.withAsyncFriendly(AsyncUtil.java:161)
  at com.intellij.database.dataSource.DatabaseConnectionManager$Executor.sync(DatabaseConnectionManager.java:322)
  at com.intellij.database.dataSource.DatabaseConnectionManager$Builder.sync(DatabaseConnectionManager.java:139)
  at com.intellij.database.dataSource.DataSourceSyncManager.lambda$static$1(DataSourceSyncManager.java:43)
  at com.intellij.database.dataSource.DataSourceSyncManager$SyncProcessor$1.perform(DataSourceSyncManager.java:271)
  at com.intellij.database.dataSource.DatabaseModelLoader$IntrospectionSession.updateDatabaseInfo(DatabaseModelLoader.java:314)
  at com.intellij.database.dataSource.DatabaseModelLoader$IntrospectionSession.run(DatabaseModelLoader.java:297)
  at com.intellij.database.dataSource.DataSourceSyncManager$SyncProcessor.performSync(DataSourceSyncManager.java:273)
  at com.intellij.database.dataSource.AsyncUtil.lambda$null$6(AsyncUtil.java:58)
  at com.intellij.database.dataSource.AsyncUtil.lambda$underProgress$14(AsyncUtil.java:130)
  at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:580)
  at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
  at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
  at com.intellij.database.dataSource.AsyncUtil.underProgress(AsyncUtil.java:136)
  at com.intellij.database.dataSource.AsyncUtil.underProgress(AsyncUtil.java:130)
  at com.intellij.database.dataSource.AsyncUtil.lambda$captureIndicator$7(AsyncUtil.java:58)
  at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
  at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)
 
Not sure why it's trying to connect to 127.0.0.1? This isn't what the hostname is set to. I tried using the DB's IP address unless there was some weird DNS issues but it still has the same problem.
 
Any ideas would be appreciated.

Please sign in to leave a comment.