It's not a secret anymore!*
The moose likes Java in General and the fly likes cannot execute insert statement two times in WSAD Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "cannot execute insert statement two times in WSAD" Watch "cannot execute insert statement two times in WSAD" New topic
Author

cannot execute insert statement two times in WSAD

Jenny Kalinina
Ranch Hand

Joined: Nov 07, 2002
Posts: 52
Hi,
Looks like I have Java/WSAD related problem.
I need to insert into table with big number of columns (69). So I create sql string dynamically to have "insert tblname (columnsName, ...) values (?,?,?,?...)" and then use loop with prepStmt.Set... to set parameter values. It works only one time. When I try to call that business method to insert one more row, it gives the error "IndexOutOfBoundsException" and always on parameter #33, i.e it cannot set parameter #33. I've check the number of parameters is correct and equals to 69. Could somebody helps what the reason of the error is?
Thanks in advance
Output:
[6/2/03 9:39:48:914 EDT] cd190b8 SystemOut O setSQLParameter starts par=33 null
[6/2/03 9:39:48:914 EDT] cd190b8 SystemOut O if block className= java.lang.Stringindex= 33
[6/2/03 9:39:48:914 EDT] cd190b8 SystemOut O Exception in else block: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
[6/2/03 9:39:48:914 EDT] cd190b8 SystemErr R java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
[6/2/03 9:39:48:914 EDT] cd190b8 SystemErr R at java.util.ArrayList.RangeCheck(ArrayList.java(Compiled Code))
[6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at java.util.ArrayList.set(ArrayList.java:343)
[6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.countParameter(WSJdbcPreparedStatement.java:355)
[6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.setString(WSJdbcPreparedStatement.java:1206)
[6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at eclientprofile.session.AssignServiceBean.setSQLParm(AssignServiceBean.java:372)
[6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at eclientprofile.session.AssignServiceBean.insertRow(AssignServiceBean.java:671)
[6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at eclientprofile.session.AssignServiceBean.addAssgn(AssignServiceBean.java:558)
[6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at eclientprofile.session.EJSRemoteStatelessAssignService_9ace9c43.addAssgn(EJSRemoteStatelessAssignService_9ace9c43.java:142)
[6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at java.lang.reflect.Method.invoke(Native Method)
[6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at com.ibm.rmi.corba.ServantObjectImpl$3.run(ServantObjectImpl.java:223)
[6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at java.security.AccessController.doPrivileged(Native Method)
[6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at com.ibm.rmi.corba.ServantObjectImpl.invoke(ServantObjectImpl.java:221)
[6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at $Proxy1.addAssgn(Unknown Source)
[6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at eclientprofile.session._AssignService_Stub.addAssgn(_AssignService_Stub.java:328)
[6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at java.lang.reflect.Method.invoke(Native Method)
[6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at com.ibm.etools.utc.model.ReflectionMethodModel.invoke(ReflectionMethodModel.java:68)
[6/2/03 9:39:48:934 EDT] cd190b8 SystemErr R at com.ibm.etools.utc.servlet.InvokeServlet.invoke(InvokeServlet.java:110)
[6/2/03 9:39:48:934 EDT] cd190b8 SystemErr R at com.ibm.etools.utc.servlet.InvokeServlet.doPost(InvokeServlet.java:323)
[6/2/03 9:39:48:934 EDT] cd190b8 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
[6/2/03 9:39:48:934 EDT] cd190b8 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
[6/2/03 9:39:48:934 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
[6/2/03 9:39:48:934 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
[6/2/03 9:39:48:934 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
[6/2/03 9:39:48:934 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
[6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:258)
[6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
[6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
[6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:872)
[6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:491)
[6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:173)
[6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
[6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:199)
[6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
[6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
[6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:187)
[6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:331)
[6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
[6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:432)
[6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:343)
[6/2/03 9:39:48:974 EDT] cd190b8 SystemErr R at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
A code example may help.
Jenny Kalinina
Ranch Hand

Joined: Nov 07, 2002
Posts: 52

Thanks

(edited by Cindy to format code using [ code] and [ /code] tags without the spaces)
[ June 02, 2003: Message edited by: Cindy Glass ]
Shoba Ramachandran
Ranch Hand

Joined: Mar 29, 2001
Posts: 68
You need to clear the parameters after inserting a row and then set the fresh set of parameters again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cannot execute insert statement two times in WSAD