Open guruatmicrosoft opened 7 years ago
@guruattimeinc Yeah that's something that not currently supported, there's no way to pass in those parameters. The underlying node module(https://github.com/brianc/node-postgres) I'm using handles the actual connection to the database and it looks for specific options which are specified here(https://github.com/brianc/node-pg-pool#create)
Just out of curiosity where are you trying to connect? Because that doesn't look like any redshift connection in javascript i've ever seen.
This is redshift DB, we have turned SSL settings. Is there a way i can setup connection with JDBC connection string? At the moment i am passing these params as part of connection string in SQL workbench.
- Thanks
@guruattimeinc Oh I see, you're using JDBC with SQL workbench. There are {ssl: true, and keepAlive: true} properties you can pass into the configuration, but there's no way to to pass the sslfactory parameter. If you try connecting with just those two properties does it work?
I am getting the same error and adding {ssl: true, and keepAlive: true}
does not fix the problem for me.
I got things working with this:
const Redshift = require('node-redshift');
const fs = require('fs');
const client = {
user: 'me',
database: 'minez',
password: 'secret',
port: '1234',
host: 'nunya',
ssl: true,
};
const options = {
ssl: {
isServer: false,
rejectUnauthorized: true,
requestCertifiate: true,
cert: fs.readFileSync("./cert.crt").toString(),
},
rawConnection: true,
};
const redshiftClient = new Redshift(client, options);
This is redshift DB, we have turned SSL settings. Is there a way i can setup connection with JDBC connection string? At the moment i am passing these params as part of connection string in SQL workbench.
Thanks
I am also connecting to redshift using a JDBC connection string on SQL Workbench/J , even we pass the ?ssl=true&sslfactory values in the JDBC connection string.
I was able to connect to this redshift and query it while using the following code
const Redshift = require('node-redshift')
/** Set ssl : true **/
const client = {
user : USER_NAME,
database : DB_NAME,
password : PASSWORD,
port : '5439',
host: HOST_URI,
ssl : true
}
const redshiftClient = new Redshift(client, {rawConnection : true})
The above code worked for me with ssl : true, without specifying this I was getting this error "no pg_hba.conf entry for host"
Hope this helps anyone
Couldnt see a place to put this request, it may not be an issue but rather feature ask.
I need to pass following options to my connection - ?tcpKeepAlive=true&ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory
Most of the code and document reference option as {rawConnection: true}, is there a way i can include above?
- Thanks