在数据源配置中没有找到对应的连接选项
以下是推荐的连接代码
const fs = require('fs');
const pg = require('pg');
const url = require('url');
const config = {
user: "xxxx01",
password: "xxxx01",
host: "pg-xxxx01.j.aivencloud.com",
port: 25804,
database: "defaultdb",
ssl: {
rejectUnauthorized: true,
ca: `-----BEGIN CERTIFICATE-----
xxxx01TCCAqmgAwIBAgIUYidVdMxxxx01xxxx01
-----END CERTIFICATE-----`,
},
};
const client = new pg.Client(config);
client.connect(function (err) {
if (err)
throw err;
client.query("SELECT VERSION()", [], function (err, result) {
if (err)
throw err;
console.log(result.rows[0].version);
client.end(function (err) {
if (err)
throw err;
});
});
});