1

I have an instance in a private subnet in an Amazon VPC. This instance uses a NAT to access the Internet.

I use the Redshift JDBC driver to connect to a cluster hosted in the same region as my VPC (us-east-1).

The DriverManager.getConnection(); works and returns a connection. This should mean that the authentication succeeded. But when I execute the SQL Query via this code, the app hangs indefinitely without any error or success message:

Statement statement = connection.prepareStatement("SELECT * FROM users");
ResultSet result = statement.executeQuery();

Why ?

Some details:

  • I have tried outside the VPC and it works.
  • I changed the DNS resolution servers in the instances (NAT and private instance)
  • The same code locally on my machine works fine.
  • The query is visible in Redshift and is aborted after 14 minutes.
  • The same query takes 9 seconds when it is executed from my machine.
  • I could not find any specific error in the logs of the instances.
1

Have you tried using the postgresql client from your VPC instance? I had the same issue and it was the security group applied to my instance.

2
  • 1
    Yes and the problem remained. We finally reached the AWS support team and the problem came from the MTU fixed for the network interface too high Dec 5 '13 at 8:09
  • Fscking MTU problems. Thanks for pointing this out, saved me a ton of trouble. I was using psql from the command line on an AWS m3.
    – dmourati
    May 21 '14 at 22:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.