public class DBFunctions extends Object
| Constructor and Description |
|---|
DBFunctions(String driverClass,
String dbUrl,
String userid,
String passwd,
boolean isSwing)
This default constructor establishes a connection to a DB.
|
| Modifier and Type | Method and Description |
|---|---|
void |
closeCon()
This method finally closes the connection to a DB.
|
void |
Commit()
This method is to commit statements, when you've swiched of the
auto-commit.
|
ResultSet |
execStmt(String query)
This method is used for querys which returns a result, like the SELECT
statements
|
Connection |
getConnection() |
boolean |
getIsSwing() |
PreparedStatement |
getPreparedStmt(String query)
If you want to use prepared statements instead of ordinary statements you
can create one.
|
int |
insertStmt(String query)
This method can perform queries which havn't a result, such as INSERT
statements.
|
void |
rollBack()
When auto-commit is switched off, you can do a rollback in the case of
some errors...
|
void |
setAutoCommit(boolean b)
This method is to specifie whether or not you want to use auto-commit.
|
void |
setIsSwing(boolean isSwing) |
public DBFunctions(String driverClass, String dbUrl, String userid, String passwd, boolean isSwing)
driverClass - the driver class needed to connect to the DBdbUrl - the URL of the DB you want to connect withuserid - the user who have to connect to the DBpasswd - the users password - witout it - no connectionpublic void setIsSwing(boolean isSwing)
public boolean getIsSwing()
public Connection getConnection()
public ResultSet execStmt(String query)
query - the SQL-query to execute on the DBpublic int insertStmt(String query)
query - the INSERT querypublic void Commit()
public void setAutoCommit(boolean b)
b - true if you want to use auto-commit, else falsepublic void rollBack()
public void closeCon()
public PreparedStatement getPreparedStmt(String query)
query - the query you want to save as a prepared statementCopyright © 2013. All rights reserved.