日期:2014-05-19  浏览次数:20697 次

Oracle高手进入帮忙解决个奇怪的问题
代码如:
conn=DBConn.getConn();
pst=conn.prepareStatement(sb.toString());
pst.setString(1, gp.getServiceID());
pst.setString(2, gp.getServiceUrl());
pst.setString(3, gp.getReadme());
pst.setString(4, gp.getVersions());
pst.setString(5, "1");
pst.setString(6, "");
pst.setTimestamp(7, new Timestamp(System.currentTimeMillis()));
i = pst.executeUpdate();
rs = pst.getGeneratedKeys();
if (rs != null&&rs.next()) {
return rs.getInt(1);
}
我是想插入数据库后获取该数据的id,原来在MySql上是问题的,迁移到了Oracle之后就报错了,错误如下,高手看下:

java.sql.SQLException: 不允许的操作
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
at oracle.jdbc.driver.OracleStatement.getGeneratedKeys(OracleStatement.java:4563)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatement.java:100)
at org.logicalcobwebs.proxool.ProxyStatement.intercept(ProxyStatement.java:57)
at oracle.jdbc.OracleStatement$$EnhancerByProxool$$f76e3bca.getGeneratedKeys(<generated>)
at com.ourpalm.mis.newbilling.content.dao.ContentDao.insertPreReId(ContentDao.java:509)
at com.ourpalm.mis.newbilling.content.service.ContentService.listsheetVideo(ContentService.java:904)
at com.ourpalm.mis.newbilling.content.service.ContentService.listFile(ContentService.java:91)
at com.ourpalm.mis.newbilling.content.servlet.ContentServlet.ZipUpLoad(ContentServlet.java:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.ourpalm.mis.common.util.BaseServlet.doGet(BaseServlet.java:40)
at com.ourpalm.mis.common.util.BaseServlet.doPost(BaseServlet.java:66)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.ourpalm.mis.common.util.FilterServlet.doFilter(FilterServlet.java:25)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.ourpalm.mis.common.util.FilterServlet.doFilter(FilterServlet.java:25)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(Stan