org.postgresql.util.PSQLException: FATAL: database "<<database_name>>" does not exist, in the AWS java lambda

org postgresql util psqlexception fatal: database example does not exist
org postgresql util psqlexception error: relation does not exist
fatal: database does not exist
org postgresql util psqlexception fatal database demo does not exist
postgres create database
qgis fatal database does not exist
psycopg2 operationalerror: fatal: database does not exist
pg_dump database does not exist

I am facing the error, org.postgresql.util.PSQLException: FATAL: database "" does not exist

Java code is deployed in AWS lambda to get connect the postgres database running in RDS.

Code

String jdbcUrl = "jdbc:postgresql://database-1.cfgz85wxhk0z.eu-west-1.rds.amazonaws.com:5432/postgres";

Connection connection = null;
try {
    connection = DriverManager.getConnection(jdbcUrl, "database_name", "Password");
    Statement st = connection.createStatement();
    st.execute("select * from <schema>.employee;");
} catch (SQLException e) {
    e.printStackTrace();
} catch(Exception e) {
    e.printStackTrace();
}

Strange as it sounds, that would indicated that there is no database called postgres in that database cluster.

Replace the last part of your JDBC URL with an existing database.

postgresql jdbc: FATAL: database does not exist, AM org.postgresql.Driver connect SEVERE: Connection error: org.postgresql.​util.PSQLException: FATAL: database "localhost:5432/deliverp" does not exist at​  org.postgresql.util.PSQLException: FATAL: sorry, too many clients already. Summary: You opened up more than the allowed limit of connections to the database. You ran something like this: Connection conn = myconn.Open(); inside of a loop, and forgot to run conn.close();. Just because your class is destroyed and garbage collected does not release

You should check that your Lambda function is configured to be connected to the same VPC of your RDS instance. Otherwise, they will not be able to communicate.

The official documentation provides more details as well as some tutorials/examples. You can also configure it manually in the AWS Lambda console (in the Configuration pane, under Network, near the bottom of the page). Finally, AWS has a knowledge base entry on how do I connect a Lambda function to a dedicated VPC?

Similar problem PSQLException: FATAL: database "i2b2" does not , Similar problem PSQLException: FATAL: database "i2b2" does not exist. Showing 1-2 of 2 db.url=jdbc:postgresql://localhost:5432/i2b2?searchpath=​i2b2demodata. db.project=demo org.postgresql.util.PSQLException:  Can't reach database server or port. SQLState - 08001 org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are

https://www.reddit.com/r/aws/comments/a75gfw/database_does_not_exist_when_connecting_to/ Followed some suggestions from the above link. Issue resolved

Fatal database "xxx" does not exist? · Issue #511 · PostgresApp , But I get the below error when I am trying to login for the first time, org.postgresql.​util.PSQLException: FATAL: database "config_ka" does not  Allow username and password based authentication from your application by appling 'trust' as the authentication method for the Bitbucket database user. You can do this by modifying the pg_hba.conf file.

FATAL: database "dave" does not exist · Issue #139 · PostgresApp , using the "psql" menu item (OSX 10.8.4) I get Last login: Sat Oct 19 07:59:28 on ttys009 /Applications/Postgres.app/Contents/MacOS/bin/psql  In response to. Re: getting the ranks out of items with SHARED at 2005-07-12 22:03:03 from Tom Lane; Responses. Re: postgresql SSL off at 2005-07-12 22:52:21 from Joshua D. Drake

Fatal: Database does not exist, Hi, I get the error "FATAL: Database "xxx" does not exist" when trying to connect to the database using JDBC. The superuser "postgres" owns  psql: FATAL: database “<user>” does not exist 3 Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] for XAMPP and Eclipse IDE

'FATAL: database "null" does not exist ' when , I try to make a connection to the database I get an error, usually this one. org.​postgresql.util.PSQLException: FATAL: database "null" does not  Firewall rules in Azure Database for PostgreSQL - Single Server. 01/15/2020; 4 minutes to read; In this article. Azure Database for PostgreSQL server firewall prevents all access to your database server until you specify which computers have permission. The firewall grants access to the server based on the originating IP address of each request.

Comments
  • Are you able to test the connection using something like DBeaver?
  • No I haven't checked it. What is DBeaver?
  • @Villat, Downloaded the DBeaver tool. Cool its nice tool. Thanks!
  • I have changed it to my database its working. No Idea why it didn't work previously
  • The error message means that the connection to PostgreSQL was successful.
  • Yes, I did all the configurations as you suggested before this error.
  • @LaurenzAlbe You are correct, I missed that. Your answer should be the accepted one.