initial commit
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
# README
|
||||||
|
|
||||||
|
## requirements
|
||||||
|
|
||||||
|
python 3.13 or something
|
||||||
|
mssql server
|
||||||
|
install pip install pyodbc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
check if odbc 17 (or other version)
|
||||||
|
on windows search for odbc data sources.
|
||||||
|
go to the menu point drivers.
|
||||||
|
There should odbc driver 17 for mssql server or something like that
|
||||||
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import pyodbc
|
||||||
|
|
||||||
|
try:
|
||||||
|
connection = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER=.;DATABASE=SampleDB;Trusted_Connection=yes')
|
||||||
|
|
||||||
|
cursor = connection.cursor()
|
||||||
|
|
||||||
|
print()
|
||||||
|
print("Successfully connected to SQL Server")
|
||||||
|
print()
|
||||||
|
|
||||||
|
cursor.close()
|
||||||
|
connection.close()
|
||||||
|
|
||||||
|
except pyodbc.Error as ex:
|
||||||
|
print()
|
||||||
|
print("exception: ", ex)
|
||||||
|
print("closing program")
|
||||||
|
print()
|
||||||
|
exit()
|
||||||
|
|
||||||
|
print()
|
||||||
Reference in New Issue
Block a user