java - org.postgresql.util.PSQLException:致命:数据库“<>" 不存在,在 AWS java lambda 中
问题描述
我面临错误,org.postgresql.util.PSQLException: FATAL: database "" does not exist
Java 代码部署在 AWS lambda 中以连接在 RDS 中运行的 postgres 数据库。
代码
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();
}
解决方案
听起来很奇怪,这表明该postgres
数据库集群中没有调用数据库。
将 JDBC URL 的最后一部分替换为现有数据库。
推荐阅读
- selenium - 在树莓派中设置 instapy 的问题
- java - 当我通过 JUnit 和 Mockito 测试 Web 应用程序时,Log4j2 出现很多错误
- java - 无法将 java.util.Date 字段 ru.sfedu.diplomabackend.model.User.created 设置为 ru.sfedu.diplomabackend.model.User
- php - Foreach 只返回数组的第一个值
- r - R中的VLOOKUP或类似的东西
- firebase - Firebase 托管的动态 X 框架选项
- asp.net-core-mvc - ASP.NET Core 5 MVC - 基于设置的动态视图内容
- kotlin - 如何正确取消 CoroutineWorker
- mysql - 下拉输入不产生任何输出 - 闪亮
- python - 为什么openpyxl单元格字体大小不返回?