日期:2014-05-20  浏览次数:20715 次

java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).

java.sql.SQLException:   Parameter   index   out   of   range   (1   >   number   of   parameters,   which   is   0).
at   com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
at   com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:2715)
at   com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:3546)
at   com.achievo.test.team.Connection.ConnectionDB.insert(ConnectionDB.java:170)
at   com.achievo.test.team.DAO.FileDAO.insert(FileDAO.java:111)
at   com.achievo.test.team.po.imp.FilePOImpl.insert(FilePOImpl.java:21)
at   com.achievo.test.team.bo.imp.FileBOImpl.insert(FileBOImpl.java:21)
at   com.achievo.test.team.ui.action.ResourceUploadAction.execute(ResourceUploadAction.java:96)
at   org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at   org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at   org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at   org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at   javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at   com.achievo.test.team.commom.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:39)
at   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at   org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at   org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at   org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at   org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at   org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at   org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at   org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at   org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at   org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at   org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at   org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at   java.lang.Thread.run(Thread.java:595)谁能帮我看下有错在哪里啊?
ConnectionDB.java

public   int   insert(String   sql   ,String   fileID,String   typeID){
int   INSERT_RESULT=0;
con   =   getConnection();
ps   =   con.prepareStatement(sql);
ps.setString(1,   fileID);
ps.setString(2,   typeID);
INSERT_RESULT   =   ps.executeUpdate();
return   INSERT_RESULT;
}

The   insert()   was   been   used   by   this:
fileDAO.java

public   boolean   insert(FileInformation   fileInformation)   {
ConnectionDB   connectionDB;
int   INSERT_RESULT_RETURN   ,INSERT_FILE_TYPE_RETURN=   0;