I'm need some help retrieving a large
string from a TEXT AREA to be inserted into a CLOB. Everything works fine in my code until my byte[] reachs a length of 8509. Any bigger than that and I get an ArrayIndexOutOfBounds Exception. I have read that the max length of an array is around 65K since
Java uses an integer to index an array.
So my question: Is the req.getParameter method limited in the size of String it can retrieve from a form?
Any help wouold be greatly appreciated.
Below is the code snippet I'm using in a
servlet that is called when my form is submitted:
String body = req.getParameter("body");
Clob quoteBodyClob = null;
stmt3 = con.createStatement();
con.setAutoCommit(false);
rs3 = stmt3.executeQuery("SELECT BODY FROM CLOBNEWS
WHERE ITEMID =" + nextItemID + " FOR UPDATE OF BODY ");
while(rs3.next())
{
quoteBodyClob = rs3.getClob("BODY");
}
OutputStream os=
((oracle.sql.CLOB)quoteBodyClob).getAsciiOutputStream();
byte[] b = body.getBytes("ASCII");
os.write(b);
os.flush();
os.close();
PreparedStatement pstmt = con.prepareStatement(
"UPDATE CLOBNEWS SET BODY = ? WHERE ITEMID = " + nextItemID);
pstmt.setClob(5, quoteBodyClob);