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 fromSQLException
public 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
- SQLException
public void reset() throws SQLException
SQLException
public void close() throws SQLException
SQLException
public void commit() throws SQLException
SQLException
public void setAutoCommit(boolean B) throws SQLException
B
- SQLException
public boolean ok()
public int doStatement(String Str) throws SQLException
Str
- The SQL statement to runSQLException
public ResultSet doSingleQuery(String Str) throws SQLException
Str
- QuerySQLException
public ResultSet doSingleUpdatableQuery(String Str) throws SQLException
Str
- QuertSQLException
public Connection getDBConnection()