public class RunDB
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
BATCH
This integer represent of sql execution type.
|
protected int |
batchBegan |
protected java.lang.String |
CFN_DB2
This integer represent of string for Class.forName(driver) usage.
|
protected java.lang.String |
CFN_HANA
This integer represent of string for Class.forName(driver) usage.
|
protected java.lang.String |
CFN_MARIADB
This integer represent of string for Class.forName(driver) usage.
|
protected java.lang.String |
CFN_MYSQL
This integer represent of string for Class.forName(driver) usage.
|
protected java.lang.String |
CFN_ORACLE
This integer represent of string for Class.forName(driver) usage.
|
protected java.lang.String |
CFN_POSTGRESQL
This integer represent of string for Class.forName(driver) usage.
|
protected java.lang.String |
CFN_SQLSERVER
This integer represent of string for Class.forName(driver) usage.
|
protected java.sql.Connection |
connection |
protected java.lang.String |
connString
Database connection string.
|
protected int |
connType |
protected javax.sql.DataSource |
dataSource
DataSource object instance for data source connection.
|
static int |
DATASOURCE
This integer represent of DB connection type.
|
static int |
DATE
This integer represent of data type.
|
static int |
DB2
This integer represent of DB2 RDBMS type.
|
protected int |
dbSystem
Database system selection integer representation.
|
protected java.lang.String |
defErrStr |
protected java.lang.String |
defMsgScr |
protected java.lang.String |
defResMsg |
static int |
DRIVERMANAGER
This integer represent of DB connection type.
|
protected java.lang.String |
errorString
String for error messages.
|
protected int |
execCount |
static int |
EXECUTE
This integer represent of sql execution type.
|
static int |
HANA
This integer represent of HANA RDBMS type.
|
static int |
INTEGER
This integer represent of data type.
|
protected java.lang.String |
jndiName
jndiName string for data source connection.
|
static int |
MARIADB
This integer represent of MARIADB RDBMS type.
|
protected int |
maxRecord |
protected java.lang.String |
messageScript
String for general messages.
|
static int |
MYSQL
This integer represent of MySQL RDBMS type.
|
static int |
NUMBER
This integer represent of data type.
|
static int |
ORACLE
This integer represent of Oracle RDBMS type.
|
protected java.lang.String |
password |
static int |
POSTGRESQL
This integer represent of Postgresql RDBMS type.
|
static int |
QUERY
This integer represent of sql execution type.
|
protected int |
recordNumber |
protected java.lang.String |
resultMessage
String for DB process results.
|
protected java.sql.ResultSet |
resultSet |
static int |
SQLSERVER
This integer represent of SQL Server RDBMS type.
|
protected java.sql.Statement |
statement |
static int |
STRING
This integer represent of data type.
|
static int |
UPDATE
This integer represent of sql execution type.
|
protected java.lang.String |
url |
protected java.lang.String |
user |
Constructor and Description |
---|
RunDB()
The constructor retrieves no parameter.
|
RunDB(int connType)
The constructor retrieves database connection type.
|
RunDB(int dbSystem,
int connType)
The constructor retrieves database RDBMS type and database connection type.
|
Modifier and Type | Method and Description |
---|---|
void |
closeAll()
This method is useful for closing connection, statement, resultSet object instances.
|
boolean |
connectDB()
Database connection method.
|
int[] |
getBatchReturn()
For getting batch return.
|
java.lang.String |
getCFN_DB2()
For getting class for name DB2
|
java.lang.String |
getCFN_HANA()
For getting class for name HANA
|
java.lang.String |
getCFN_MARIADB()
For getting class for name MARIADB
|
java.lang.String |
getCFN_MYSQL()
For getting class for name MYSQL.
|
java.lang.String |
getCFN_ORACLE()
For getting class for name ORACLE.
|
java.lang.String |
getCFN_POSTGRESQL()
For getting class for name POSTGRESQL.
|
java.lang.String |
getCFN_SQLSERVER()
For getting class for name SQLSERVER.
|
java.sql.Connection |
getConnection()
For getting connection.
|
java.lang.String |
getConnString()
For getting connection string.
|
int |
getConnType()
For getting connType
|
java.lang.Object[][] |
getData(int dataType,
int rowCount,
int fieldCount)
The number of records that have been executed before, the type of data, and retrieves the data according to the number of fields to be drawn from the table (or view).
|
java.sql.Date[][] |
getDateData()
For getting date data.
|
int |
getDbSystem()
For getting dbSystem
|
java.lang.Double[][] |
getDoubleData()
For getting double data.
|
java.lang.String |
getErrorString()
For getting error string.
|
int |
getExecCount()
For getting execCount
|
java.lang.Integer[][] |
getIntegerData()
For getting integer data.
|
int |
getMaxRecord()
For getting max record number
|
java.lang.String |
getMessageScript()
For getting messageScript
|
java.lang.Object[] |
getRefData(int dataType,
int fieldCount)
Retrieves data based on the previously executed reference data query, data type,
and the number of fields to be taken from the table (or views).
|
java.lang.String |
getResultMessage()
For getting resultMessage
|
java.sql.ResultSet |
getResultSet()
For getting resultSet
|
int |
getRowCount()
After the query is created to calculate the number of records, the number of records returned from the query result.
|
java.lang.String[][] |
getStringData()
For getting string data.
|
void |
initRunDB()
For initializing default values.
|
boolean |
isExec()
For getting is exec
|
boolean |
isLocale()
For getting isLocale
|
boolean |
isUpdate()
For getting isUpdate
|
boolean |
runQuery(java.lang.String[] queryString,
int arrayNo,
int queryType)
Runs the query based on the query type and the order in the query array.
|
void |
setBatchBegan(int batchBegan)
For setting batch began number
|
void |
setCFN_DB2(java.lang.String CFN_DB2)
For setting class for name DB2.
|
void |
setCFN_HANA(java.lang.String cFN_HANA)
For setting class for name HANA.
|
void |
setCFN_MARIADB(java.lang.String cFN_MARIADB)
For setting class for name MARIADB.
|
void |
setCFN_MYSQL(java.lang.String CFN_MYSQL)
For setting class for name MYSQL
|
void |
setCFN_ORACLE(java.lang.String CFN_ORACLE)
For setting class for name ORACLE.
|
void |
setCFN_POSTGRESQL(java.lang.String CFN_POSTGRESQL)
For setting class for name POSTGRESQL.
|
void |
setCFN_SQLSERVER(java.lang.String CFN_SQLSERVER)
For setting class for name SQLSERVER
|
boolean |
setConnection()
Database connection method. if connType is DATASOURCE, Connects to the database by using the jndiName.
|
void |
setConnection(java.sql.Connection connection)
For setting connection.
|
void |
setConnString(java.lang.String connString)
For setting connection string.
|
void |
setConnType(int connType)
For setting connType
|
void |
setDB(int dbSystem,
java.lang.String connString)
This method set DB connection info for DRIVERMANAGER type.
|
void |
setDB(int dbSystem,
java.lang.String url,
java.lang.String user,
java.lang.String password)
This method set DB connection info for DRIVERMANAGER type.
|
void |
setDB(java.lang.String jndiName)
This method set DB connection info for DATASOURCE type.
|
void |
setDbSystem(int dbSystem)
For setting dbSystem
|
void |
setDefErrStr(java.lang.String defErrStr)
For setting defErrStr
|
void |
setDefMsgScr(java.lang.String defMsgScr)
For setting defMsgScr
|
void |
setDefResMsg(java.lang.String defResMsg)
For setting defResMsg
|
void |
setLocale(boolean isLocale)
For setting isLocale
|
void |
setMaxRecord(int maxRecord)
For setting max record number.
|
void |
setMessageBean(boolean isLocale)
For initializing default messages.
|
void |
setUpdate(boolean isUpdate)
For setting isUpdate
|
public static final int MYSQL
public static final int SQLSERVER
public static final int ORACLE
public static final int POSTGRESQL
public static final int DB2
public static final int HANA
public static final int MARIADB
public static final int EXECUTE
public static final int QUERY
public static final int UPDATE
public static final int BATCH
public static final int DATASOURCE
public static final int DRIVERMANAGER
public static final int STRING
public static final int INTEGER
public static final int DATE
public static final int NUMBER
protected java.lang.String CFN_MYSQL
protected java.lang.String CFN_SQLSERVER
protected java.lang.String CFN_POSTGRESQL
protected java.lang.String CFN_ORACLE
protected java.lang.String CFN_DB2
protected java.lang.String CFN_HANA
protected java.lang.String CFN_MARIADB
protected java.lang.String connString
protected java.lang.String url
protected java.lang.String user
protected java.lang.String password
protected int dbSystem
protected java.lang.String defErrStr
protected java.lang.String defMsgScr
protected java.lang.String defResMsg
protected java.lang.String errorString
protected java.lang.String messageScript
protected java.lang.String resultMessage
protected java.sql.Connection connection
protected java.sql.Statement statement
protected java.sql.ResultSet resultSet
protected javax.sql.DataSource dataSource
protected java.lang.String jndiName
protected int recordNumber
protected int connType
protected int execCount
protected int maxRecord
protected int batchBegan
public RunDB()
public RunDB(int connType)
connType
- The database connection type.public RunDB(int dbSystem, int connType)
dbSystem
- The database RDBMS type.connType
- The database connection type.public void initRunDB()
public void setMessageBean(boolean isLocale)
isLocale
- If true is locale messages else English messages.public void setDB(int dbSystem, java.lang.String connString)
dbSystem
- is Database management system specifier.connString
- is The database connection object string.public void setDB(java.lang.String jndiName)
jndiName
- is The database jndi name.public void setDB(int dbSystem, java.lang.String url, java.lang.String user, java.lang.String password)
dbSystem
- is Database management system specifier.url
- is The database connection url.user
- is The database connection user.password
- is The database connection password.public boolean setConnection()
public boolean connectDB() throws java.sql.SQLException
java.sql.SQLException
- The error message (errorString) will occur if the SQL error occurs.public boolean runQuery(java.lang.String[] queryString, int arrayNo, int queryType) throws java.sql.SQLException
queryString
- A set of query clauses.arrayNo
- The order of the query to be executed in the array. The sequence number starts at 0.queryType
- Query type.java.sql.SQLException
- The error message (errorString) will occur if the SQL error occurs.public java.lang.Object[][] getData(int dataType, int rowCount, int fieldCount) throws java.sql.SQLException
dataType
- The type of data you want to retrieve.rowCount
- The specified number of data to retrieve.fieldCount
- Number of fields to withdraw from tables (or views).java.sql.SQLException
- The error message (errorString) will occur if the SQL error occurs.public java.lang.Object[] getRefData(int dataType, int fieldCount) throws java.sql.SQLException
dataType
- The type of data you want to retrieve.fieldCount
- Number of fields to withdraw from tables (or views).java.sql.SQLException
- The error message (errorString) will occur if the SQL error occurs.public int getRowCount() throws java.sql.SQLException
java.sql.SQLException
- The error message (errorString) will occur if the SQL error occurs.public void closeAll()
public java.sql.Connection getConnection()
public void setConnection(java.sql.Connection connection)
connection
- public java.lang.String getCFN_MYSQL()
public void setCFN_MYSQL(java.lang.String CFN_MYSQL)
CFN_MYSQL
- public java.lang.String getCFN_SQLSERVER()
public void setCFN_SQLSERVER(java.lang.String CFN_SQLSERVER)
CFN_SQLSERVER
- public java.lang.String getCFN_POSTGRESQL()
public void setCFN_POSTGRESQL(java.lang.String CFN_POSTGRESQL)
CFN_POSTGRESQL
- public java.lang.String getCFN_ORACLE()
public void setCFN_ORACLE(java.lang.String CFN_ORACLE)
CFN_ORACLE
- public java.lang.String getCFN_DB2()
public void setCFN_DB2(java.lang.String CFN_DB2)
CFN_DB2
- public java.lang.String getCFN_HANA()
public void setCFN_HANA(java.lang.String cFN_HANA)
CFN_HANA
- public java.lang.String getCFN_MARIADB()
public void setCFN_MARIADB(java.lang.String cFN_MARIADB)
CFN_MARIADB
- public java.lang.String getErrorString()
public java.lang.String getConnString()
public void setConnString(java.lang.String connString)
connString
- public int[] getBatchReturn()
public java.lang.String[][] getStringData()
public java.lang.Integer[][] getIntegerData()
public java.sql.Date[][] getDateData()
public java.lang.Double[][] getDoubleData()
public int getMaxRecord()
public void setMaxRecord(int maxRecord)
maxRecord
- public java.sql.ResultSet getResultSet()
public int getExecCount()
public boolean isExec()
public java.lang.String getMessageScript()
public java.lang.String getResultMessage()
public void setDefErrStr(java.lang.String defErrStr)
defErrStr
- public void setDefMsgScr(java.lang.String defMsgScr)
defMsgScr
- public void setDefResMsg(java.lang.String defResMsg)
defResMsg
- public void setBatchBegan(int batchBegan)
batchBegan
- public int getDbSystem()
public void setDbSystem(int dbSystem)
dbSystem
- public int getConnType()
public void setConnType(int connType)
connType
- public boolean isUpdate()
public void setUpdate(boolean isUpdate)
isUpdate
- public boolean isLocale()
public void setLocale(boolean isLocale)
isLocale
-