|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.bibalex.daf.handlers.dbhandler.DBConnection
public class DBConnection
Field Summary | |
---|---|
private java.sql.Connection |
connection
Holds the connection to be used by each method. |
private java.lang.String |
dbDriver
Holds the database driver that is used in assocaition with the database url to create a connection. |
private java.lang.String |
dbUrl
Holds the Database url on the form jdbc:subprotocol:subname. |
private static java.lang.String |
driver
Holds the database driver that is used in assocaition with the database url to create a connection. |
private static DBConnection |
instance
Holds the sole instace of DBConnection. |
private static java.sql.Connection |
Sqlconnection
|
private static java.lang.String |
url
Holds the Database url on the form jdbc:subprotocol:subname. |
Constructor Summary | |
---|---|
private |
DBConnection()
An empty constructor, to override the constructor supplied by the compiler. |
|
DBConnection(DBConnection connection)
A deep copy constructor. |
private |
DBConnection(java.lang.String driver,
java.lang.String url)
Creates a new instacne of DBconnection. |
Method Summary | |
---|---|
boolean |
_startTransaction()
Starts a new transaction |
boolean |
_stopTransaction(boolean isSuccessful)
Stops the current transaction by either commiting or rolling it back. |
static boolean |
checkSqlConnection()
Checks if there is a SQL Connection as default instance or not. |
static DBConnection |
CreateNewDBConnection(java.lang.String driver,
java.lang.String url)
Creates and returns a new DBConnection , that is different from the default instance
and will not be considered the default instance. |
static void |
CreateSqlConnection()
|
OperationInfo |
executeNonQuery(java.lang.String query)
Executes the specified query and gets the number of rows affected. |
OperationInfo |
executeProcedure(java.lang.String procName,
java.util.ArrayList procArguments)
Executes the given stored procedure. |
OperationInfo |
executeReader(java.lang.String query)
Executes the specified query and returns a DataTable representing the ResultSet. |
static OperationInfo |
executeScalar(java.lang.String query)
Executes the specified query and returns the first column of the first row of the ResultSet. |
java.lang.String |
formulateArguments(java.util.ArrayList arguments)
|
static DBConnection |
getDefaultInstance()
Gets the default DBConnection. |
static java.sql.Connection |
getSqlConnection()
Gets Sql Server DBConnection. |
static void |
setDefaultConnectionString(java.lang.String driver,
java.lang.String url)
Sets the connection string to be sued when a new connection is to be created. |
boolean |
startTransaction()
Starts a new transaction |
boolean |
stopTransaction(boolean isSuccessful)
Stops the current transaction by either commiting or rolling it back. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static java.lang.String driver
private static java.lang.String url
private static DBConnection instance
private java.lang.String dbDriver
private java.lang.String dbUrl
private java.sql.Connection connection
private static java.sql.Connection Sqlconnection
Constructor Detail |
---|
private DBConnection()
private DBConnection(java.lang.String driver, java.lang.String url)
driver
- The database driver.url
- The database Url.public DBConnection(DBConnection connection)
connection
- The connection to .be copied.Method Detail |
---|
public static void setDefaultConnectionString(java.lang.String driver, java.lang.String url)
driver
- The database driver.url
- The database Url.public static boolean checkSqlConnection()
public static java.sql.Connection getSqlConnection()
public static DBConnection getDefaultInstance()
public static void CreateSqlConnection()
public static DBConnection CreateNewDBConnection(java.lang.String driver, java.lang.String url)
DBConnection
, that is different from the default instance
and will not be considered the default instance. The Object returned is totally independent
from the default configuration and doesn't affect any static members of this class.
driver
- The database driver.url
- The database Url.
DBConnection
instance.public OperationInfo executeReader(java.lang.String query)
query
- The query to be executed.
public static OperationInfo executeScalar(java.lang.String query)
query
- The query to be executed.
public OperationInfo executeNonQuery(java.lang.String query)
query
- The query to be executed, likely an INSERT, UPDATE or DELETE query.
public OperationInfo executeProcedure(java.lang.String procName, java.util.ArrayList procArguments)
procName
- The name of the stored procedure.procArguments
- The arguments of the stored proceure.
public java.lang.String formulateArguments(java.util.ArrayList arguments)
public boolean _startTransaction()
public boolean _stopTransaction(boolean isSuccessful)
isSuccessful
- Indicates whether the transaction should be committed or rolled back.
public boolean startTransaction()
public boolean stopTransaction(boolean isSuccessful)
isSuccessful
- Indicates whether the transaction should be committed or rolled back.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |