If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > JDBC - Using SET LOCK MODE TO WAIT s

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-15-05, 09:10
thorkristensen thorkristensen is offline
Registered User
 
Join Date: Nov 2005
Posts: 1
Question JDBC - Using SET LOCK MODE TO WAIT s

My Java application performs an SQL query including all rows from a table that's sometimes being modified at the time of the query executing.
Thus, I'm experiencing SQL Exceptions because the default behaviour in Dynamic Server is "LOCK MODE SET TO NOT WAIT".
I have set the lock mode for the table to "LOCK MODE ROW", to minimize the lockng scope.
What i need now is to set "SET LOCK MODE TO WAIT 5" on each Connection created against the database. Now my questions are fairly simple.
  1. Is it necessary to execute an SQL call for every single JDBC connection against the database?
  2. Is there a way to make all connections to that specifix database obey the "WAIT 5" rule?

Please note that I cannot set the "WAIT 5" on the entire dbms instance (even if it was possible) since there are other databases not needing this setting.

TIA!

Regards
Thor
Reply With Quote
  #2 (permalink)  
Old 11-15-05, 13:33
ServerMetrics ServerMetrics is offline
Registered User
 
Join Date: May 2004
Posts: 45
Hi Thor,

I believe it has to be issued for each connection. As far as I'm aware there is no ONCONFIG or environment variable that can turn it on for all connections to either a particular db or informix server.
__________________
Keith Brownlow
ServerMetrics DB Monitoring (www.servermetrics.com)
Reply With Quote
  #3 (permalink)  
Old 11-15-05, 22:43
hoopsm hoopsm is offline
Registered User
 
Join Date: Oct 2005
Posts: 6
Yes, as far as I am awre each session must have lock mode set.

There is an environment variable IFX_TABLE_LOCKMODE which sounds like it might be in this league, however I cannot find any information on it other than a brief reference to it in the SQL Syntax Guide under the SET LOCK MODE section.
Reply With Quote
  #4 (permalink)  
Old 11-17-05, 13:32
ServerMetrics ServerMetrics is offline
Registered User
 
Join Date: May 2004
Posts: 45
The IFX_TABLE_LOCKMODE env. variable and DEF_TABLE_LOCKMODE ONCONFIG parameter unfortunately are not what you are looking for. They deal with setting the default locking mode for data.

Informix can lock either a specific row on a page or all rows on a page that the row being locked resides on. This can improve performance if there is a high probablility you want locked access to many rows, but obviously decreases concurrency. The manual mentions them in conjunction with SET LOCK MODE as they can influence how SET LOCK MODE works - page level locking produces a higher probability that a connection with SET LOCK MODE enabled will run into a locked page. Hope this helps.
__________________
Keith Brownlow
ServerMetrics DB Monitoring (www.servermetrics.com)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On