I try to open a connection with my MySql DB from my python script. The DB is a MySql 8 instance running on Google Cloud.
For that, I use the Cloud SQL Proxy from Google Cloud.
I correctly created my service account and everything is working perfectly on my Ubuntu laptop. The Unix Socket is created when I execute this command :
./cloud_sql_proxy -dir=/cloudsql -instances=my_connection_name -credential_file=path_to_cred_file
And I can open my connection with my python script.
The problem is when I try to do the same with my Macbook Pro under Mac OSX Catalina :
Since the "/" folder is now read only, I created the "cloudsql" folder under : /Users/myname/cloudsql and gave it all the permissions needed.
But, when I execute that script :
./cloud_sql_proxy -dir=/Users/myname/cloudsql -instances=my_connection_name -credential_file=path_to_cred_file
The proxy is running fine except it doesn't create the Unix Socket in the folder
It's then impossible to connect to the db since the socket doesn't exist.
Is there a workaround on Catalina or is it an other problem ?
Related
I'm using VirtualBox as my VM, and on it I have SQL server, and my python script runs on local host.
My connection string looks like this engine = create_engine('mssql+pyodbc://'+username+':'+password+'#127.0.0.1:1433/'+database+'?driver=SQL+Server+Native+Client+11.0')
I'm getting "Data source name not found and default driver not specified" error.
I've tried a lot of stuff, and I can't make it work still.
Thanks
If you running Python script on System
The pythons script gets connected to localhost server of the system not Virtual Box
The problem was in database drivers. I worked on a pc with SQL Server Native Client 11.0 driver, but I didn't have it on the pc where I was deploying the script and on which the VM was on.
I am connecting to an Oracle DB using LDAP and the Python cx_Oracle library. I have proper sqlnet.ora, ldap.ora and tnsnames.ora files. On my Windows machine everything works fine using the 12.1 Oracle client and the following Python code:
import cx_Oracle
connection = cx_Oracle.connect(user/password#db, mode=cx_Oracle.SYSDBA)
I have installed the Oracle instant client 12.1 on my Linux machine (Debian) following the zip file installation method advised on the Oracle website (at the bottom of https://www.oracle.com/be/database/technologies/instant-client/linux-x86-64-downloads.html).
ldconfig correctly lists the oracle client libraries and their paths.
I copy the exact same sqlnet.ora, ldap.ora and tnsnames.ora files from my Windows machine to my Linux machine
in /opt/oracle/instantclient_12_1/network/admin, as advised by the cx_Oracle documentation.
Now running the above Python code on my Linux machine I have the following error:
cx_Oracle.DatabaseError: ORA-12154: TNS:could not resolve the connect identifier specified
I tried as well setting the environment variable TNS_ADMIN=/opt/oracle/instantclient_12_1/network/admin and ORACLE_HOME=/opt/oracle/instantclient_12_1/ with no success neither
Could any of you help me debugging this and understand why the client config on my Linux machine does not work?
Installed the latest 19 client and everything works as expected.
How can I easily copy a local file to a remote server using python?
I don't want to map the drive to my local machine and the windows server requires a username and password.
The local machine is also a windows machine.
Examples I've seen are with linux and mapping the drive. Unfortunately that's not an option for me.
You can use the subprocess module or os.system to launch a command into a windows shell. Then you can use Powershell or cmd instructions.
I'm trying to connect pycharm 2016.2 professional to remote python interpreter via docker. I have docker for windows version 1.12.0-rc2-beta20 (the one that uses hyper-v on windows 10; not virtualbox). In pycharm, there's dialog that asks for the docker API URL which is by default populated with: https://192.168.99.100:2376
But that doesn't connect. I also tried localhost:2376 and 10.0.75.0:2376 (10.0.75.0 is the internal IP for vEthernet (DockerNAT)) and they do not work. Is the integration just not supported with the non-virtualbox docker or am I entering the wrong thing?
I would like to connect to my raspberry pi using a remote interpreter. I've managed to do it just fine in windows 7 using Pycharm, but having recently upgrading to windows 8.1 it no longer works. I've tried to connect to the raspberry pi (where it worked in win 7) and another one with a fresh install of Raspbian (released 09-09-2014).
I also tried through Ubuntu, but to no avail. Has anyone out there managed to get this right in windows 8 or any linux flavour?
Should I try a key pair (OpenSSH or PuTTY)?
After adding the RSA key to the repository, the process that hangs is
'Getting remote interpreter version' ~ 'Connecting to 10.0.0.98'
It works in PyCharm if you deploy a remote SFTP server.
Tools > Deployment > Add > Enter name and SFTP >
Enter host, port, root path (I said "/" without quotes) username and password.
Then, when creating a new project, change your interpreter to 'Deployment Configuration', and select your SFTP server.
Press OK, then create.
You should be all set to go.