|
Hi, you have two possibilities: 1. synchronize on the connection object 2. use a seperate connection for every transaction second would be state of the art, using a connection pool. Dieter On Friday 07 March 2003 20:24, you wrote: > I am having a problem with a stored procedure. Hopefully, someone has > experience with this. Here is my environment. > > - Jakarta Tomcat 4.0.4 running on iSeries. > - Servlet calls a stored procedure to get list of results. > - Stored Procedure is written in RPG, running on same iSeries. > > Everything works great when there are not simultanious requests to the > same Stored Procedure. If two users request the results at > approximately the same time, one of them doesn't get any results. From > what I can tell, the second person to request the results get the > results, and the first person gets none. > > I have verified that the Servlet (as expected) is being executed in two > seperate threads. The Connection and the CallableStatement are declared > as fields (class level variables). The ResultSet is a local variable > that immediately gets turned into an ArrayList which is passed to a JSP > page for display. So, I am using the same Connection for every user, > and calling the "executeQuery()" method on the same CallableStatement. > > Can anyone see what is wrong? My guess is that this connection is being > serviced by the same QZDASOINIT prestart job, therefore it is > technically the same job that is calling the Stored Procedure each time, > and that is why it can't handle multi-threading. Does anyone know how > to get around this? Should I create a seperate Connection object for > each user? That seems ineffecient. > > _______________________________________________ > This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) > mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/java400-l > or email: JAVA400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/java400-l. -- mfG Dieter Bender DV-Beratung Dieter Bender Wetzlarerstr. 25 35435 Wettenberg Tel. +49 641 9805855 Fax +49 641 9805856 www.bender-dv.de
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.