为什么我无法通过 powershell 连接到 cockroachdb?
我使用这个命令:
cockroach sql --url postgres://username@cloud-host:26257/defaultdb?sslmode=require&options=--cluster=clustername;
我收到以下错误:无效的集群名称 08004
但集群名称是正确的。
欧元:
节点
//For secure connection:
// const fs = require('fs');
const { Pool } = require("pg");
// Configure the database connection.
const config = {
user: "xxxxx",
password: "xxxx",
cluster_name: "xxxx",
host: "xxxx",
database: "wxxx",
port: 26257,
ssl: {
rejectUnauthorized: false,
},
//For secure connection:
/*ssl: {
ca: fs.readFileSync('/certs/ca.crt')
.toString()
}*/
};
// Create a connection pool
const pool = new Pool(config);
router.get('/', async (req, res) => {
const client = await pool.connect();
const d = await client.query('CREATE TABLE test (id INT, name VARCHAR, desc VARCHAR);');
console.log(d);
return res.json({
message: 'BOSY'
})
得到这个错误:
CodeParamsRoutingFailed: rejected by BackendConfigFromParams: Invalid cluster name