Open bandaja opened 4 years ago
Anything in the logs with more details on the exception?
2020-09-06 19:52:30.200+0000 WARN [o.n.k.i.c.VmPauseMonitorComponent] Detected VM stop-the-world pause: {pauseTime=108, gcTime=0, gcCount=0}
2020-09-06 19:56:09.090+0000 ERROR [o.n.k.a.p.GlobalProcedures] Cannot execute SQL statement SELECT name FROM bandaja.state
.
Error:
An error occurred while setting up the GSS Encoded connection. An error occurred while setting up the GSS Encoded connection.
org.postgresql.util.PSQLException: An error occurred while setting up the GSS Encoded connection.
at org.postgresql.core.v3.ConnectionFactoryImpl.enableGSSEncrypted(ConnectionFactoryImpl.java:480)
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:144)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:213)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51)
at org.postgresql.jdbc.PgConnection.
Maybe https://www.ibm.com/support/pages/ibm-datastage-jdbc-connector-test-connection-fails-orgpostgresqlutilpsqlexception helps? So please try
CALL apoc.load.jdbc('jdbc:postgresql://localhost:7474/mock?user=XXXX&password=XXXX&gssEncMode=disable', 'SELECT name FROM XXXX.state') YIELD row
CREATE (n:States {name:row.name})
Thanks, I tried..
As per Sarmbruster suggestion: Answer If encryption is not configured, should be disabled by setting JDBC connection parameter gssEncMode=disable.
Base on the information from this document, I can see the encryption is not configured in my Postgresql database:
PostgreSQL GSSAPI Authentication with Kerberos part-3: the status of authentication, encryption and user principal https://www.highgo.ca/2020/03/30/postgresql-gssapi-authentication-with-kerberos-part-3-the-status-of-authentication-encryption-and-user-principal/
Both authentication and encryption are enabled when the host-based authentication is configured with hostgssenc and gss in ph_hba.conf: .# TYPE DATABASE USER ADDRESS METHOD .# "local" is for Unix domain socket connections only local all all peer .# IPv4 local connections: host all all 127.0.0.1/32 md5 .# IPv6 local connections: host all all ::1/128 md5 .# Allow replication connections from localhost, by a user with the .# replication privilege. local replication all peer host replication all 127.0.0.1/32 md5 host replication all ::1/128 md5 host all all 35.235.240.0/20 md5
From the result of this query, we can see this connection is NOT encrypted: mock=# SELECT pid, gss_authenticated, encrypted, principal from pg_stat_gssapi where pid = pg_backend_pid(); pid | gss_authenticated | encrypted | principal --------+--------------------------+---------------+----------- 9971 | f | f | (1 row)
The document also suggest, You can also achieve the same result by setting the environment PGGSSENCMODE=disable from the client side.
No sure, how to set the environment PGGSSENCMODE=disable, in other words, how to manually disable gssenc mode.
I tried... CALL apoc.load.jdbc('jdbc:postgresql://localhost:7474/mock?PGGSSENCMODE=disable?user=bandaja&password=bandaja', 'SELECT name FROM bandaja.state') YIELD row CREATE (n:States {name:row.name})
But, still the same error..
Failed to invoke procedure apoc.load.jdbc
: Caused by: org.postgresql.util.PSQLException: An error occurred while setting up the GSS Encoded connection.
Then I tried… CALL apoc.load.jdbc('jdbc:postgresql://localhost:7474/mock?user=bandaja&password=bandaja?PGGSSENCMODE=disable', 'SELECT name FROM bandaja.state) YIELD row CREATE (n:States {name:row.name})
Then, I have a different error…
Unexpected end of input: expected '\', ANY or ''' (line 2, column 34 (offset: 188)) "CREATE (n:States {name:row.name})"
My question, can I use the environmental PGGSSENCMODE=disable from the procedure (apoc.load.jdbc)?
So you basically want to have PGGSSENCMODE=disable
as environment variable being set when Neo4j starts up, right?
I've checked the startup scripts on Neo4j 4.1.1 for Linux - they export any setting from conf/neo4j.conf
as environment variable. Therefore it should be good enough to amend PGGSSENCMODE=disable
to conf/neo4j.conf
and you should be good.
Not sure if we have the same behaviour for the Windows startup scripts - please check this yourself.
I'm not aware of a way to modify environment variables from with a running JVM - you have to set it from the outside.
Sarmbruster, I tried but same error. Steps:
apoc.load.jdbc
: Caused by: org.postgresql.util.PSQLException: An error occurred while setting up the GSS Encoded connection.Any other idea?
Francisco Javier Banda
Error in the $NEO4J_HOME\logs\neo4j file.
2020-09-08 18:12:15.987+0000 ERROR Cannot execute SQL statement SELECT name FROM bandaja.state
.
Error:
An error occurred while setting up the GSS Encoded connection. An error occurred while setting up the GSS Encoded connection.
org.postgresql.util.PSQLException: An error occurred while setting up the GSS Encoded connection.
at org.postgresql.core.v3.ConnectionFactoryImpl.enableGSSEncrypted(ConnectionFactoryImpl.java:480)
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:144)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:213)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51)
at org.postgresql.jdbc.PgConnection.
My answer above just validated that the linux start script exposes all config settings as env variables. Not sure about the windows start script. Alternatively you might also set a global env variable PGGSSENCMODE=disable
- refer to your OS docs on how to do that.
Steps (Mandatory)
Download the JDBC for postgresql: https://jdbc.postgresql.org/ --> postgresql-42.2.16
Download the APOC Full JAR from: https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/tag/4.1.0.2 --> apoc-4.1.0.2-all
Put "apoc-4.1.0.2-all " and JDBC Driver into my "plugins": $NEO4J_HOME\plugins\
Restart the services.
run the query: CALL apoc.load.jdbc('jdbc:postgresql://localhost:7474/mock?user=XXXX&password=XXXX', 'SELECT name FROM XXXX.state') YIELD row CREATE (n:States {name:row.name})
I got the error message: Failed to invoke procedure
apoc.load.jdbc
: Caused by: org.postgresql.util.PSQLException: An error occurred while setting up the GSS Encoded connection.Specifications (Mandatory) Versions:
Neo4j: version: 4.1.1
Postgresql: Ver 12.3
OS: win10 64
Apoc: 4.1.0.2
Regards, Francisco Javier Banda