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
  [Python 3.6.4/Windows] Problem with module installation and SSL didier31 3 48 Feb-20-2018, 08:57 PM
Last Post: sparkz_alot
  Python Ble Distance Problem aleynasarcanli 10 207 Feb-09-2018, 10:48 PM
Last Post: aleynasarcanli
  Error in running MS Access Database connection code pyuser1 4 132 Feb-01-2018, 08:28 PM
Last Post: pyuser1
  Python capitalize() method problem Skipper 9 146 Jan-27-2018, 03:11 PM
Last Post: Skipper
  Loading HUGE data from Python into SQL SERVER Sandeep 2 110 Jan-13-2018, 07:52 AM
Last Post: Sandeep
  Problem while creating an Excel File using python Math_Enthusiast 3 138 Dec-09-2017, 08:49 PM
Last Post: buran
  Tableau and R Server for Python? iamsaanvi 0 140 Dec-07-2017, 06:43 AM
Last Post: iamsaanvi
  Connection handling MuntyScruntfundle 1 100 Dec-05-2017, 11:41 AM
Last Post: Larz60+
  problem in opening python akash_nag 1 106 Dec-03-2017, 07:39 AM
Last Post: buran
  Trying to create a python exe for an addition problem with an odd variable Python_Newb 0 81 Nov-30-2017, 12:18 PM
Last Post: Python_Newb

Forum Jump:


Users browsing this thread: 1 Guest(s)