01: package com.teamkonzept.webman.db;
02:
03: import com.teamkonzept.db.*;
04: import com.teamkonzept.lib.*;
05:
06: import java.io.*;
07: import java.util.*;
08: import java.sql.*;
09: import org.apache.log4j.Category;
10:
11: public class TKWebmanDBManager extends TKDBManager {
12:
13: private static final Category CAT = Category
14: .getInstance(TKWebmanDBManager.class);
15:
16: private static String dbId;
17:
18: public static synchronized void initConnection(String filename,
19: boolean reload) throws TKException {
20:
21: register("TKWebManDBManager");
22: if (reload || dbId == null) {
23: resetContext();
24: CAT.debug("reading IniFile:'" + filename);
25:
26: PropertyManager man = PropertyManager
27: .getPropertyManager(filename);
28:
29: if (reload)
30: man.doReload();
31:
32: dbId = man.getValue("DATABASE");
33: String licences = man.getValue("LICENCES");
34:
35: if (licences != null)
36: limitConnections(Integer.parseInt(licences));
37:
38: Properties prop = new Properties();
39: prop.setProperty("database", dbId);
40: prop.setProperty("host", man.getValue("HOST"));
41: prop.setProperty("user", man.getValue("USER"));
42: prop.setProperty("password", man.getValue("PASSWD"));
43:
44: try {
45: //prepareConnection(dbId, serverId, prop);
46: prepareConnection(prop);
47: } catch (SQLException sqle) {
48: throw new TKSQLError(sqle);
49: }
50: }
51: }
52: }
|