Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

cannot execute insert statement two times in WSAD  RSS feed

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A code example may help.
 
Jenny Kalinina
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thanks

(edited by Cindy to format code using [ code] and [ /code] tags without the spaces)
[ June 02, 2003: Message edited by: Cindy Glass ]
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to clear the parameters after inserting a row and then set the fresh set of parameters again.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!