# Neo4j Connection Issues

**URL:** <https://community.neo4j.com/t/neo4j-connection-issues/15040>\
**Category:** Drivers & Stacks\
**Tags:** connection, cypher\
**Created:** [February 25, 2020, 12:41am UTC](https://community.neo4j.com/t/neo4j-connection-issues/15040 "2020-02-25T00:41:55Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![caschiffer](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/caschiffer/32/9383_2.png) [@caschiffer](https://community.neo4j.com/u/caschiffer)\
**Post date:** [February 25, 2020, 12:41am UTC](https://community.neo4j.com/t/neo4j-connection-issues/15040/1 "2020-02-25T00:41:55Z")

</div>

Hello,

I have written a python script to execute queries on a remote Neo4j server. However, after updating my version of Neo4j last week I am having a difficult time connecting to the Neo4j database and, consequently, running my queries against it. I've tried bolt based and http based connections but to no avail. I've checked my neo4j.conf file to confirm that it matches my previous version where I could connect.

Below you will find the relevant section of my .conf file and the .log file where database start up and remote interface is successful., can someone help my troubleshoot my connection problems?

# **Neo4j.Log File**

2020-02-25 00:30:54.128+0000 INFO ======== Neo4j 3.5.14 ========  
2020-02-25 00:30:54.134+0000 INFO Starting...  
2020-02-25 00:30:56.670+0000 INFO Deprecated index providers in use: lucene+native-2.0 (15 indexes). Use procedure 'db.indexes()' to see what indexes use which index provider.  
2020-02-25 00:31:00.778+0000 INFO Bolt enabled on 0.0.0.0:7687.  
2020-02-25 00:31:01.816+0000 INFO Started.  
2020-02-25 00:31:02.849+0000 INFO Remote interface available at http://\<_ **MY IP** _\>:7474/

# **Conf File**

#\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
#Network connector configuration  
#\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

#With default configuration Neo4j only accepts local connections.  
#To accept non-local connections, uncomment this line:  
dbms.connectors.default\_listen\_address=0.0.0.0  
#dbms.connectors.default\_listen\_address=localhost

#You can also choose a specific network interface, and configure a non-default  
#port for each connector, by setting their individual listen\_address.

#The address at which this server can be reached by its clients. This may be the server's IP address or DNS name, or  
#it may be the address of a reverse proxy which sits in front of the server. This setting may be overridden for  
#individual connectors below.  
#dbms.connectors.default\_advertised\_address=localhost  
#dbms.connectors.default\_advertised\_address=0.0.0.0  
dbms.connectors.default\_advertised\_address=\< **MY IP** \>

#You can also choose a specific advertised hostname or IP address, and  
#configure an advertised port for each connector, by setting their  
#individual advertised\_address.

#Bolt connector  
dbms.connector.bolt.enabled=true  
#dbms.connector.bolt.tls\_level=OPTIONAL  
dbms.connector.bolt.listen\_address=:7687

#HTTP Connector. There can be zero or one HTTP connectors.  
dbms.connector.http.enabled=true  
dbms.connector.http.listen\_address=\< **MY IP** \>:7474

#HTTPS Connector. There can be zero or one HTTPS connectors.  
dbms.connector.https.enabled=true  
#dbms.connector.https.listen\_address=:7473

#Number of Neo4j worker threads.  
#dbms.threads.worker\_count=

You can see that I was messing with the local connection in my default\_advertised\_address section.

Thanks for the help!

---

<div class="post-metadata">

**Author:** ![tony.chiboucas](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/tony.chiboucas/32/5980_2.png) [@tony.chiboucas](https://community.neo4j.com/u/tony.chiboucas)\
**Post date:** [February 26, 2020, 4:02pm UTC](https://community.neo4j.com/t/neo4j-connection-issues/15040/2 "2020-02-26T16:02:28Z")

</div>

Looks fine to me.

- How is python connecting?
- To what IP?
- Is it using localhost, or `<my IP>`, and to what connector/port?
- What kind of error are you getting in python?
- Have you tried a debugger, a network profiler, or stepping through the code?
- Is there anything in the Neo4j logs?

---

<div class="post-metadata">

**Author:** ![caschiffer](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/caschiffer/32/9383_2.png) [@caschiffer](https://community.neo4j.com/u/caschiffer)\
**Post date:** [February 26, 2020, 6:20pm UTC](https://community.neo4j.com/t/neo4j-connection-issues/15040/3 "2020-02-26T18:20:03Z")

</div>

In Python I was using the neo4j-connector method. It was working successfully with the local host connection (when I was running my computations on the same server as my hosted Neo4j graph.) However, I want to avoid graph and computation work on the same server to avoid crashing, etc.

When I was attempting to a nonlocalhost based connection I used the following port. IP-wise, we are using a AWS instance based IP address.

neo4j-connector  
import neo4j  
from neo4j import Connector  
from neo4j import Statement  
connector = neo4j.Connector('http:// MY IP :7474', (name, pw))

The error was as connection time out error and I ran into while working through a debugger on VScode and just running program.

Unfortunately, I didn't see anything in the Neo4j logs.

Thanks!

---

<div class="post-metadata">

**Author:** ![tony.chiboucas](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/tony.chiboucas/32/5980_2.png) [@tony.chiboucas](https://community.neo4j.com/u/tony.chiboucas)\
**Post date:** [February 26, 2020, 6:40pm UTC](https://community.neo4j.com/t/neo4j-connection-issues/15040/4 "2020-02-26T18:40:59Z")

</div>

> ... nonlocalhost based connection... using a AWS instance... IP address.
> 
> ```auto
> connector = neo4j.Connector('http:// MY IP :7474', (name, pw))
> 
> ```

You'll need to check a few things:

1. Make sure you're using the right IP in the connector.
2. Check basic connectivity
  - can you go in a browser to `http:// MY IP :7474`, and get to that Neo4j instance?

3. Check the [`neo4j.conf` connector config](https://neo4j.com/docs/operations-manual/current/configuration/connectors/)
  - `dbms.connectors.default_listen_address= MY IP `
  - `dbms.connectors.default_advertised_address= MY IP `

Once you're going from machine to machine, hostnames will simplify networking. A simple temp shortcut is to set `default_advertised_address=anynameyouwant`, then add that as an entry to your `hosts` file: ` MY IP anynameyouwant`. Then you could simply connect to `http://anynameyouwant:7474`.

---

<div class="post-metadata">

**Author:** ![caschiffer](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/caschiffer/32/9383_2.png) [@caschiffer](https://community.neo4j.com/u/caschiffer)\
**Post date:** [February 28, 2020, 8:12pm UTC](https://community.neo4j.com/t/neo4j-connection-issues/15040/5 "2020-02-28T20:12:52Z")

</div>

Hey there, so I changed the values:

- `dbms.connectors.default_listen_address= `
- `dbms.connectors.default_advertised_address= `

to the respective IP address where I my graph db is stored.

Additionally, I verified that I am using the right IP and that my basic connectivity works from the browser. (On the note of the browser, I am able to connect from a browser on another machine and from the machine where the graph db is hosted.)

However, I am still seeing a failure as shown below:

requests.exceptions.ConnectionError: HTTPConnectionPool(host=' MY IP', port=7474): Max retries exceeded with url: /db/data/transaction/commit (Caused by NewConnectionError('\<urllib3.connection.HTTPConnection object at 0x7f60fb350898\>: Failed to establish a new connection: [Errno 110] Connection timed out',)

Will changing the host name work in this case?

---

<div class="post-metadata">

**Author:** ![caschiffer](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/caschiffer/32/9383_2.png) [@caschiffer](https://community.neo4j.com/u/caschiffer)\
**Post date:** [February 28, 2020, 8:48pm UTC](https://community.neo4j.com/t/neo4j-connection-issues/15040/6 "2020-02-28T20:48:15Z")

</div>

Additionally, I tried using the bolt connector to troubleshoot but it failed as well. The error was:

- requests.exceptions.InvalidSchema: No connection adapters were found for 'bolt:// MY IP:7687/

I checked my conf files and my log files again to make sure it was enabled as well and it was according to below.

## Log File

2020-02-28 19:58:57.515+0000 INFO ======== Neo4j 3.5.14 ========  
2020-02-28 19:58:57.531+0000 INFO Starting...  
2020-02-28 19:59:02.946+0000 INFO Deprecated index providers in use: lucene+native-2.0 (15 indexes). Use procedure 'db.indexes()' to see what indexes use which index provider.  
2020-02-28 19:59:11.567+0000 INFO Bolt enabled on :7687.  
2020-02-28 19:59:13.922+0000 INFO Started.  
2020-02-28 19:59:15.934+0000 INFO Remote interface available at http:// :7474/

## Conf File

#With default configuration Neo4j only accepts local connections.  
#To accept non-local connections, uncomment this line:  
#dbms.connectors.default\_listen\_address=0.0.0.0  
dbms.connectors.default\_listen\_address= \< MY IP \>  
#dbms.connectors.default\_listen\_address=localhost

#You can also choose a specific network interface, and configure a non-default  
#port for each connector, by setting their individual listen\_address.

#The address at which this server can be reached by its clients. This may be the server's IP address or DNS name, or  
#it may be the address of a reverse proxy which sits in front of the server. This setting may be overridden for  
#individual connectors below.  
#dbms.connectors.default\_advertised\_address=localhost  
#dbms.connectors.default\_advertised\_address=0.0.0.0  
dbms.connectors.default\_advertised\_address= \< MY IP \>

#You can also choose a specific advertised hostname or IP address, and  
#configure an advertised port for each connector, by setting their  
#individual advertised\_address.

#Bolt connector  
dbms.connector.bolt.enabled=true  
#dbms.connector.bolt.tls\_level=OPTIONAL  
dbms.connector.bolt.listen\_address=:7687

#HTTP Connector. There can be zero or one HTTP connectors.  
dbms.connector.http.enabled=true  
dbms.connector.http.listen\_address=:7474

#HTTPS Connector. There can be zero or one HTTPS connectors.  
dbms.connector.https.enabled=true  
#dbms.connector.https.listen\_address=:7473

---

<div class="post-metadata">

**Author:** ![tony.chiboucas](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/tony.chiboucas/32/5980_2.png) [@tony.chiboucas](https://community.neo4j.com/u/tony.chiboucas)\
**Post date:** [February 28, 2020, 9:58pm UTC](https://community.neo4j.com/t/neo4j-connection-issues/15040/7 "2020-02-28T21:58:41Z")

</div>

I can't see a reason why you wouldn't be able to connect to the Neo4j instance.

> Will changing the host name work in this case?

Using a hostname to connect probably _will not_ solve this issue, but it might be worth a try anyway.

The browser uses those same ports and hosts, so if _it_ can connect to bolt, your app shouldn't have any trouble. Maybe the script, or the environment it is ran in, is blocking or redirecting the traffic. Might also be worth checking local machine firewalls. Failing that, wireshark.

---

<div class="post-metadata">

**Author:** ![caschiffer](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/caschiffer/32/9383_2.png) [@caschiffer](https://community.neo4j.com/u/caschiffer)\
**Post date:** [February 28, 2020, 11:05pm UTC](https://community.neo4j.com/t/neo4j-connection-issues/15040/8 "2020-02-28T23:05:24Z")

</div>

Ok, I'll check it out. Thanks.

---

<div class="post-metadata">

**Author:** ![anthapu](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/anthapu/32/4113_2.png) [@anthapu](https://community.neo4j.com/u/anthapu)\
**Post date:** [February 29, 2020, 1:52am UTC](https://community.neo4j.com/t/neo4j-connection-issues/15040/9 "2020-02-29T01:52:19Z")

</div>

Can you please check the debug.log and security.log to see if you see any errors.

---

<div class="post-metadata">

**Author:** ![caschiffer](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/caschiffer/32/9383_2.png) [@caschiffer](https://community.neo4j.com/u/caschiffer)\
**Post date:** [March 2, 2020, 5:20pm UTC](https://community.neo4j.com/t/neo4j-connection-issues/15040/10 "2020-03-02T17:20:11Z")

</div>

I did and I wasn't seeing any connection errors
