anjumol
01-29-2009, 05:45 AM
//Inserting into db################################################
sqlText = "INSERT INTO SUR_CASEDOCDTLS"+
"VALUES("+
" '" +entityid+ "', " +
" '" +caseid+ "', " +
" '" +docname+ "', " +
" '" +docid+ "', " +
" '" +statuscode+ "', " +
" '" +status+ "', " +
"EMPTY_BLOB(), " +
" '" +refid+ "', " +
" '" +i+ "', " +
" '" +size+ "', " +
" '" +user+ "', " +
" '" +att_purp+ "', " +
" '" +text_fsd+ "', " +
" '" +type+ "', " +
" '" +date1+ "', " +
" '" +inputBinaryFileName+ "', " +
" '" +filename+ "', " +
" '" +i+ "', " +
" SYSDATE " +
" )";
stmt.executeUpdate(sqlText);
sqlText ="SELECT CASEDOCUMENT FROM SUR_CASEDOCDTLS WHERE ID = "+i+" " +"FOR UPDATE";
rset = stmt.executeQuery(sqlText);
rset.next();
file = ((OracleResultSet) rset).getBLOB("CASEDOCUMENT");
chunkSize = file.getChunkSize();
binaryBuffer = new byte[chunkSize];
position = 1;
while ((bytesRead = inputFileInputStream.read(binaryBuffer)) != -1)
{
position += bytesRead;
totbytesRead += bytesRead;
totbytesWritten += bytesWritten;
}
inputFileInputStream.close();
conn.commit();
rset.close();
conn.close();
} //try closing here###############################
catch (IOException e)
{
out.println("Caught I/O Exception: (Write BLOB value - Stream Method).");
e.printStackTrace();
throw e;
}
catch (SQLException e)
{
out.println("Caught SQL Exception: (Write BLOB value - Stream Method).");
out.println("SQL:\n" + sqlText);
e.printStackTrace();
throw e;
}
%><div id="div1">
<label id="attachPurpose_label" style="position:absolute;top:80;left:35;width:131;height:17" for = "label_attachPurpose" >Attach Purpose</label>
<select name="bx_attachPurpose" id="bx_attachPurpose" style="position:absolute;top:80;left:142;width:145;height:17" >
<option value="" id="" selected ></option>
<option value="1" id="1"> Online</option>
<option value="2" id="2"> Offline</option>
</select>
<!--input type="radio" name="att_pur" id="online_rd" style="position:absolute;top:80;left:112;width:131;height:18" value="" >
<label id="online_label" style="position:absolute;top:80;left:185;width:131;height:17" for = "label_online">Online</label>
<input type="radio" name="att_pur" id="offline_rd" style="position:absolute;top:80;left:170;width:131;height:18"value="" >
<label id="offline_label" style="position:absolute;top:80;left:243;width:131;height:17" for = "label_offline">Offline</label-->
<!--input type="radio" id="online_rd" name="att_pur" style="position:absolute;top:79;left:167;" value="" >
<label id="online_label" style="position:absolute;top:80;left:185;width:131;height:17" for = "label_online">Online</label>
<input type="radio" name="att_pur"id="offline_rd" value="" style="position:absolute;top:79;left:225;">
<label id="offline_label" style="position:absolute;top:80;left:243;width:131;height:17" for = "label_offline">Offline</label-->
<label id="alertID_label" style="position:absolute;top:80;left:495;width:131;height:18" for = "alert_caseID" >AlertID</label>
<input type="text" name="txt_alertID" id="txt_alertID" style="position:absolute;top:80;left:555;width:131;height:19">
<label id="caseID_label" style="position:absolute;top:120;left:35;width:131;height:18" for = "label_caseID" >CaseID</label>
<input type="file" name="txt_caseID" id="txt_caseID" style="position:absolute;top:120;left:142;width:231;height:19">
<label id="file1_label" style="position:absolute;top:200;left:35;width:131;height:18" for = "label_file1" >File</label>
<input type="file" name="txt_file1" id="txt_file1" style="position:absolute;top:200;left:142;width:231;height:19">
<label id="fsd1_label" style="position:absolute;top:200;left:405;width:131;height:18" for = "label_fsd1" >File Description</label>
<input type="text" name="txt_fsd1" id="txt_fsd1" style="position:absolute;top:200;left:515;width:221;height:19">
<input type="button" name="btn_del" id="btn_del1" style="position:absolute;top:200;left:765;width:71;height:19" value="Delete" >
<input type="button" name="btn_att" id="btn_att" style="position:absolute;top:30;left:765;width:71;height:19" value="Attach" onclick=" busy();">
<input type="button" name="btn_more" id="btn_more" style="position:absolute;top:30;left:845;width:71;height:19" value="More" onclick="generateRow(); cursor_wait();">
<input type="hidden" name="hiddenTextBox">
</div>
</body>
</html>
Can anyone help me.......?:o:o:o:o
Thanks in advance.......
sqlText = "INSERT INTO SUR_CASEDOCDTLS"+
"VALUES("+
" '" +entityid+ "', " +
" '" +caseid+ "', " +
" '" +docname+ "', " +
" '" +docid+ "', " +
" '" +statuscode+ "', " +
" '" +status+ "', " +
"EMPTY_BLOB(), " +
" '" +refid+ "', " +
" '" +i+ "', " +
" '" +size+ "', " +
" '" +user+ "', " +
" '" +att_purp+ "', " +
" '" +text_fsd+ "', " +
" '" +type+ "', " +
" '" +date1+ "', " +
" '" +inputBinaryFileName+ "', " +
" '" +filename+ "', " +
" '" +i+ "', " +
" SYSDATE " +
" )";
stmt.executeUpdate(sqlText);
sqlText ="SELECT CASEDOCUMENT FROM SUR_CASEDOCDTLS WHERE ID = "+i+" " +"FOR UPDATE";
rset = stmt.executeQuery(sqlText);
rset.next();
file = ((OracleResultSet) rset).getBLOB("CASEDOCUMENT");
chunkSize = file.getChunkSize();
binaryBuffer = new byte[chunkSize];
position = 1;
while ((bytesRead = inputFileInputStream.read(binaryBuffer)) != -1)
{
position += bytesRead;
totbytesRead += bytesRead;
totbytesWritten += bytesWritten;
}
inputFileInputStream.close();
conn.commit();
rset.close();
conn.close();
} //try closing here###############################
catch (IOException e)
{
out.println("Caught I/O Exception: (Write BLOB value - Stream Method).");
e.printStackTrace();
throw e;
}
catch (SQLException e)
{
out.println("Caught SQL Exception: (Write BLOB value - Stream Method).");
out.println("SQL:\n" + sqlText);
e.printStackTrace();
throw e;
}
%><div id="div1">
<label id="attachPurpose_label" style="position:absolute;top:80;left:35;width:131;height:17" for = "label_attachPurpose" >Attach Purpose</label>
<select name="bx_attachPurpose" id="bx_attachPurpose" style="position:absolute;top:80;left:142;width:145;height:17" >
<option value="" id="" selected ></option>
<option value="1" id="1"> Online</option>
<option value="2" id="2"> Offline</option>
</select>
<!--input type="radio" name="att_pur" id="online_rd" style="position:absolute;top:80;left:112;width:131;height:18" value="" >
<label id="online_label" style="position:absolute;top:80;left:185;width:131;height:17" for = "label_online">Online</label>
<input type="radio" name="att_pur" id="offline_rd" style="position:absolute;top:80;left:170;width:131;height:18"value="" >
<label id="offline_label" style="position:absolute;top:80;left:243;width:131;height:17" for = "label_offline">Offline</label-->
<!--input type="radio" id="online_rd" name="att_pur" style="position:absolute;top:79;left:167;" value="" >
<label id="online_label" style="position:absolute;top:80;left:185;width:131;height:17" for = "label_online">Online</label>
<input type="radio" name="att_pur"id="offline_rd" value="" style="position:absolute;top:79;left:225;">
<label id="offline_label" style="position:absolute;top:80;left:243;width:131;height:17" for = "label_offline">Offline</label-->
<label id="alertID_label" style="position:absolute;top:80;left:495;width:131;height:18" for = "alert_caseID" >AlertID</label>
<input type="text" name="txt_alertID" id="txt_alertID" style="position:absolute;top:80;left:555;width:131;height:19">
<label id="caseID_label" style="position:absolute;top:120;left:35;width:131;height:18" for = "label_caseID" >CaseID</label>
<input type="file" name="txt_caseID" id="txt_caseID" style="position:absolute;top:120;left:142;width:231;height:19">
<label id="file1_label" style="position:absolute;top:200;left:35;width:131;height:18" for = "label_file1" >File</label>
<input type="file" name="txt_file1" id="txt_file1" style="position:absolute;top:200;left:142;width:231;height:19">
<label id="fsd1_label" style="position:absolute;top:200;left:405;width:131;height:18" for = "label_fsd1" >File Description</label>
<input type="text" name="txt_fsd1" id="txt_fsd1" style="position:absolute;top:200;left:515;width:221;height:19">
<input type="button" name="btn_del" id="btn_del1" style="position:absolute;top:200;left:765;width:71;height:19" value="Delete" >
<input type="button" name="btn_att" id="btn_att" style="position:absolute;top:30;left:765;width:71;height:19" value="Attach" onclick=" busy();">
<input type="button" name="btn_more" id="btn_more" style="position:absolute;top:30;left:845;width:71;height:19" value="More" onclick="generateRow(); cursor_wait();">
<input type="hidden" name="hiddenTextBox">
</div>
</body>
</html>
Can anyone help me.......?:o:o:o:o
Thanks in advance.......