Skip to content

Commit b09c307

Browse files
committed
Added Jupyter Sample Script
1 parent 7bd9014 commit b09c307

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import pyodbc
2+
server = 'myserver'
3+
database = 'mydb'
4+
username = 'myusername'
5+
password = 'mypassword'
6+
7+
#Connection String
8+
cnxn = pyodbc.connect('DRIVER={SQL Server Native Client 11.0};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password)
9+
cursor = cnxn.cursor()
10+
11+
#Sample select query
12+
cursor.execute("SELECT @@version;")
13+
row = cursor.fetchone()
14+
while row:
15+
print row[0]
16+
row = cursor.fetchone()
17+

0 commit comments

Comments
 (0)