public class SQLConnection extends Object
| Constructor and Description |
|---|
SQLConnection(ConfigFile C)
Create an SQLConnection using strings SQLDiver, SQLUrl, SQLUsername and SQLPassword
from the given cc.glsn.ConfigFile.
|
SQLConnection(String Driver,
String URL,
String Username,
String Password) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close DB connection.
|
void |
commit()
Commit changes to DB.
|
ResultSet |
doSingleQuery(String Str)
Do an SQL query.
|
ResultSet |
doSingleUpdatableQuery(String Str)
Do an SQL query.
|
int |
doStatement(String Str)
performs a single SQL statement
|
Connection |
getDBConnection() |
boolean |
ok()
Determines if the connection is ok
|
void |
reset()
Reset auto commit to true
Close any open statements
|
void |
setAutoCommit(boolean B)
Sets the value of autocommit.
|
public SQLConnection(ConfigFile C) throws SQLException
C - ConfigFile to grab params fromSQLExceptionpublic SQLConnection(String Driver, String URL, String Username, String Password) throws SQLException
Driver - Class of SQL driver to use. Example: com.mysql.jdbc.DriverURL - URL to database. Example: jdbc:mysql://host/dbnameUsername - Password - SQLExceptionpublic void reset()
throws SQLException
SQLExceptionpublic void close()
throws SQLException
SQLExceptionpublic void commit()
throws SQLException
SQLExceptionpublic void setAutoCommit(boolean B)
throws SQLException
B - SQLExceptionpublic boolean ok()
public int doStatement(String Str) throws SQLException
Str - The SQL statement to runSQLExceptionpublic ResultSet doSingleQuery(String Str) throws SQLException
Str - QuerySQLExceptionpublic ResultSet doSingleUpdatableQuery(String Str) throws SQLException
Str - QuertSQLExceptionpublic Connection getDBConnection()