ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Error while inserting a XML in DB2 table

Post new topic  Reply to topic
 Error while inserting a XML in DB2 table « View previous topic :: View next topic » 
Author Message
Rajat
PostPosted: Fri Apr 30, 2010 2:47 am    Post subject: Error while inserting a XML in DB2 table Reply with quote

Novice

Joined: 26 Nov 2009
Posts: 15

Hi Friends,

Its a really urgent issue for me.

I am inserting a xml in the Mainframe DB2 table using a simple java code

data type of the column is CLOB(size 1 GB)

But when i am trying to insert data more than 32 kb(approx), i am getting

DB2 SQL Error: SQLCODE=-102, SQLSTATE= 54002

Code I am using (Both the mentioned methods I have tried)

Connection Conn = null;
try{
Class.forName("com.ibm.db2.jcc.DB2Driver").newInstance();
Conn = DriverManager.getConnection("jdbc:db2://172.27.234.55:2222/TEST","xxxxx","xxxx");
System.out.println("connection established"+Conn);
Statement st = Conn.createStatement();
String strVal = "XML Data, size > 35kb";
String msgID = "768569";
String sqlStatement = "INSERT INTO NUIYG1.ZOPLOG "
+ "(MB_UNIQUE_ID,MESSAGE)"
+ "VALUES "
+ "('" + msgID + "',"
+ "('" + strVal + "')";
st.executeUpdate(sqlStatement);


*****************************************************

PreparedStatement preparedStatement = Conn.prepareStatement("INSERT INTO NUPG1.TPGRLOG VALUES(?,?)");

preparedStatement.setString(1,"123456209");
preparedStatement.setString(2,stringVal);



I did some research, I got few points

1)
*******************************************
SQLCODE=-102, SQLSTATE= 54002

Explanation: String constant beginning with &1 too long.

-102 LITERAL STRING IS TOO LONG. STRING BEGINS string

¦ Explanation: The string constant beginning with string has a length
¦ greater than the maximum allowed length. Most strings have these limits:

¦ o For a hexadecimal constant (X, GX, or UX), the number of hexadecimal
¦ digits must not exceed 32704.
¦ o Any other character string constant must be short enough so that its
¦ UTF-8 representation requires no more than 32704 bytes.
¦ o Any other graphic string constant must be short enough so that its
¦ UTF-8 representation requires no more than 32704 bytes.

¦ In some contexts, however, the limit is smaller; see the DB2 SQL Reference
¦ for the specific cases.

¦ For special registers, the allowable length depends on the particular
¦ special register. A string that exceeds the limit can be specified only
¦ through assignment from a host variable. If this release of DB2 increases
¦ the maximum allowed length of a string constant, then an attempt to
¦ exploit the new length before using the New Function Mode produces this
¦ SQL return code.

Two consecutive string delimiters are used to represent one string
delimiter within the character string, but these count as 2 bytes when
calculating the lengths of character string constants.

System Action: The statement cannot be executed.

Programmer Response: The requested function is not available
interactively. If the error occurred in the context of an SQL statement
embedded in an application program, the desired result can be achieved by
assigning the long string to a host variable, and substituting that
variable for the string literal in the SQL statement.

SQLSTATE: 54002

***************************************
2) May be a limitation from the JDBC driver side.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Error while inserting a XML in DB2 table
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.