KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > module > database > DatabaseSupportInformix


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

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  * Interface to support specific database things
19  * for the JDBC module
20  * @duplicate extend {@link DatabaseSupport} instead of implementing it.
21  * @author vpro
22  * @version $Id: DatabaseSupportInformix.java,v 1.6 2004/10/07 17:22:34 pierre Exp $
23  */

24 public class DatabaseSupportInformix implements DatabaseSupport {
25
26     private static Logger log = Logging.getLoggerInstance(DatabaseSupportInformix.class.getName());
27
28     public void init() {
29     }
30
31     public void initConnection(Connection con) {
32         setLockMode(con,30);
33     }
34
35     public void setLockMode(Connection con,int sec) {
36         PreparedStatement statement;
37         try {
38             if (sec>0) {
39                 statement=con.prepareStatement("set lock mode to wait "+sec);
40             } else {
41                 statement=con.prepareStatement("set lock mode to wait");
42             }
43             statement.executeUpdate();
44             statement.close();
45         } catch (Exception JavaDoc e) {
46             log.error("failed to set lock mode "+e);
47             log.error(Logging.stackTrace(e));
48         }
49     }
50 }
51
Popular Tags