Hello guest, if you read this it means you are not registered. Click here to register in a few simple steps, you will enjoy all features of our Forum.
Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with connection: Python + SQL Server
#1
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,
Quote
#2
(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.
nilamo likes this post
Quote
#3
Thanks very much, this is'nt a Problem...you are reight

I can execute now good
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Beginner Problem python 2.7 Jonathan_levy 2 67 Jul-04-2018, 08:46 PM
Last Post: ichabod801
  Beginner Problem python 2.7 Jonathan_levy 2 69 Jul-03-2018, 11:58 AM
Last Post: gruntfutuk
  problem about 'if' and 'for' from a python beginner yzjnpu 3 114 Jun-26-2018, 03:47 PM
Last Post: buran
  mysql connection issue aaditya2000 0 84 Jun-09-2018, 02:49 AM
Last Post: aaditya2000
  Python Informix connection BLT 1 74 Jun-07-2018, 08:54 PM
Last Post: Larz60+
  Python code optimization problem servanm 2 128 May-23-2018, 01:28 PM
Last Post: servanm
  Python Bot Leave Server Demotry 2 116 May-16-2018, 07:03 PM
Last Post: micseydel
  Python ver 2.7 problem dzeleee 6 199 May-13-2018, 12:05 PM
Last Post: snippsat
  mysql db connection using python sunstar20 12 591 Apr-21-2018, 05:52 PM
Last Post: snippsat
  Windows server 2008 SP2 - Python cx_Oracle connection DLL error tpanagoda 2 224 Mar-05-2018, 04:35 AM
Last Post: tpanagoda

Forum Jump:


Users browsing this thread: 1 Guest(s)