I am attempting to insert records in a table in which one field is a clob. I have included the inserting logic below in hopes that this will best help explain my issue. Please note that I am trying to upload a file and insert that file directly into a table in an oracle database, so a file is not contained on the file system. This logic does work except for large files. When uploading files closer to 1 MB, the page seems to timeout. Is there something
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page errorPage="JavaError.jsp" %>
<%@ page import="java.io.*,oracle.s
ql.*,java.
text.DateF
ormat,orac
le.jdbc.dr
iver.*,jav
a.util.*,c
om.oreilly
.servlet.m
ultipart.*
, java.sql.*,bulkload.*,gsf.
blk_secure
.RunDosCmd
" %>
<html>
<%
String userid="username";
MultipartParser mp = new MultipartParser(request,50
* 1024 * 1024);
FilePart part = (FilePart)mp.readNextPart(
);
if (part.isFile()) {
String filename = (part).getFileName();
InputStream ins = (part).getInputStream();
BufferedReader buffer = new BufferedReader(new InputStreamReader(ins));
String line = null;
bulkload.OracleConnection oconn = new bulkload.OracleConnection(
"jdbc:orac
le:thin:@d
b:1521:car
tdev",user
id,"passwo
rd");
Connection conn = oconn.getConnection();
PreparedStatement pstmt = null;
conn.setAutoCommit(false);
oracle.sql.CLOB clob = null;
ResultSet rs = null;
java.sql.Timestamp now = new java.sql.Timestamp(System.
currentTim
eMillis())
;
// Create CLOB in the table tblFileCLOBs
pstmt = conn.prepareStatement("ins
ert into tblFileCLOBs values (?,?,empty_clob(),?)");
pstmt.setString(1,filename
);
pstmt.setTimestamp(2,now);
pstmt.setString(3,userid);
pstmt.executeUpdate();
conn.commit();
// Retrieve the newly created CLOB
PreparedStatement pstmt2= conn.prepareStatement("sel
ect lobfilecontents from tblFileCLOBs where cfilename = ? and ddate_loaded = ? and cusername = ? for update");
pstmt2.setString(1,filenam
e);
pstmt2.setTimestamp(2,now)
;
pstmt2.setString(3,userid)
;
rs = pstmt2.executeQuery();
rs.next();
clob = ((OracleResultSet)rs).getC
LOB(1);
// Output the StringBuffer to the CLOB
PrintWriter prnw= new PrintWriter(clob.getCharac
terOutputS
tream(),tr
ue);
while ((line=buffer.readLine()) != null) {
out.println(line);
prnw.println(line);
}
prnw.flush();
buffer.close();
ins.close();
prnw.close();
conn.commit();
pstmt.close();
conn.close();
}
%>
</html>
thanks for any help you can give. I have also post this message on the Oracle Metalink iTAR system. I will update this post if I get a response from them.