你改成这样试试吧
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如何判断用户有没有登陆
- 怎么去掉文本的换行符
- 求js表单验证
- 数组作为javaBean的一个参数传递,怎么传
- 用jxl的方法读取excel文件内容,然后导入到数据库中。数据是乱码?
- new ActiveXObject("Word.Application")打开文档的问题
- 请问:在TOMCAT怎样建立虚拟目录?(例如D:\BBS)class/javabean分别存放在哪里?
- 高分求救JSP和MYSQL的连接问题!!
- 大家来看看,在JB7里用TOMCAT的问题。(在线,解决马上给分)
- 这段简单的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')是非法的
你再查查吧