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

ODBC error 50311 source encoding UTF-8 using ICU using TD ODBC 16.20 #112

Open
gilessbrown opened this issue Oct 2, 2018 · 8 comments
Open

Comments

@gilessbrown
Copy link

Seeing this error with Teradata ODBC 16.20 but not 16.10. Not sure if this is a bug in the underlying library or maybe just an incompatibility?

File "download_from_teradata.py", line 71, in main
    for row in res:
  File "./lib/python3.6/site-packages/sqlalchemy/engine/result.py", line 868, in __iter__
    row = self.fetchone()
  File "./lib/python3.6/site-packages/sqlalchemy/engine/result.py", line 1195, in fetchone
    self.cursor, self.context)
  File "./lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception
    exc_info
  File "./lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 265, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "./lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 248, in reraise
    raise value.with_traceback(tb)
  File "./lib/python3.6/site-packages/sqlalchemy/engine/result.py", line 1186, in fetchone
    row = self._fetchone_impl()
  File "./lib/python3.6/site-packages/sqlalchemy/engine/result.py", line 1067, in _fetchone_impl
    return self.cursor.fetchone()
  File "./lib/python3.6/site-packages/teradata/util.py", line 121, in fetchone
    return next(self, None)
  File "./lib/python3.6/site-packages/teradata/util.py", line 163, in __next__
    values = next(self.iterator)
  File "./lib/python3.6/site-packages/teradata/tdodbc.py", line 1152, in rowIterator
    checkStatus(rc, hStmt=cursor.hStmt, method="SQLFetch")
  File "./lib/python3.6/site-packages/teradata/tdodbc.py", line 231, in checkStatus
    raise DatabaseError(i[2], u"[{}] {}".format(i[0], msg), i[0])
sqlalchemy.exc.DatabaseError: (teradata.api.DatabaseError) (50311, '[HY000] [Teradata][Support] (50311) Error converting invalid input with source encoding UTF-8 using ICU. Rejected bytes began with: 80.') (Background on this error at: http://sqlalche.me/e/4xp6)
@rina-shilo
Copy link

rina-shilo commented Nov 29, 2018

same error when using driver ODBC 16.10 and when using python driver teradatasql:

File "/usr/local/lib/python3.7/site-packages/teradata/udaexec.py", line 836, in fetchall
return self.cursor.fetchall()
File "/usr/local/lib/python3.7/site-packages/teradata/util.py", line 139, in fetchall
for row in self:
File "/usr/local/lib/python3.7/site-packages/teradata/util.py", line 163, in next
values = next(self.iterator)
File "/usr/local/lib/python3.7/site-packages/teradata/tdodbc.py", line 1152, in rowIterator
checkStatus(rc, hStmt=cursor.hStmt, method="SQLFetch")
File "/usr/local/lib/python3.7/site-packages/teradata/tdodbc.py", line 231, in checkStatus
raise DatabaseError(i[2], u"[{}] {}".format(i[0], msg), i[0])
teradata.api.DatabaseError: (50311, '[HY000] [Teradata][Support] (50311) Error converting invalid input with source encoding UTF-8 using ICU. Rejected bytes began with: D64C.')

@sushmit86
Copy link

Has there been any resolution to this? I think this is an issue in Mac/Linux like environment

@yvan
Copy link

yvan commented Jan 27, 2019

anyone working on or thinking about this? should i just downgrade my driver to 16.10? or 15.*?

my error:

Error: ('HY000', '[HY000] [Teradata][Support] (50311) Error converting invalid input with source encoding UTF-8 using ICU. Rejected bytes began with: E474. (50311) (SQLGetData)')

my environment:

centos 7
tdodbc1620-16.20.00.49-1.noarch.rpm (downloaded tdodbc1620__linux_indep.16.20.00.49-1.tar.gz) installed with yum.

@yvan
Copy link

yvan commented Jan 27, 2019

One workaround is just to use teradatasql for python:

pip install teradatasql==16.20.0.39
conn = teradatasql.connect(None, host=host, user=user, password=password)

i do not have any encoding issue with this version of the driver.

@ravi-ramadoss
Copy link

Solved this by adding

Charset=UTF8

in odbc.ini file. I figured that, there is no need to translate for my application and the default was ASCII

@yvan
Copy link

yvan commented May 25, 2019

can anyone confirm when/if this makes it to the next release? :)

@pberden
Copy link

pberden commented Oct 30, 2019

I solved this by passing the charset option like so:

session = udaExec.connect(method="odbc", system="server", username="user", password="pass", charset="UTF8")

@KriAga
Copy link

KriAga commented Jan 28, 2020

@pberden thanks, worked for me!

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

No branches or pull requests

7 participants