Problem with connection: Python + SQL Server - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Problem with connection: Python + SQL Server (/thread-8290.html) |
Problem with connection: Python + SQL Server - carlos_123 - Feb-13-2018 Hi Everyone! I try to connect Python with SQL Server (with Windows Authentication), but I have a problem with the output... The code is: import pypyodbc import pyodbc cnxn = pyodbc.connect('driver={SQL Server};server=ABC123;database=DB1;trusted_connection=true') cursor = cnxn.cursor() query = "SELECT TOP 10 * FROM TABLE_EXAMPLE " cursor.execute(query) cnxn.commit() cnxn.close()The error is: cursor.execute(query) Out[298]: <pyodbc.Cursor at 0xe461623030>... someone knows what happens please?. I have Microsoft SQL Server 2014 and Python 3.6.1 | Anaconda 4.4.0 Thanks very much for the help! Regards Carlos, RE: Problem with connection: Python + SQL Server - snippsat - Feb-13-2018 (Feb-13-2018, 02:27 PM)carlos_123 Wrote: The error is:It's not an error cursor get executed,you just see the memory location of that operation in IPython. To see a result of query example cursor.fetchone() .Returns the next row in the query, or None when no more data is available. cursor.fetchall() Returns a list of all the remaining rows in the query.
RE: Problem with connection: Python + SQL Server - carlos_123 - Feb-13-2018 Thanks very much, this is'nt a Problem...you are reight I can execute now good |