I have installed Apache superset locally using docker-compose using docker-compose -f docker-compose-non-dev.yml up and now when i try to connect it to ms server using connection string it doesnot work either with pyodbc or mssql, also i tested the connection string using python script and it works proprly but not in superset
the connection string is mssql+pyodbc://UserName:password#host:port/TestSchema
Related
I have written a python script that uses the MySQL Connector for Python to read, write and update the database. Do I need to install MySQL server on the client machine (Windows) too to run the program or do I just need to make sure that the database is present in the path used by the script? I tried finding guidance on Google and here but couldn't find what I needed.
No you don't need to install MySQL Server on a client machine. By definition client machine means you don't have the DB/Server there. Where is this DB allocated? You show have an IP or a domain/subdomain address where the DB is actually hosted.
I did a python -m pip install mysql-connector and able to successfully run import mysql.connector through python. But when I am trying to run the below code.
import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="yourusername",
passwd="yourpassword"
)
print(mydb)
It is failing with InterfaceError: 2003: Can't connect to MySQL server on 'localhost:3306' (10061 No connection could be made because the target machine actively refused it)
Since I did pip install for mysql.connector I am not sure of user and passwd.
I connected my database instance from Amazon RDS to mySql workbench, created a python file that looks like his and got the exact error. Everyone says you could have a system firewall problem but nothing straight forward.
The connector is just a means of communicating with a mysql database programically.
You need this, or access to a mysql server to use the connector.
https://dev.mysql.com/downloads/mysql/
The host is obviously localhost when you want to access it locally on your machine. This only works if the server is running on your machine. You can connect a remote server by changing the host to a valid IP address and providing valid credentials. If you use it remotely make sure the server has access through the firewall and that you properly forward the TCP port you decide to use. You may not have to forward, but I would as a general rule of thumb to make it one less thing to check when troubleshooting.
Good luck
I have a simple Python Flask web server, running in a docker container along with an Nginx reverse proxy, and a MySQL database.
When the docker compose is run in network_mode: 'host', everything (nginx-python-mysql) works fine.
But when it is switched to bridge networking, Nginx and the python endpoint app seem to work fine, but the python app is unable to connect to the MySQL instance.
I am exposing the MySQL port 3306. Everything is running on a CentOS-7 vm.
The Python Flask app is running on an gunicorn Python WSGI HTTP Server instance. The MySQL database is based on tutum/mysql.
I have tried both pymysql and SQLAlchemy clients on the python endpoint, and I can only get them to connect to the mysql server in host network_mode.
And as far as I can tell from the docker instance info, the MySQL container is fine, and on the same network as the python endpoint container.
Unfortunately, this is all running on an air gaped server, so its difficult to post the config files here, but the only difference between the host and bridge mode settings is that the nginx ssl config proxy pass has https://endpoint instead of https://localhost, and connecting via https to the python app works in both host and bridge modes. The python app connects to the mysql database on host 0.0.0.0
What could cause the python app to mysql database connection problem to only work in host mode?
I'm using Python 3.5 + Spyder 2 (from Anaconda) on Windows 10. I have an Ubuntu 16.04 desktop machine which is running a MySQL server on a LAN addressable IP. PhpMyAdmin works fine with this remote server. However, every time I attempt to connect to this server from my Windows 10 Spyder I get the following error:
OperationalError: (1045, "Access denied for user 'root'#'10.0.0.30' (using password: YES)")
The command I'm using is:
import os
from peewee import *
from playhouse.db_url import connect
db = MySQLDatabase('test', host="10.0.0.80", port=3306, user='root', passwd='*********')
db.connect()
The IP of the machine I'm using to make the call is 10.0.0.30 shown in the Error. I originally tried it before the "test" db existed. Then I created the "test" db using PhpMyAdmin. I then tested again. Same error. I have created a table in the "test" db via PhpMyAdmin to confirm that root has the appropriate privileges (which wasn't really a question but I wanted confirm).
I have downloaded and installed what I could find via several StackOverflow questions prior to posting this question. I have also rebooted to make sure that any new drivers and such that I installed were actually up and running.
Note my issue is not the same as this one:
Peewee - Can't connect to MySQL server on host
My connection error shows that despite using the host argument and setting it to "10.0.0.80" that peewee is still trying to connect to 10.0.0.30. IP 10.0.0.30 is the Windows machine I'm running peewee from while 10.0.0.80 is the machine I'm attempting to connect to.
TIA
I cannot connect to AS400 version of DB2 via SQLAlchemy (both ibm_db, ibm_db_sa libraries stall when executing queries). The link below gives a solution via ODBC and pyodbc but I only have access to an ubuntu server and not windows for this task. Any suggestions on how to make python work with AS400 DB2?
Connecting to IBM AS400 server for database operations hangs