试试:
<%@page contentType="text/html;charset=gb2312"%>
<%@ page language="java" import="java.sql.*,com.jspsmart.upload.*"%>
<jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" /><HTML>
<BODY BGCOLOR="white"><H1>jspSmartUpload : Sample 4</H1>
<HR><%
// Connect to the databaseClass.forName("oracle.jdbc.driver.OracleDriver").newInstance();   
String url="jdbc:oracle:thin:@192.168.4.105:1521:dbName"; 
//orcl为你的数据库的SID 
String user="uNane"; 
String password="pass"; 
Connection conn= DriverManager.getConnection(url,user,password);   
Statement stmt=conn.createStatement();   // 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");
String sPath = request.getRealPath("/upload/")+sFileName ;
java.io.File file = new java.io.File(sPath);
java.io.FileInputStream fis = new java.io.FileInputStream(file);
PreparedStatement ps = 
conn.prepareStatement("insert into tfile values (?,?,?)");
ps.setInt(1,3);
ps.setString(2,file.getName());
ps.setBinaryStream(3,fis,(int)file.length());
ps.executeUpdate();
ps.close();
fis.close(); } catch(Exception e) {
out.println("An error occurs : " + e.toString());
}
}stmt.close();
conn.close();%>
</BODY></HTML>—————————————————————————————————
寂寞山庄------离人网