I'm working on unix/rhel7 system. I have installed require drivers for FreeTDS, unixODBC and pyodbc.Other query is working fine but when I'm trying execute stored proc with TVP (table valued parameter), its giving me error. Is there any way to connect SQL Server using windows service account from python?
Example:
import pyodbc;
cnxn = pyodbc.connect('DRIVER=FreeTDS;SERVER=SERVERNAME;PORT=1234;UID=USERNAME;PWD=PASSWORD;DATABASE=DBNAME')
cnxn.cursor()
param_array = []
for i in range(3):
param_array.append(['abc', 'adi', '/somepath/', '2021-01-04', 'NEW'])
result_array = cursor.execute("EXEC abc.stored_proc_name ?", [param_array]).fetchall()
cursor.commit()
cnxn.close()
Error:
pyodbc.Error: ('HY004', '[HY004] [FreeTDS][SQL Server]Invalid data type (0) (SQLBindParameter)')
So Is there any other way to connect SQL service account from python which supports TVP? Or Is there any solution in above example?