01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
10: package org.mmbase.module.database;
11:
12: import java.sql.*;
13:
14: import org.mmbase.util.logging.Logger;
15: import org.mmbase.util.logging.Logging;
16:
17: /**
18: * This class sets the 'lock mode' to 30.
19: * @author vpro
20: * @version $Id: DatabaseSupportInformix.java,v 1.7 2007/11/02 11:34:42 michiel Exp $
21: * @deprecated Use ;IFX_LOCK_MODE_WAIT=31 on the connection string in jdbc.xml in stead
22: */
23: public class DatabaseSupportInformix implements DatabaseSupport {
24:
25: private static final Logger log = Logging
26: .getLoggerInstance(DatabaseSupportInformix.class);
27:
28: public void init() {
29: }
30:
31: public void initConnection(Connection con) {
32: setLockMode(con, 30);
33: }
34:
35: protected void setLockMode(Connection con, int sec) {
36: PreparedStatement statement;
37: try {
38: if (sec > 0) {
39: statement = con
40: .prepareStatement("set lock mode to wait "
41: + sec);
42: } else {
43: statement = con
44: .prepareStatement("set lock mode to wait");
45: }
46: statement.executeUpdate();
47: statement.close();
48: } catch (Exception e) {
49: log.error("failed to set lock mode " + e, e);
50: }
51: }
52: }
|