Re: "set lock mode" in java/jdbc
Posted in 2000
Topics: Connectivity: ODBC / JDBC / .NET, Platform-Specific Issues, Java & JDBC Development, Versions, Editions & End-of-Life
Red/Rich This is what we do here... c = DriverManager.getConnection(); s = c.createStatement(); s.execute("SET LOCK MODE TO WAIT"); s.close(); s = c.createStatement(); s.execute("....whatever...."); s.close(); // ...more stuff deleted... c.close(); What is happening here is that we are setting LOCK MODE TO WAIT for the connection c, then using the connection to do other stuff. HTH Sujit Richard Auslander <rich@airflash.com> on 03/03/2000 05:06:30 PM Please respond to Richard Auslander <rich@airflash.com> To: informix-list@iiug.org cc: Subject: Re: "set lock mode" in java/jdbc This is a multi-part message in MIME format. --------------A672AEE95C5DC038C3133C93 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Red - Your great question applies to us here as well, so if and when you do receive an answer, it would be a kindness if you would forward that response. Many thanks ... Rich Red Valsen wrote: > How do vary the lock mode in java/jdbc for Informix? We've been testing > concurrency control with servlets, Apache/Jserver, IDS 7.30 and Solaris > 2.6/x86 (don't ask). We've found that the default lock mode is not, or > doesn't appear to be, as by convention, "not wait": We can execute a > select for update (with a sleep prior to commit for testing)via one > servlet, and select for update on same row in another servlet, but > instead of an error message, the second will wait until the first > completes, then update. > > Has anybody experienced this problem? I'd like to work around it by > explicitly setting lock to "not wait," but haven't discovered the syntax > for this. Can this be done? > > We're using Informix's latest jdbc driver. > > tia -- Richard C. Auslander Database Manager AirFlash, Inc. 1733 Woodside Rd., Suite #110 Redwood City, CA 94061 (650) 556-7928 www.airflash.com --------------A672AEE95C5DC038C3133C93 Content-Type: text/x-vcard; charset=us-ascii; name="rich.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Richard Auslander Content-Disposition: attachment; filename="rich.vcf" begin:vcard n:Auslander;Richard tel;fax:650-556-7930 tel;work:650-556-7928 x-mozilla-html:FALSE url:http://www.airflash.com org:AirFlash, Inc. adr:;;1733 Woodside Road, Suite 110;Redwood City;CA;94061;USA version:2.1 email;internet:rich@airflash.com title:Manager of Database Services fn:Richard Auslander end:vcard --------------A672AEE95C5DC038C3133C93--
Thanks, Sujit, createStatement is the way to mod lock mode. Original problem was caused by setting java "synchronized" keyword in higher level method. All wonderful now, I take back most of bad things I said about Informix in last 72 hrs. Sujit.Pal@bankofamerica.com wrote: > Red/Rich > > This is what we do here... > > c = DriverManager.getConnection(); > s = c.createStatement(); > s.execute("SET LOCK MODE TO WAIT"); > s.close(); > s = c.createStatement(); > s.execute("....whatever...."); > s.close(); > // ...more stuff deleted... > c.close(); > > What is happening here is that we are setting LOCK MODE TO WAIT for the > connection c, then using the connection to do other stuff. > > HTH > Sujit > > Richard Auslander <rich@airflash.com> on 03/03/2000 05:06:30 PM > > Please respond to Richard Auslander <rich@airflash.com> > > To: informix-list@iiug.org > cc: > Subject: Re: "set lock mode" in java/jdbc > > This is a multi-part message in MIME format. > --------------A672AEE95C5DC038C3133C93 > Content-Type: text/plain; charset=us-ascii > Content-Transfer-Encoding: 7bit > > Red - Your great question applies to us here as well, so if and when you do > receive an answer, it would be a kindness if you would forward that > response. Many thanks ... > > Rich > > Red Valsen wrote: > > > How do vary the lock mode in java/jdbc for Informix? We've been testing > > concurrency control with servlets, Apache/Jserver, IDS 7.30 and Solaris > > 2.6/x86 (don't ask). We've found that the default lock mode is not, or > > doesn't appear to be, as by convention, "not wait": We can execute a > > select for update (with a sleep prior to commit for testing)via one > > servlet, and select for update on same row in another servlet, but > > instead of an error message, the second will wait until the first > > completes, then update. > > > > Has anybody experienced this problem? I'd like to work around it by > > explicitly setting lock to "not wait," but haven't discovered the syntax > > for this. Can this be done? > > > > We're using Informix's latest jdbc driver. > > > > tia > > -- > Richard C. Auslander > Database Manager > > AirFlash, Inc. > 1733 Woodside Rd., Suite #110 > Redwood City, CA 94061 > (650) 556-7928 > > www.airflash.com > > --------------A672AEE95C5DC038C3133C93 > Content-Type: text/x-vcard; charset=us-ascii; > name="rich.vcf" > Content-Transfer-Encoding: 7bit > Content-Description: Card for Richard Auslander > Content-Disposition: attachment; > filename="rich.vcf" > > begin:vcard > n:Auslander;Richard > tel;fax:650-556-7930 > tel;work:650-556-7928 > x-mozilla-html:FALSE > url:http://www.airflash.com > org:AirFlash, Inc. > adr:;;1733 Woodside Road, Suite 110;Redwood City;CA;94061;USA > version:2.1 > email;internet:rich@airflash.com > title:Manager of Database Services > fn:Richard Auslander > end:vcard > > --------------A672AEE95C5DC038C3133C93--