Sie sind auf Seite 1von 3

Shot Formats Digital Productions Pvt Ltd.

Common Utilities
DB Adapter

Author

Shotformats

Version

1.0

Date

29/11/2016

Copyright to Shot Formats Digital Productions Pvt Ltd.

Page 1

Shot Formats Digital Productions Pvt Ltd.

Introduction
DB Adapter application is used to form connection pooling and execute queries with the
database of the following type using JDBC:
1.
2.
3.
4.
5.
6.

Oracle
Mysql
Db2
Db2-7
Mssql
Access

How to use
DB Adapter application should be used with the name dbadapter-v1.0.jar. Following are
the steps to be followed for using the jar file.
1. Create a property file named dbadapter.properties and put entries as given
below:
#[MYSQL]
#[Configurations for SDPWAP Portal]
SDPWAP=SDPWAP
SDPWAP_DBPORT=3306
SDPWAP_DBTYPE=mysql
SDPWAP_DBUSER=root
SDPWAP_DBPASS=root
SDPWAP_DBHOST=localhost
SDPWAP_DBMAXCONN=10
SDPWAP_DBNAME=test
SDPWAP_QUERYLOGPATH=<query log path>
SDPWAP_LOGINGMODEBIT=<refer step 2 to form LOGINGMODEBIT>
#[End of Configurations for SDPWAP Portal]
2. Following are the logging mode names and their values :
INFO=1
DEBUG=2
WARNING=3
ERROR=4
CRITICAL=5
AUDIT=6
QUERY=7
For example: to enable INFO and QUERY mode, the LOGINGMODEBIT will be
(21+27) =130

Sample code to use the jar


DBManager dbm = new DBManager("SDPWAP");
Vector result = dbm.executeSelectQuery("select * from TEST");

Copyright to Shot Formats Digital Productions Pvt Ltd.

Page 2

Shot Formats Digital Productions Pvt Ltd.


if(result != null && result.size() > 0){
for(int loop=0; loop<result.size(); loop++){
System.out.println((String)result.elementAt(loop));
}
}

Copyright to Shot Formats Digital Productions Pvt Ltd.

Page 3

Das könnte Ihnen auch gefallen