你改成这样试试吧
try{
   Connection conn = null;
   PreparedStatement pstmt = null;
   FileInputStream fis=null;
   File file = new File(fulltext);
   fis = new FileInputStream(file);
   pstmt = conn.prepareStatement ("insert into mypaper values    ('"+ISBN+"','"+ptitle+"','"+author+"','"+journal+"',to_date('"+pdate+"','mm/dd/yyyy'),'"+introduction+"',?)");   ps.setBinaryStream(1, fis, (int) file.length());
   pstmt.execute ();
 } catch(FileNotFoundException e) {
       return ("<P>" + e + "</P>\n");
}
...
  

解决方案 »

  1.   

    谢谢! 行了.
    顺便问问,我用上面的方法可以插入日期,但是用String ISBN ="'"+ request.getParameter("ISBN")+"'";
    String ptitle = "'"+request.getParameter("title")+"'";
    String author = "'"+request.getParameter("author")+"'";
    String journal = "'"+request.getParameter("journal")+"'";
    String pdate = "'"+request.getParameter("pdate")+"'";
    String introduction = "'"+request.getParameter("introduction")+"'";
    String fulltext = request.getParameter("fulltext");
    ... 
    pstmt = conn.prepareStatement ("insert into mypaper values (?,?,?,?,to_date(?,'mm/dd/yy'),?,?)");pstmt.setString (1, ISBN);          
    pstmt.setString (2, ptitle); 
    pstmt.setString (3, author);
    pstmt.setString (4, journal);
    pstmt.setString (5, pdate);
    pstmt.setString (6, introduction);
    pstmt.setBinaryStream(7, fis, (int) file.length()); 
    pstmt.execute ();老是报 ORA-01858: a non-numeric character was found where a numeric was expected;
    这样插入日期行吗? 多多指教,分不够再加!
    先谢谢了!  :)
      

  2.   

    不一定是日期地方错了,该数字的地方出现了非数字的字符
    也有可能to_date的?号不符合mm/dd/yy的格式要求,例如to_date('99/99/99','mm/dd/yy')是非法的
    你再查查吧
      

  3.   

    OK,I have solved the problem!thanks again! :)