Pessoal,
O código abaixo esta funcionando apenas para arquivos menores que 4,00 KB, quando tento inserir um arquivo maior ocorre o seguinte problema na linha 22:
Exceção de E/S: Connection reset by peer: socket write error
Estou usando Struts 1.2 e banco Oracle
Se alguem puder ajudar obrigado.
public void insert(AttachmentVO att) throws OFDBException {
PreparedStatement statement = null;
try {
int intValue = getNextAttachmentFileSeq(att.getProcId(), att
.getNumproc().intValue());
statement = getConnection()
.prepareStatement(
"INSERT INTO GPNANEXO.TGP_ANEXO (GPCDPROCID, GPNUMPROC, GPFILESEQ, GPNMFILE, GPCDUSER, GPANEXO) VALUES (?,?,?,?,?,?)");
statement.setString(1, att.getProcId());
statement.setInt(2, att.getNumproc().intValue());
statement.setInt(3, intValue);
statement.setString(4, att.getNomeArquivo());
statement.setString(5, att.getUsuario());
statement.setBinaryStream(6, att.getAttachment(), att
.getAttachmentSize());
statement.executeUpdate();
} catch (Exception e) {
throw new OFDBException(e);
} finally {
if (null != statement){
try {
statement.close();
} catch (SQLException e) {
throw new OFDBException(e);
}
}
}
}