Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyodbc does not fetch the actual SQL error description for Teradata database #17

Closed
emaillenin opened this issue Sep 20, 2013 · 1 comment
Labels

Comments

@emaillenin
Copy link

What steps will reproduce the problem?

!/usr/bin/python

import pyodbc

def checkTable():
cursor = TDCONN.cursor()
sql = "SELECT 1 FROM query with error"
try:
cursor.execute(sql)
for row in cursor:
print "How did this query work?\n"
exit(0)
except Exception, e:
print e
print "SQL Exception: " + e.message
cursor.close()

def main():

checkTable()
TDCONN.close()

if name == "main":

TDCONN = pyodbc.connect('DSN=mydsn;',ansi=True, autocommit=True)
print "\nTeradata connection established \n"

main()

====ODBC.ini====

[mydsn]
Driver=/opt/teradata/client/14.00/odbc_64/lib/tdata.so
Description=Desc
DBCName=mydbc
LastUser=myuser
Username=myuser
Password=Tmp
Database=mydb
DefaultDatabase=mydb
TDMSTPortNumber=1025
DateTimeFormat=AAA

What is the expected output? What do you see instead?

Expected output:
Teradata connection established
Syntax error: expected something between the 'with' keyword and the 'error' keyword.
State: 37000; Native: -3706; Origin: [Teradata][ODBC Teradata Driver][Teradata Database]

Actual Output:
Teradata connection established
('HY000', '[HY000] [unixODBC][Driver Manager]Driver returned SQL_ERROR or SQL_SUCCESS_WITH_INFO but no error reporting API found (0) (SQLExecDirectW)')
SQL Exception:

What version of the product are you using? On what operating system?

pyodbc - 2.1.8
OS - Linux version 2.6.18-238.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Thu Jan 13 15:51:15 EST 2011

@mkleehammer
Copy link
Owner

This is with a very old version of pyodbc. Can you retest with the a later version? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants