这样就没有问题了,OK
<%@page contentType="text/html;charset=gb2312"%>
<%@ page language="java" import="java.sql.*,com.jspsmart.upload.*"%>
<%@page import="oracle.sql.*,oracle.jdbc.driver.*" %>
<jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" /><HTML>
<BODY BGCOLOR="white"><H1>jspSmartUpload : Sample 4</H1>
<HR><%
// Connect to the database Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();   
String url="jdbc:oracle:thin:@172.18.16.68:1521:rz817"; 
//orcl为你的数据库的SID 
String user="hr_system"; 
String password="manager"; 
Connection conn= DriverManager.getConnection(url,user,password);   
conn.setAutoCommit(false);
Statement stmt=conn.createStatement();  
stmt.execute("delete from tfile");  
String sPath="";
// Initialization
mySmartUpload.initialize(pageContext); // Upload
mySmartUpload.upload(); // upload file in the DB if this file is not missing
if (!mySmartUpload.getFiles().getFile(0).isMissing()){ try {
String sFileName = mySmartUpload.getFiles().getFile(0).getFileName() ;
mySmartUpload.save("/upload");
sPath = request.getRealPath("/upload/")+sFileName ;
java.io.File file = new java.io.File(sPath);
java.io.FileInputStream fis = new java.io.FileInputStream(file);
PreparedStatement pis =conn.prepareStatement("insert into tfile(id,filename,info) values(?,?,empty_blob())");
pis.setLong(1,1);
pis.setString(2,file.getName());
pis.executeUpdate();
pis.close(); ResultSet rs = stmt.executeQuery("select info from tfile where id=1");
if (rs.next()) {
   //更新BLOB字段,需要注意的是,这里使用的是Oracle的JDBC驱动中的类
   //oracle.sql.BLOB;并且,Resultset需要强制转换为类型
   //Oracle.jdbc.OracleResultSet
   BLOB mybl = ((OracleResultSet)rs).getBLOB(1);
  //获得BLOB字段的写入流
   OutputStream out1 = mybl.getBinaryOutputStream();  
   byte[] buffer = new byte[4096];
   int length = -1;
   //读入文件输入流,并写入BLOB写入流中
   while ((length = fis.read(buffer)) != -1)  
     out1.write(buffer,0,length);
     //关闭输入输出流
   fis.close();
    out1.close();
}
//关闭相关资源
rs.close(); } catch(Exception e) {
out.println("An error occurs : " + e.toString()+":filename="+sPath);
}
}
conn.commit();
stmt.close();
conn.close();%>
</BODY></HTML>