你改成这样试试吧
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");
}
...
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");
}
...
解决方案 »
- 用JAVA 画一个3D的笑脸 求助高手
- jsp调用日历并计入用户所选择的时间
- 拜求!JS:怎么样通过判断一个文本框是否有值让一个不可用的按钮可用
- 怎样将class文件变成可执行的jar文件。
- 为什么老是usebean有错呀???
- 在JSP/SERVLET中使用form认证(j_security_check)时登录时总出错,出错还没信息可得!(急)
- 关于Mysql数据库备份的问题 请高手指点
- jsp中如何实现delete功能
- java applet和javascript的一个问题
- 关于用jsp处理上传下载遇到的问题(请路人甲和高手们指点)
- jsp orcale 的连接问题。--------在线等!
- 请问如何用ASP+XML实现论坛左边的树状显示?
顺便问问,我用上面的方法可以插入日期,但是用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;
这样插入日期行吗? 多多指教,分不够再加!
先谢谢了! :)
也有可能to_date的?号不符合mm/dd/yy的格式要求,例如to_date('99/99/99','mm/dd/yy')是非法的
你再查查吧