Close DB connection with Neomodel - python

I'm using the Neomodel lib and I can't find anything in the documentation to properly close the connection to the DB. Have I missed something or is there a way to access the underlying connection and close that?
When existing the python program an open connection will generate following errors:
Failed to write data to connection Address(host='localhost', port=7687) (Address(host='127.0.0.1', port=7687)); ("0; 'Underlying socket connection gone (_ssl.c:2263)'")
Failed to write data to connection Address(host='localhost', port=7687) (Address(host='127.0.0.1', port=7687)); ("0; 'Underlying socket connection gone (_ssl.c:2263)'")
Update: Found bug registered regarding this issue Underlying socket connection gone? #474

I have been using Neo4j with Docker and the latest version (3.5.11) and had the same issue. Downgrading to the 3.4.15 Docker image fixed this issue and a couple of other issues (broken pipe) for me, so seems like this is related to the Neo4j version in use?

Related

How do I connect to a MySQL Database in Python with a RaspberryPi

I'm a student and I'm trying to write some sensor values into a MySQL database.
As IDE I'll be using Inteliji.
First off I started by installing the database Plug-in.
This was done successfully
Next I tried to connect to the data base (see figure below)
Figure of successful connection
Now The next thing I want to do is use a MySQL connector.
Therefore I've installed MySQL onto the r-PI and used following code to implement it.
import mysql.connector
print("Step 1")
cnx = mysql.connector.connect(user='a21ib2a01',
password='secret',
host='mysql.studev.groept.be',
database='a21ib2a01')
Print("Step 2")
When now I run my code the terminal will output:
Step1
For some reason I don't know; the connect function always times my program out with the next occurring errors:
mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on 'mysql.studev.groept.be:3306' (110 Connection timed out)
So does anyone know why my connection is successful but I can't connect to it?
Long story short what am I doing wrong and how do I fix this?
Thanks in advance!
Your timeout means the network on your rPi cannot reach -- cannot find a route to -- your MySQL host mysql.studev.groept.be.
If you do traceroute mysql.studev.groept.be in a shell in the rPi you may see what's wrong.
When in a shell on your rPi, can you ssh to any machine in your uni's network? If so, you might be able to use ssh port-forwarding to get a route to the database server.
Do you run intelliJ on the rPi directly, or on your laptop? If you run it on the laptop, it looks like the laptop can find a route to your server but the rPi cannot.
(If this were my project, I'd install a MySQL server on my laptop to reduce the network-engineering hassles of connecting through multiple hops involving a VPN.)

Azure SQL Server Bulk Insert TCP Provider Problem

I use SQL Server on Azure and I make a bulk insert with Python but I constantly get error. How can I solve the problem?
Error : TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host
Best,
Thanks
As per the Microsoft official document, this error message returned when the secure TLS handshake is negotiated between the client and the server by using TLS_DHE cipher suite.
To fix this issue, make sure that both the client and server involved in a connection are running Windows that have the leading zero fixes for TLS_DHE installed. It's recommended to install the updates since they enhance the conformance to TLS_DHE specifications.
If you can't update the windows, a workaround is available here.

Cannot connect to MySQL server Azure from python

I've been trying to connect to a MySQL database remotely but I keep getting the error:
2055: Lost connection to MySQL server at 'local.mysql.database.azure.com:3306', system error: 1 [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1045)
Using the exact same connection details I am able to connect to the database through MySQL Workbench and through Node. For some reason the connection won't go through in python.
This user's as not created to require SSL.
I've been trying to figure out the problem but I'm drawing blanks.
Below is my python login block.
config = {
'host':'local.mysql.database.azure.com',
'user':'user#local',
'password':'password',
'database':'random_db'
}
I've been able to connect to a MySQL instance on the Google Cloud Platform with the exact same connection block but it doesn't work for the Azure connection. I've looked for differences between the two platforms which could have caused this and the only thing I could find was that the Azure MySQL version was 5.7.32log while the GCP was 8.0.18.
I am also currently running python 3.7.0, not sure if that changes anything.
Is there another module I could use if that is the problem, or do I need to downgrade something? I have no idea.
According to this 5.7.29 is the latest 5.7 supported so 5.7.32 would give wrong version error.

How to interact with Influxdb running on a remote Windows 10 PC in a local network?

I'd like to make a post request by whatever method to write a new point into Influxdb database called my_db, running on another PC in my local network. The PC with Influxdb 1.8 runs on Windows 10. So far I tried to use Python in this way:
import requests
requests.post(url="192.168.x.x:8086/write?db=my_db", data=my_data)
But I'm getting an error:
raise InvalidSchema("No connection adapters were found for {!r}".format(url))
requests.exceptions.InvalidSchema: No connection adapters were found for '192.168.x.x:8086/write?db=my_db'
Is there some kind of setup to be done in order to enable remote connections? Please excuse my ignorance, but I'm not very comfortable with the networking stuff. If possible, I'd like to avoid any kind authentication.

Python MySQLdb cannot connect to server, SSL Issue

_mysql_exceptions.OperationalError: (2026, 'SSL connection error: SSL_CTX_set_tmp_dh failed')
is thrown at me when I try to run my script which connects to my SQL server.
I installed MySQLdb via conda. I've read that this may be an openssl issue, but I'm having trouble downgrading that as well.
based on This answer.
I got the answer:'https://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization.html'
'shell> bin/mysql_ssl_rsa_setup'
If you want to deploy the server with automatic support for secure connections, use the mysql_ssl_rsa_setup utility to create default SSL and RSA files
More information here
I was able to fix this my using mysql.connector instead of importing MySQLdb in my python scripts

Categories

Resources