且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

java.net.ConnectException:连接被拒绝(连接被拒绝)

更新时间:2021-06-29 08:37:26

解决方案:

需要使用System.getProperty而不是System.getenv.

    String host = System.getProperty("RDS_HOSTNAME");
    String port = System.getProperty("RDS_PORT");
    String username = System.getProperty("RDS_USERNAME");
    String password = System.getProperty("RDS_PASSWORD");
    String dbname = System.getProperty("RDS_DB_NAME");

Java服务现在连接到数据库.

The Java service now connects to the database.