title: Connecting python with sql server 2012
body: <p>I got the following error message when trying to test my python connection with sql server:</p>
  
  <blockquote>
    <p>TypeError: 'pyodbc.Connection' object is not callable.</p>
  </blockquote>
  
  <p>Any ideas on how to resolve this? Thanks.</p>
  
  <pre><code>import pyodbc
  conn = pyodbc.connect('Trusted_Connection=yes', driver = '{SQL Server Native client 11.0}',
                    server = 'XXXX-PC', database = 'MYDATABASE')
  def main():
          cursor = conn()
          cursor.execute('CREATE TABLE production (product_ID int, product_Name varchar')
          cursor.execute('SELECT* FROM production')
          return cursor.fetchall
          cursor.close()
  
  
  if __name__ == '__main__':
              main()
  </code></pre>