LibPQ.jl icon indicating copy to clipboard operation
LibPQ.jl copied to clipboard

sslmode = require issue

Open vacquah opened this issue 4 years ago • 7 comments

hello - I need to set sslmode = require in my LibPQ.Connection to connect to a cloud postgresdb. I cant connect because it seems this option is not available on the connection parameters that can be set?

vacquah avatar Apr 22 '20 12:04 vacquah

"sslmode=require" should work in the DSN.

iamed2 avatar Apr 22 '20 14:04 iamed2

the connection itself works ( with sslmode = require ) , but it crashes when I try to do a simple execute statement to pull data result = execute(conn, "SELECT * FROM mytable limit 10").

I had the same problem when using mysql.jl and it turned out it was an issue with how the sslmode was set in the package. it has been fixed now. I am seeing the same issue here. I am able to connect to the postgres db with a regular db desktop client using the same credentials. But i get the error message below when i try to run the excute statement above. I got in touch with timescale ( my cloud provider for the postgres db ) and they say its not a license issue ( since I am able to connect ok normally). Not sure how to proceed.

InternalError: ERROR:  invalid value for timescaledb.license_key 'Exxx='
Stacktrace:
 [1] error(::Memento.Logger, ::LibPQ.Errors.PQResultError{LibPQ.Errors.CXX,LibPQ.Errors.EXX000}) at C:\Users\vacqu\.juliapro\JuliaPro_v1.4.0-1\packages\Memento\kUo0a\src\loggers.jl:454
 [2] handle_result(::LibPQ.Result; throw_error::Bool) at C:\Users\vacqu\.juliapro\JuliaPro_v1.4.0-1\packages\LibPQ\QljsB\src\results.jl:228
 [3] execute(::LibPQ.Connection, ::String; throw_error::Bool, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\vacqu\.juliapro\JuliaPro_v1.4.0-1\packages\LibPQ\QljsB\src\results.jl:280
 [4] execute(::LibPQ.Connection, ::String) at C:\Users\vacqu\.juliapro\JuliaPro_v1.4.0-1\packages\LibPQ\QljsB\src\results.jl:276
 [5] top-level scope at In[20]:9

vacquah avatar Apr 22 '20 14:04 vacquah

Can you give me your full DSN (with any important details anonymized)?

iamed2 avatar Apr 22 '20 14:04 iamed2

you mean this ?

conn = LibPQ.Connection(" host = myhost
                     user = xx
                     port = 12345
                     sslmode = require
                     dbname = defaultdb
                     password = xxxx ")

vacquah avatar Apr 22 '20 14:04 vacquah

without the execute statement, I get this:

PostgreSQL connection (CONNECTION_OK) with parameters:
  user = xx
  password = ********************
  dbname = defaultdb
  host = xxxxx
  port = 12345
  client_encoding = UTF8
  options = -c DateStyle=ISO,YMD -c IntervalStyle=iso_8601 -c TimeZone=UTC
  application_name = LibPQ.jl
  sslmode = require
  sslcompression = 0
  gssencmode = disable
  krbsrvname = postgres
  target_session_attrs = any

vacquah avatar Apr 22 '20 14:04 vacquah

Yes thanks. I'll look to see if there are any important compatibility issues around PostgreSQL in the timescaledb docs.

iamed2 avatar Apr 22 '20 14:04 iamed2

much appreciated. thank you. I can also connect you with the timescale devs

vacquah avatar Apr 22 '20 14:04 vacquah