public class JDBCTransaction extends DBTransaction implements JDBCTransactionMBean
AbstractTransaction.Context
Modifier and Type | Field and Description |
---|---|
private String |
connurl |
private String |
dbinit |
private String |
dbname |
static String |
DFLT_JDBC_DB_PREFIX |
private String |
driver |
private String |
host |
static String |
JDBC_CONNECT_RETRY_COUNT_PROP
This property is used to set the number of reconnection attempts after a failure, by default 5.
|
static String |
JDBC_CONNECT_RETRY_MAX_PERIOD_PROP
This property is used to set the maximum time trying to reconnect after a failure, by default 60.000 (60 seconds).
|
static String |
JDBC_CONNECT_RETRY_MIN_DELAY_PROP
This property is used to set the minimum time between two attempts to reconnect after a failure, by default 1.000 (1 seconds).
|
static String |
JDBC_DB_CLOSE_PROP
This property is used to define the SQL statement executed at the end of the module, by default none.
|
static String |
JDBC_DB_DELETE_PROP
This property allows to define the SQL statement allowing to delete an entry in the table used by the module,
by default: "DELETE FROM <table> WHERE name=?"
|
static String |
JDBC_DB_HOST_PROP
This property allows to define the hostname of the URL used to establish the connection.
|
static String |
JDBC_DB_INIT_PROP
This property allows to define the SQL statement allowing to create the table used by the module, for example:
"CREATE TABLE JoramDB (name VARCHAR(256), content LONG VARCHAR FOR BIT DATA, PRIMARY KEY(name))"
This property can be set only at first launching.
|
static String |
JDBC_DB_INSERT_PROP
This property allows to define the SQL statement allowing to insert an entry in the table used by the module,
by default: "INSERT INTO <table> VALUES (?
|
static String |
JDBC_DB_LOAD_PROP
This property allows to define the SQL statement allowing to load an entry from the table used by the module,
by default: "SELECT content FROM <table> WHERE name=?"
|
static String |
JDBC_DB_NAME_PROP
This property allows to define the database name of the URL used to establish the connection, by default "JoramDB".
|
static String |
JDBC_DB_PASS_PROP
This property allows to define the password of database user on whose behalf the connection is being made.
|
static String |
JDBC_DB_PORT_PROP
This property allows to define the port of the URL used to establish the connection.
|
static String |
JDBC_DB_PROTOCOL_PROP
This property allows to define the protocol part of the URL used to establish the connection, for example "jdbc:mysql".
|
static String |
JDBC_DB_UPDATE_PROP
This property allows to define the SQL statement allowing to update an entry in the table used by the module,
by default: "UPDATE <table> SET content=?
|
static String |
JDBC_DB_USER_PROP
This property allows to define the name of database user on whose behalf the connection is being made.
|
static String |
JDBC_DRIVER_PROP
This property allows to define the class that implements the JDBC driver, for example "com.mysql.jdbc.Driver".
|
static String |
JDBC_PROPS_FILE_PROP
This property allows to define the name of a file containing a list of arbitrary string tag/value pairs as connection
arguments; normally at least a "user" and "password" property should be included.
|
static String |
JDBC_TRANSACTION_PREFIX |
static String |
JDBC_URL_PROP
This property allows to define the database url of the form "jdbc:subprotocol://host:port/dbname".
|
private String |
password |
private String |
path |
private String |
port |
private Properties |
props |
private String |
protocol |
private String |
user |
conn, connectRetryCount, connectRetryMaxPeriod, connectRetryMinDelay, DB_TRANSACTION_PREFIX, dbclose, dbdelete, dbinsert, dbload, dbtable, dbupdate, DFLT_TABLE_PREFIX, JDBC_CONNECT_RETRY_COUNT_DFLT, JDBC_CONNECT_RETRY_MAX_PERIOD_DFLT, JDBC_CONNECT_RETRY_MIN_DELAY_DFLT, TABLE_NAME_PROP
dir, OOS_STREAM_HEADER, perThreadContext, phase, startTime
logmon
Constructor and Description |
---|
JDBCTransaction() |
Modifier and Type | Method and Description |
---|---|
protected void |
connectDB()
This method try to reconnect to the database, it is used in case of failure during commit.
|
protected void |
dumpProperties(StringBuilder strbuf) |
Properties |
getClientInfo() |
String |
getDBInitStatement() |
String |
getDBName() |
String |
getDriver() |
String |
getPropertiesPath() |
String |
getURL() |
String |
getUser() |
protected void |
initDB()
Instantiates the database driver and creates the table if necessary
|
backup, close, commit, delete, dumpProperties, getBadInserts, getBadUpdates, getCommitBytes, getCommitCount, getDBCloseStatement, getDBDeleteStatement, getDBInsertStatement, getDBLoadStatement, getDBTableName, getDBUpdateStatement, getFromLog, getList, getLogThresholdOperation, getNbDeletes, getNbInserts, getNbUpdates, getObject, getObjectList, getPersistenceDir, initRepository, loadAll, loadByteArray, saveInLog, setPhase, stop, useLoadAll
begin, containsOperations, create, create, createByteArray, createByteArray, delete, getOperationCount, getPhase, getPhaseInfo, getStartTime, init, isPersistent, load, load, loadByteArray, loadFromByteArray, release, save, save, save, saveByteArray, saveByteArray, saveByteArray
freeze, getBoolean, getInteger, getInteger, getProperty, getProperty, loadProperties, saveProperties
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
dumpProperties, getBadInserts, getBadUpdates, getCommitBytes, getDBCloseStatement, getDBDeleteStatement, getDBInsertStatement, getDBLoadStatement, getDBTableName, getDBUpdateStatement, getLogThresholdOperation, getNbDeletes, getNbInserts, getNbUpdates, getObject, getObjectList, getPhase, getPhaseInfo
backup, getCommitCount, getStartTime, isPersistent, useLoadAll
public static final String JDBC_TRANSACTION_PREFIX
public static final String JDBC_DRIVER_PROP
public static final String JDBC_URL_PROP
public static final String JDBC_DB_PROTOCOL_PROP
public static final String JDBC_DB_HOST_PROP
public static final String JDBC_DB_PORT_PROP
public static final String JDBC_DB_NAME_PROP
public static final String DFLT_JDBC_DB_PREFIX
public static final String JDBC_PROPS_FILE_PROP
public static final String JDBC_DB_USER_PROP
public static final String JDBC_DB_PASS_PROP
public static final String JDBC_CONNECT_RETRY_COUNT_PROP
public static final String JDBC_CONNECT_RETRY_MIN_DELAY_PROP
public static final String JDBC_CONNECT_RETRY_MAX_PERIOD_PROP
public static final String JDBC_DB_INIT_PROP
public static final String JDBC_DB_INSERT_PROP
public static final String JDBC_DB_UPDATE_PROP
public static final String JDBC_DB_LOAD_PROP
public static final String JDBC_DB_DELETE_PROP
public static final String JDBC_DB_CLOSE_PROP
private String driver
private String connurl
private String protocol
private String host
private String port
private String user
private String password
private String dbname
private String dbinit
private String path
private Properties props
public String getDBName()
getDBName
in interface JDBCTransactionMBean
public String getDBInitStatement()
getDBInitStatement
in interface JDBCTransactionMBean
protected void initDB() throws IOException
DBTransaction
initDB
in class DBTransaction
IOException
- an error occurs.protected void connectDB() throws IOException
DBTransaction
connectDB
in class DBTransaction
IOException
- The reconnection has failed.public String getDriver()
getDriver
in interface JDBCTransactionMBean
public String getURL()
getURL
in interface JDBCTransactionMBean
public Properties getClientInfo()
getClientInfo
in interface JDBCTransactionMBean
public String getUser()
getUser
in interface JDBCTransactionMBean
public String getPropertiesPath()
getPropertiesPath
in interface JDBCTransactionMBean
protected void dumpProperties(StringBuilder strbuf)
dumpProperties
in class DBTransaction
Copyright © 2021 ScalAgent D.T.. All rights reserved.