I have excel (although the one on our company server) that has a data connection for our SQL database, so we can create nice pivot tables.
I would like to get this data in python (on my local computer) so that I can perform a faster analysis.
I installed pyodbc.
Here is the connection string from excel:
Provider=SQLOLEDB.1;Password=**mypassword**;Persist Security Info=True;User
ID=**myusername**;Initial Catalog=**catalogename**;Data
Source=**datasourcename**;Use Procedure for Prepare=1;Auto
Translate=True;Packet Size=4096;Workstation ID=**workstationid**;Use
Encryption for Data=False;Tag with column collation when possible=False
and now I have a python script:
import pyodbc
cnxn = pyodbc.connect(DRIVER='{SQL Server}',SERVER='***server ip address**',DATABASE='**cataloguename**',UID='**myusername**',PWD='**mypassword**')
cursor = cnxn.cursor()
and I get errors saying that SQL Server does not exist or access is denied.
Any help is appreciated.
source
share