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

That use itoolkit to run one sql query returns an BADPARSE error. #51

Closed
LiJunBJZhu opened this issue Mar 26, 2020 · 3 comments
Closed

Comments

@LiJunBJZhu
Copy link

Recreated steps:

  1. Use iSqlQuery to run a sql "SELECT DATA FROM qusrsys.QATOCTCPIP WHERE KEYWORD='RMTNAMESV';" Below is the code.

    itool = iToolKit()

    itool.add(iSqlQuery('query', sql, {'error': 'on'}))
    itool.add(iSqlFetch('fetch'))
    itool.add(iSqlFree('free'))

    itool.call(itransport)

    command_output = itool.dict_out('fetch')

  2. However, seems there is a BADPARSE error.

The output:
{'error': {u'error1': u' ?xml version='1.0'? xmlservice sql var="query" query error="on" var="query" conn='conn1' stmt='stmt1' success ![CDATA[+++ success SELECT DATA FROM qusrsys.QATOCTCPIP WHERE KEYWORD='RMTNAMESV';]] /success /query /sql sql var="fetch" fetch block="all" error="fast" var="fetch" stmt='stmt1' row data desc='DATA' ![CDATA[9.0.128.50 9.5.178.0 U ', 'fetch': {...}, u'error': u'*BADPARSE'}}"

@LiJunBJZhu
Copy link
Author

BTW, this sql "SELECT DATA FROM qusrsys.QATOCTCPIP WHERE KEYWORD='LOCALDMNME';" can be finished successfully. The only difference between the good one and the bad one is the value of KEYWORD.

@chrjorgensen
Copy link

The error report points to the "fetch" instruction, so there is probably a problem with the data returned.

Running the same SQL statement with keyword "RMTNAMESV" on our server returns some binary data after the 'U' character - so this seems to be the cause of the error.

I think you should be careful when accessing the table QATOCTCPIP - the column DATA is character but with CCSID 65535 which indicates binary data is stored in this column. Better use the "new" DB2 for i Services like QSYS2.TCPIP_INFO if possible...

@LiJunBJZhu
Copy link
Author

QSYS2.TCPIP_INFO doesn't contain the info I need. Anyway, use the sql
select cast(data as varchar(100)) from qusrsys.qatoctcpip WHERE KEYWORD='RMTNAMESV' instead. Thanks.

This issue was closed.
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

2 participants