cancel
Showing results for 
Search instead for 
Did you mean: 

Import date from postgresql to neo4j

Scorpion21
Node

I am trying to import data from my local PostgreSQL database to neo4j:

Database:graph-test

Schema: os

Table: operating_systems

Firstly, I load the JDBC driver into the memory

CALL apoc.load.driver("org.postgresql.Driver")

Then, I run this query to ingest data from postgresql

   WITH "jdbc:postgresql://localhost:5432/graph-test?user=kt&password=mypassword" as url
   CALL apoc.load.jdbc(url,"os.operating_systems") YIELD row AS line
   MERGE (o:Os {name: line.name})
   MERGE (of:OsFamily {name: line.familly})
   MERGE (o)-[:FROM]->(of)

Unfortunately, I received this error.

Failed to invoke procedure `apoc.load.jdbc`: Caused by: java.net.ConnectException: Connection refused (Connection refused)

Could this error be caused by the incorrect URL format, jdbc plugin version, or something else?

1 REPLY 1

Can you access postgres with the same connection URL from other JDBC based tools?

Looks ok to me at first glance. If both databases run on your localhost (not docker or so) you might also try putting in 127.0.0.1 or your local ip address. Not sure if postgres blocks access on "localhost" by default and only allows unix-domain-socket access.

https://neo4j.com/labs/apoc/4.1/database-integration/load-jdbc/#_load_jdbc_resources