com.ngMAT.Common
クラス DBConnection

java.lang.Object
  |
  +--com.ngMAT.Common.ngmObject
        |
        +--com.ngMAT.Common.DBConnection
すべての実装インタフェース:
java.lang.Cloneable, ngmObjectFunction, java.io.Serializable

public class DBConnection
extends ngmObject

自動拡張型コネクションプーリング機能を提供するDB接続クラス。番犬が別スレッドで見張り、 一定時間以上使用中になっているプールエレメントを強制的に開放する。 Database connection utility class which serves connection pooling with automatic extention. Watch dog in other thread will watch an element which is in use for a long time.
以下のプロパティキーの設定が必要。Ruquires following properties keys.
Database.JDBCDriver=<drivername>
Database.ConnectionURL=<connectionurl>
Database.User=<loginuser>
Database.Password=<loginpassword>


以下のプロパティはオプションです。Following properties are optional.
Database.AutoCommit=<true/false> (default=true)
WatchDog.Interval=<timeinmiliseconds> (default=300000)
WatchDog.Connection.Timeout=<timeinmiliseconds> (default=300000)
WatchDog.Name=&ldname of watch dog> (default=Patrasche)
DBConnection.Log=<logfilepath;> (default is standard output)
DBConnection.DebugMode=<true/false> (default=false) when true, detailed action logs will be written to log.
DBConnection.MaxConnections=<max connection number> (default=32)
DBConnection.Retry.Interval=<timeinmiliseconds> (default=1000)
DBConnection.Retry.Count=<count> (default=0)

関連項目:
直列化された形式

フィールドの概要
protected static DBConnection dbcon
           
static boolean DebugMode
           
static Log StaticLog
           
 com.ngMAT.Common.DBConnection.WatchDog watchdog
           
 
インタフェース com.ngMAT.Common.ngmObjectFunction から継承したフィールド
C_BACKSLASH, C_BLOCK_CLOSE, C_BLOCK_OPEN, C_COMMA, C_CR, C_DOUBLE_QUATATION, C_EQUAL, C_LF, C_SINGLE_QUATATION, C_SPACE, C_TAB, S_BACKSLASH, S_BLOCK_CLOSE, S_BLOCK_OPEN, S_COMMA, S_CR, S_CRLF, S_DOUBLE_QUATATION, S_EQUAL, S_LF, S_SINGLE_QUATATION, S_SPACE, S_TAB
 
メソッドの概要
 HTMLComponent _toHTMLComponent()
           
static java.lang.String _toString()
          現在のプールの状態の文字列表現値を返す。
static java.sql.Connection expandPool()
          強制的にプールを拡張する。
static void forceRelease(int i)
           
static java.sql.Connection getConnection(java.lang.String propfilename)
          指定されたプロパティファイルから設定に基づき使用可能なコネクションをプールから取り出すか、 新たにDBに接続し、Connectionを返す。
static int getPoolSize()
          現在のプールのサイズを返す。
static void releaseConnection(java.sql.Connection con)
          使用済みコネクションをプールに返却する。
static void removeConnection(int index)
          指定された要素をプールから取り除く。
static HTMLComponent toHTMLComponent()
          現在のプールの状態を表現するHTMLコンポーネントを返す。
 
クラス com.ngMAT.Common.ngmObject から継承したメソッド
clone, debug, debug, equals_n, getLog, getProperties, getProperty, setLog, setNgmObject, setProperties
 
クラス java.lang.Object から継承したメソッド
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

dbcon

protected static DBConnection dbcon

watchdog

public com.ngMAT.Common.DBConnection.WatchDog watchdog

StaticLog

public static Log StaticLog

DebugMode

public static boolean DebugMode
メソッドの詳細

getConnection

public static java.sql.Connection getConnection(java.lang.String propfilename)
                                         throws java.lang.Exception
指定されたプロパティファイルから設定に基づき使用可能なコネクションをプールから取り出すか、 新たにDBに接続し、Connectionを返す。 Returns an available connection in a pool or a new connection with the specified properties file.
戻り値:
Connection

expandPool

public static java.sql.Connection expandPool()
強制的にプールを拡張する。 Force expanding a pool size. Usually you don't have to call this method.

releaseConnection

public static void releaseConnection(java.sql.Connection con)
使用済みコネクションをプールに返却する。Returns used connection to the pool.

removeConnection

public static void removeConnection(int index)
指定された要素をプールから取り除く。Removes a connection element from pool.

_toString

public static java.lang.String _toString()
現在のプールの状態の文字列表現値を返す。

forceRelease

public static void forceRelease(int i)

toHTMLComponent

public static HTMLComponent toHTMLComponent()
現在のプールの状態を表現するHTMLコンポーネントを返す。戻り値のtoHTML()を コールすることで、さらにHTML文字列に変換することもできる。

_toHTMLComponent

public HTMLComponent _toHTMLComponent()

getPoolSize

public static int getPoolSize()
現在のプールのサイズを返す。


バグや機能要求の報告
最新の情報
Copyright 2000 - ngMAT Corporation