Running into ORA-19011: Character string buffer too small when executing fetchmany
zhcheng1 opened this issue · 3 comments
zhcheng1 commented
1-2 What versions are you using?
platform.platform: Darwin-21.6.0-x86_64-i386-64bit
sys.maxsize > 2**32: True
platform.python_version: 3.7.10
cx_Oracle.version: 8.0.1
cx_Oracle.clientversion: (12, 2, 0, 1, 0)
- Describe the problem
I have written a python script to get XML data. The XML data is saved as varchar2 in the database.
The error I encountered is about the string buffer. However because the XML data is saved as varchar so it can't exceed the limit. The code is throwing the error at fetchmany.
Error:
...
rows = cursor.fetchmany(self._batch_row_num)
cx_Oracle.DatabaseError: ORA-19011: Character string buffer too small
- Include a runnable Python script that shows the problem.
part of the script that contains the major logic
import cx_Oracle
from bs4 import BeautifulSoup
from cx_Oracle import DatabaseError
class XMLFetcher(object):
def __init__(self, connect_string):
self._batch_row_num = 10
self._cursor = None
self._connection = None
self._connect_string = connect_string
try:
self._connection = cx_Oracle.connect(self._connect_string, mode=0, threaded=True, encoding="UTF-8", nencoding="UTF-8")
self._connection.outputtypehandler = self.output_type_handler
except DatabaseError as e:
print('Exception while trying to initialize database connection object : %s', e)
raise e
def get_xml(self, table_name, dryrun=False):
with self._connection.cursor() as cursor:
cursor.execute("SELECT ID, XMLCOL FROM table1 order by ID ")
while True:
rows = cursor.fetchmany(self._batch_row_num)
...
stale commented
This issue has been automatically marked as inactive because it has not been updated recently. It will be closed if no further activity occurs. Thank you for your contributions.
stale commented
This issue has been automatically closed because it has not been updated for a month.