无法通过JDBC连接从AWS Glue连接到Heroku Postgres数据库

时间:2019-03-10 18:03:12

标签: postgresql heroku jdbc aws-glue heroku-postgres

我正在尝试从AWS Glue连接到我的Heroku Postgres数据库,但是在测试连接时收到以下错误消息:

2019-03-10 17:48:23 INFO CatalogClient:651 - Got connection 'my-connection' info from Catalog with url: jdbc:postgresql://ec2-3-208-14-216.compute-1.amazonaws.com:5432/my_database?ssl=true&sslmode=require
2019-03-10 17:48:23 INFO CatalogClient:684 - JDBC configuration for connection my-connection: JDBCConfiguration(url=jdbc:postgresql://ec2-3-208-14-216.compute-1.amazonaws.com:5432/my_database?ssl=true&sslmode=require, hostname=ec2-3-208-14-216.compute-1.amazonaws.com, port=5432, databaseVendor=postgresql, databaseVersion=null, connectionName=my-connection, path=my_database?ssl=true&sslmode=require, subnetId=my-subnet, availabilityZone=us-east-1a, securityGroups=[my-security-group], enforceSSL=true)
2019-03-10 17:48:23 INFO JdbcConnection:42 - Starting connecter. driver org.postgresql.Driver@3b0c9195
2019-03-10 17:48:23 INFO JdbcConnection:60 - Attempting to connect with SSL host matching: jdbc:postgresql://ec2-3-208-14-216.compute-1.amazonaws.com:5432/my_database?ssl=true&sslmode=require
Check that your connection definition references your JDBC database with correct URL syntax, username, and password. Full SSL connection to data store using host matching failed.

我通过AWS CLI使用以下参数创建了连接(为了安全起见,此处更改了实际的数据库名称,凭证等):

{
  "ConnectionInput": {
    "Name": "my-connection",
    "Description": "test heroku postgres connection",
    "ConnectionType": "JDBC",
    "ConnectionProperties": {
        "USERNAME": "myusername",
        "PASSWORD": "mypassword",
        "JDBC_DRIVER_JAR_URI": "s3://my-glue-bucket/postgresql-42.2.1.jre7.jar",
        "JDBC_DRIVER_CLASS_NAME": "org.postgresql.Driver",
        "JDBC_CONNECTION_URL": "jdbc:postgresql://ec2-3-208-14-216.compute-1.amazonaws.com:5432/my_database?ssl=true&sslmode=require"
    },
    "PhysicalConnectionRequirements": {
        "SubnetId": "my-subnet",
        "SecurityGroupIdList": [
            "my-securtity-group"
        ],
        "AvailabilityZone": "us-east-1a"
    }
  }
}

由于Heroku需要版本42.2.1或更高版本,因此我提供了自己的postgresql JDBC驱动程序。我尝试使用和不使用网址参数ssl=true&sslmode=require进行连接,但仍然得到相同的结果。任何见识将不胜感激。谢谢

0 个答案:

没有答案