Does anyone know a way to connect to a SQL Server database from Python without installing a driver like ODBC? I need to do that on a customer server. I already established a connection from Python to SQL Server via pymssql , but since the project is being discontinued, I am looking for an alternative.
Is it for example possible to link a dll with odbc driver? If yes, where would I get it and how could I link it to Python?
as of 2021-08, you can still try with pymssql( https://github.com/pymssql/pymssql ) the project no longer depreciated, is active again.
if using conda, you can install from conda-forge conda install pymssql
if import pymssql
shows error: libiconv.so.2: cannot open shared object file
, you can also install libiconv by conda conda install libiconv
code example:
import pymssql
conn = pymssql.connect(server="127.0.0.1", port="33412", user="reader", password="passwd", database="db_name")
cursor = conn.cursor()
cursor.execute('SELECT TOP 10 * FROM table_name')
data=cursor.fetchall()
Does anyone know a way to connect to a SQL Server database from Python without installing a driver like ODBC? I need to do that on a customer server. I already established a connection from Python to SQL Server via pymssql , but since the project is being discontinued, I am looking for an alternative.
Is it for example possible to link a dll with odbc driver? If yes, where would I get it and how could I link it to Python?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.