1

I'm attempting to create a connection between my Python editor (Eclipse) and SQL server. I thought this would be easy, but has been the complete opposite. I began by attempting to use Pyodbc, but encountered an error saying that module does not exist. I looked into it further, but it seems I may need to install a driver. So, I looked up another method, mysql.connector, but cannot figure out my host name. The below code is what I will be using. If anyone can recommend an easier way, or sees I am doing something wrong, any advice would be appreciated. I'm just trying to connect to sql server, Adventureworks database through Eclipse.

import mysql.connector

cnx = mysql.connector.connect(user= auth_windows,
                          host='unknown',
                          database='AW2014')
cnx.close()
Jamie Bull
  • 12,889
  • 15
  • 77
  • 116
AndrewC10
  • 357
  • 1
  • 4
  • 20
  • Have you check this link http://stackoverflow.com/questions/7317195/mssql-in-python-2-7 ? A little confused about sql server used with mysql~ – linpingta Jan 03 '16 at 14:07
  • Reading through it now. So it does look like I'm going to need to install a driver. I have sql server management studio, AdventureWorks db, and Eclipse for python code on my desktop. All I want to do is create a connection between the two. – AndrewC10 Jan 03 '16 at 14:12

0 Answers0