public class MySQLConnector
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
connectCounter
The connect counter.
|
private java.lang.String |
database
The database.
|
private java.sql.Connection |
dBconnection
The d bconnection.
|
static boolean |
debugFlag
The debug flag.
|
private java.lang.String |
driver
The driver.
|
private static boolean |
FAIL
The Constant FAIL.
|
private java.lang.String |
host
The host.
|
protected org.apache.log4j.Logger |
logger
The logger.
|
private java.lang.String |
password
The password.
|
private static java.lang.String |
PROP_FILE
Name of the properties file which must exist on the classpath.
|
private java.sql.ResultSet |
resultSet
The result set.
|
private java.lang.String |
sqlStr
The sql str.
|
private java.sql.Statement |
statement
The statement.
|
private static boolean |
SUCCESS
The Constant SUCCESS.
|
static java.lang.String |
TABLE_INFO_NAME
The Constant TABLE_INFO_NAME.
|
private java.lang.String |
user
The user.
|
Constructor and Description |
---|
MySQLConnector()
Instantiates a new my sql connector.
|
MySQLConnector(java.lang.String host,
java.lang.String user,
java.lang.String password,
java.lang.String database,
java.lang.String driver)
Instantiates a new my sql connector.
|
Modifier and Type | Method and Description |
---|---|
java.sql.Connection |
connect()
Connect.
|
java.sql.Connection |
connect(java.lang.String user,
java.lang.String password)
Connect.
|
void |
disconnect()
Disconnect.
|
java.sql.Connection |
getConnection()
Gets the connection.
|
private boolean |
SQLError(java.lang.Exception e,
java.lang.String sqlStr)
SQL error.
|
void |
terminate()
Terminate.
|
private static final java.lang.String PROP_FILE
public static final java.lang.String TABLE_INFO_NAME
private java.lang.String host
private java.lang.String database
private java.lang.String driver
private java.lang.String user
private java.lang.String password
private java.sql.Connection dBconnection
private java.sql.Statement statement
private java.sql.ResultSet resultSet
private java.lang.String sqlStr
public static boolean debugFlag
private static final boolean SUCCESS
private static final boolean FAIL
public static int connectCounter
protected org.apache.log4j.Logger logger
public MySQLConnector()
public MySQLConnector(java.lang.String host, java.lang.String user, java.lang.String password, java.lang.String database, java.lang.String driver)
host
- the hostuser
- the userpassword
- the passworddatabase
- the databasedriver
- the driverprivate boolean SQLError(java.lang.Exception e, java.lang.String sqlStr)
e
- the esqlStr
- the sql strpublic java.sql.Connection connect()
public java.sql.Connection connect(java.lang.String user, java.lang.String password)
user
- the userpassword
- the passwordpublic void disconnect()
public java.sql.Connection getConnection()
public void terminate()