Connect Python to MS SQL Server using pyodbc
Question: I am having a problem connecting pyodbc to my SQL Server. When I run it, there
is no output at all and there is not error message or anything to tell me what
is wrong? Even after I hit enter a few times nothing?

    
    
     import pyodbc
     cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=marketing-sql01.onlive.corp;DATABASE=grok;UID=austin.trombley;PWD=XXXX')
     cursor = cnxn.cursor()
     cursor.execute("select * from user")
     rows = cursor.fetchall()
     for row in rows:
          print row.user_id, row.user_name
    


Answer: Try...

    
    
    ...
    
    for row in rows:
        print row['user_id'], row['user_name']
    

