I'm writing a python script on Jupyter notebook on my Mac OS, and I'm trying to connect to a local DB that is located on my Parallels Windows operating system that is running from my external hard drive.
I've tried the following code:
import pyodbc
from sqlalchemy import create_engine
import urllib
import json
import requests
import pandas as pd
import codecs
import datetime
import pytz
import mysql.connector
from mysql.connector import Error
params = 'DRIVER={ODBC Driver 13 for SQL Server};' 'SERVER=local;' 'DATABASE=Totepro;'
params = urllib.parse.quote_plus(params)
db = create_engine('mssql+pyodbc:///?odbc_connect=%s' % params)
def get_new_race_data():
sql_get_data = '''
SELECT * FROM RaceRowReport
WHERE RaceKey = cur_race_key
'''
new_race_data = pd.read_sql_query(sql_get_data, db)
return new_race_data
get_new_race_data()
This is the output:
OperationalError: (pyodbc.OperationalError) ('HYT00', '[HYT00] [Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired (0) (SQLDriverConnect)')
(Background on this error at: http://sqlalche.me/e/e3q8)
I have also tried the following in terms of adjusting the connection string:
SERVER=10.211.55.3
However I still got the same issue. I've turned off the firewall from windows, but still nothing. ..
Then I tried:
import mysql.connector
from mysql.connector import Error
connection = mysql.connector.connect(host='10.211.55.3',
database='Totepro')
and now I find myself with the following error:
ProgrammingError: 1045 (28000): Access denied for user ''@'localmac' (using password: NO)
Any assistance would be helpful.
Thanks