I get a SQL Server Program type out of range (0) (SQLGetData) error when connecting to SQL Server through Python using the FreeTDS driver

1.8k views Asked by At

Am using MSSQL database server. I connected with SQL using pyodbc. I tried to get value from database.Am getting error while fetching the value from database.I mentioned the detail of connecting database below

 Area_code=1
 cnxn = pyodbc.connect('DRIVER=FreeTDS;SERVER=x.y.z.a;PORT=1433;DATABASE=xxxx;UID=yyyy;PWD=zzzz;TDS_Version=8.0;')
 cursor = cnxn.cursor()
 cursor.execute("exec MOB_GetBranch @AreaID='%s',@CompanyID='419',@lang='en_US'"%Area_code)
 result = cursor.fetchall()

I can't able to get value from database. am getting the error like

 Traceback (most recent call last):
   result = cursor.fetchall()
   pyodbc.Error: ('HY003', '[HY003] [FreeTDS][SQL Server]Program type out of range (0) (SQLGetData)')
1

There are 1 answers

2
akaRem On

Looks like you have wrong conn. strings or you do not have appropriate driver for this db.