mom
13-09-07, 13:39
Hallo Forum,
ich habe hier ein C-Progrämmle, welches mit Hilfe einer SQL STORED PROCEDURE XML-Dokumente, die größer als 1MByte sind,
in unsere RDB zerschreddern soll.
Bis 1Mbyte geht alles glatt, bei größeren Dokumenten bekomme ich folgende Meldung:
Empfängerwert zu klein, um Ergebnis zu halten.
Anwendungsfehler. MCH1210 nicht überwacht durch QSQCLI bei Anweisung
0000005073, Instruktion X'0000'.
Anwendungsfehler. CEE9901 nicht überwacht durch QZXMDB2XML bei Anweisung
0000000081, Instruktion X'0000'.
Fehler von Auslöserprogramm oder externer Routine erkannt.
Und hier das Programm zur Meldung:
/* -*- Mode: C -*- */
/************************************************** ********************
* IBM DB2 UDB XML Extender for OS/400 *
* Version 5 Release 1 *
* *
* 5722-DE1 (C) COPYRIGHT *
* International Business Machines Corp. 2001,2001 *
* All Rights Reserved *
* Licensed Materials - Property of IBM *
* *
* US Government Users Restricted Rights - Use, duplication or *
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. *
************************************************** ********************
* LICENSE AND DISCLAIMER *
* IBM grants you a nonexclusive license to use, execute, display, *
* reproduce, distribute and prepare derivative works of this sample *
* code. The sample code has not been thoroughly tested under all *
* conditions. IBM, therefore, does not warrant or guarantee its *
* reliability, serviceablity, or function. *
* All sample code contained herein is provided to you "AS IS." *
* ALL IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO THE *
* IMPLIED WARRANTIES OF MERCHANTABILLITY AND FITNESS FOR A *
* PARTICULAR PURPOSE, ARE EXPRESSLY DISCLAIMED. *
************************************************** ********************/
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "dxx.h"
#include "dxxrc.h"
int main(int argc, char *argv[]) {
EXEC SQL INCLUDE SQLCA;
EXEC SQL BEGIN DECLARE SECTION;
char dbname[19];
char dadfile_buf[4000];
SQL TYPE is CLOB_FILE xmlfile;
/*SQL TYPE is CLOB(100M) *XMLOBP;*/
SQL TYPE is CLOB(10M) xmlobj;
SQL TYPE is CLOB_FILE dadfile;
SQL TYPE is CLOB(100K) dadobj;
long errCode;
char msgtext[2048];
short null_ind = -1;
short non_null_ind = 0;
short errCode_ind;
short msgtext_ind;
EXEC SQL END DECLARE SECTION;
int rc = 0, len;
char dadfilename[513];
FILE *testfile;
int debug_sp = 0 ;
if (argc != 4) {
printf("Usage: %s dbname dadfilename xmlfilename\n", argv[0]);
return -1;
}
strcpy(dbname, argv[1]);
strcpy(dadfilename, argv[2]);
strcpy(xmlfile.name, argv[3]);
if ( strlen( dbname ) != 0 ) {
EXEC SQL CONNECT TO :dbname;
}
/* Initialize the XML CLOB object. */
/*XMLOBP=(_Packed struct XMLOBP_t*) malloc(sizeof(*XMLOBP));*/
/*if(XMLOBP==NULL){ */
/*fprintf(stderr, "Malloc()error.\n"); */
/*goto exit; */
/*} */
xmlfile.name_length = strlen(xmlfile.name);
xmlfile.file_options = SQL_FILE_READ;
testfile = fopen( xmlfile.name, "r" );
if ( testfile != NULL ) {
fclose( testfile );
}
else
{
fprintf(stderr, "fopen() error.\n");
fprintf(stderr, "Error accessing file: %s%d\n", xmlfile.name, errno);
rc = -1;
goto exit;
}
/* DB2 would pass garbage if we directly fed
xmlfile into our stored procedure. */
EXEC SQL VALUES (:xmlfile) INTO :xmlobj;
/* Initialize the DAD CLOB object. */
strcpy(dadfile.name, dadfilename);
dadfile.name_length = strlen(dadfile.name);
dadfile.file_options = SQL_FILE_READ;
testfile = fopen( dadfile.name, "r" );
if ( testfile != NULL ) {
fclose( testfile );
}
else
{
fprintf(stderr, "fopen() error.\n");
fprintf(stderr, "Error accessing file: %s \n", dadfile.name);
rc = -1;
goto exit;
}
/* DB2 would pass garbage if we directly fed
xmlfile into our stored procedure. */
EXEC SQL VALUES (:dadfile) INTO :dadobj;
/* Call the stored procedure. */
EXEC SQL CALL DB2XML.DXXSHREDXML100MB (
:dadobj:non_null_ind,
:xmlobj:non_null_ind,
:errCode:errCode_ind,
:msgtext:msgtext_ind);
if ( sqlca.sqlcode != 0 ) {
printf( " sqlcode was %d.\n", sqlca.sqlcode );
}
/* Print the output parms. */
printf(" FEHLERCode=%ld:%d\n msgtext'%s':%d\n",
errCode, errCode_ind, msgtext, msgtext_ind);
if ( ( sqlca.sqlcode < 0 ) || ( errCode < 0 ) )
EXEC SQL ROLLBACK;
else
EXEC SQL COMMIT;
EXEC SQL CONNECT RESET;
rc = errCode;
exit:
return rc;
}
************************************************** **************
Kann mir jemand sagen, was ich nicht richtig mache?
Gruß mom.
:(
ich habe hier ein C-Progrämmle, welches mit Hilfe einer SQL STORED PROCEDURE XML-Dokumente, die größer als 1MByte sind,
in unsere RDB zerschreddern soll.
Bis 1Mbyte geht alles glatt, bei größeren Dokumenten bekomme ich folgende Meldung:
Empfängerwert zu klein, um Ergebnis zu halten.
Anwendungsfehler. MCH1210 nicht überwacht durch QSQCLI bei Anweisung
0000005073, Instruktion X'0000'.
Anwendungsfehler. CEE9901 nicht überwacht durch QZXMDB2XML bei Anweisung
0000000081, Instruktion X'0000'.
Fehler von Auslöserprogramm oder externer Routine erkannt.
Und hier das Programm zur Meldung:
/* -*- Mode: C -*- */
/************************************************** ********************
* IBM DB2 UDB XML Extender for OS/400 *
* Version 5 Release 1 *
* *
* 5722-DE1 (C) COPYRIGHT *
* International Business Machines Corp. 2001,2001 *
* All Rights Reserved *
* Licensed Materials - Property of IBM *
* *
* US Government Users Restricted Rights - Use, duplication or *
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. *
************************************************** ********************
* LICENSE AND DISCLAIMER *
* IBM grants you a nonexclusive license to use, execute, display, *
* reproduce, distribute and prepare derivative works of this sample *
* code. The sample code has not been thoroughly tested under all *
* conditions. IBM, therefore, does not warrant or guarantee its *
* reliability, serviceablity, or function. *
* All sample code contained herein is provided to you "AS IS." *
* ALL IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO THE *
* IMPLIED WARRANTIES OF MERCHANTABILLITY AND FITNESS FOR A *
* PARTICULAR PURPOSE, ARE EXPRESSLY DISCLAIMED. *
************************************************** ********************/
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "dxx.h"
#include "dxxrc.h"
int main(int argc, char *argv[]) {
EXEC SQL INCLUDE SQLCA;
EXEC SQL BEGIN DECLARE SECTION;
char dbname[19];
char dadfile_buf[4000];
SQL TYPE is CLOB_FILE xmlfile;
/*SQL TYPE is CLOB(100M) *XMLOBP;*/
SQL TYPE is CLOB(10M) xmlobj;
SQL TYPE is CLOB_FILE dadfile;
SQL TYPE is CLOB(100K) dadobj;
long errCode;
char msgtext[2048];
short null_ind = -1;
short non_null_ind = 0;
short errCode_ind;
short msgtext_ind;
EXEC SQL END DECLARE SECTION;
int rc = 0, len;
char dadfilename[513];
FILE *testfile;
int debug_sp = 0 ;
if (argc != 4) {
printf("Usage: %s dbname dadfilename xmlfilename\n", argv[0]);
return -1;
}
strcpy(dbname, argv[1]);
strcpy(dadfilename, argv[2]);
strcpy(xmlfile.name, argv[3]);
if ( strlen( dbname ) != 0 ) {
EXEC SQL CONNECT TO :dbname;
}
/* Initialize the XML CLOB object. */
/*XMLOBP=(_Packed struct XMLOBP_t*) malloc(sizeof(*XMLOBP));*/
/*if(XMLOBP==NULL){ */
/*fprintf(stderr, "Malloc()error.\n"); */
/*goto exit; */
/*} */
xmlfile.name_length = strlen(xmlfile.name);
xmlfile.file_options = SQL_FILE_READ;
testfile = fopen( xmlfile.name, "r" );
if ( testfile != NULL ) {
fclose( testfile );
}
else
{
fprintf(stderr, "fopen() error.\n");
fprintf(stderr, "Error accessing file: %s%d\n", xmlfile.name, errno);
rc = -1;
goto exit;
}
/* DB2 would pass garbage if we directly fed
xmlfile into our stored procedure. */
EXEC SQL VALUES (:xmlfile) INTO :xmlobj;
/* Initialize the DAD CLOB object. */
strcpy(dadfile.name, dadfilename);
dadfile.name_length = strlen(dadfile.name);
dadfile.file_options = SQL_FILE_READ;
testfile = fopen( dadfile.name, "r" );
if ( testfile != NULL ) {
fclose( testfile );
}
else
{
fprintf(stderr, "fopen() error.\n");
fprintf(stderr, "Error accessing file: %s \n", dadfile.name);
rc = -1;
goto exit;
}
/* DB2 would pass garbage if we directly fed
xmlfile into our stored procedure. */
EXEC SQL VALUES (:dadfile) INTO :dadobj;
/* Call the stored procedure. */
EXEC SQL CALL DB2XML.DXXSHREDXML100MB (
:dadobj:non_null_ind,
:xmlobj:non_null_ind,
:errCode:errCode_ind,
:msgtext:msgtext_ind);
if ( sqlca.sqlcode != 0 ) {
printf( " sqlcode was %d.\n", sqlca.sqlcode );
}
/* Print the output parms. */
printf(" FEHLERCode=%ld:%d\n msgtext'%s':%d\n",
errCode, errCode_ind, msgtext, msgtext_ind);
if ( ( sqlca.sqlcode < 0 ) || ( errCode < 0 ) )
EXEC SQL ROLLBACK;
else
EXEC SQL COMMIT;
EXEC SQL CONNECT RESET;
rc = errCode;
exit:
return rc;
}
************************************************** **************
Kann mir jemand sagen, was ich nicht richtig mache?
Gruß mom.
:(