KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > teamkonzept > webman > db > TKWebmanDBManager


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