× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello Andy,

When designing JDBCR4, I had to decide on some sort of a string size to return. In DB2 for IBM i, the maximum length of any (non-LOB) column is 32766 -- that's why I picked 32767, because I figured it was "big enough".

Also, return values like that tend to perform worse depending on their size. (This is why IBM added the RTNPARM keyword in the newer releases.) So I didn't want JDBC_GetCol() to return an especially large size, because it might kill performance.

However, this is not a physical limit of JDBC or RPG. It's purely a limit of the way I wrote the code. You could certainly change it (or even write your own routine that allows the contents of a column to be saved to a dynamically allocated pointer, thus allowing huge sizes even on older releases.)



On 4/9/2013 6:55 AM, Andy Thompson wrote:
I want to receive the contents of an XML variable whose content exceeds 32767 bytes into an RPGLE program parse it and do some updates. The XML could potentially be 500k to 2GB. This is stored as an XML type field on an MSSQL table.

So .. I tried using JDBC in and RPGLE program using JNI. My attempt as shown below.
The program works fine when the content is less than 32767 but fails on the XML-INTO when its bigger (RNX0353 reason 5)

Can anyone point me in the right direction ?

I should add we are running V7R1.

regards
Andy Thompson


D idata s sqltype(XML_DBCLOB:65535)

RS = JDBC_ExecPrepQry(PrepStm) ;
DoW (JDBC_NextRow(RS)) ;
iData = jdbc_getCol(RS : 1) ;
.
options = 'doc=string path=BOM/BO/OPOR/row ' +
'allowmissing=yes allowextra=yes case=any ns=remove';
xml-into rowOPOR %XML(%trim(iData) : options);
*** it Fails here because it truncates the XML at 32767 bytes ***
.

* Copyright (c) 2006-2008 Scott C. Klement
* All rights reserved.
P JDBC_GetCol B export
D JDBC_GetCol PI 32767A varying
D rs like(ResultSet)
D col 10I 0 value
D nullInd 1N options(*nopass:*omit)
D result s 32767A varying
D str s like(jstring)
D null s 1N inz(*OFF)
/free
jdbc_begin_object_group(5);
monitor;
str = getColString(rs: col);
if (str = *NULL);
result = '';
null = *ON;
else;
result = r(str);
endif;
on-error;
null = *ON;
result = '';
endmon;
jdbc_end_object_group();
if (%parms >= 3 and %addr(nullInd)<>*NULL);
nullInd = Null;
endif;
return result;
/end-free
P E



CONFIDENTIALITY NOTICE: This message is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under law. If you are not the intended recipient(s) please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you received this in error, please contact the sender and delete the material from any computer.

We have taken precautions to minimise the risk of transmitting software viruses, however, you need to carry out your own virus checks on any attachments as we can take no responsibility for any computer virus transferred by way of this email.

All views or opinions expressed will be those of the author and not necessarily those of Harry Yearsley Ltd.

Harry Yearsley Ltd, Registered 556895, Registered Office : Yearsley Group, Hareshill Road, Heywood, Lancs., OL10 2TP

Business is conducted as under our Terms and Conditions available on request


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.