public class MySQLSession
extends java.lang.Object
| Modifier and Type | Field | Description |
|---|---|---|
java.sql.Connection |
con |
An object representing the connection to the database.
|
| Constructor | Description |
|---|---|
MySQLSession(java.lang.String database,
java.lang.String url,
java.lang.String username,
java.lang.String password) |
Creates a new database session.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
commit() |
Commits changes made in the database.
|
void |
connect() |
Sets a connection to the database.
|
void |
delIsf(java.lang.String isfName) |
Delets from the database a given decision problem.
|
java.util.ArrayList<java.lang.String> |
getIsfNames() |
Lists the names of all decision problems stored in the database.
|
void |
rollback() |
Performs rollback (cancels all the changes made since latest commit)
|
void |
startTransaction() |
starts a database transaction.
|
public java.sql.Connection con
public MySQLSession(java.lang.String database,
java.lang.String url,
java.lang.String username,
java.lang.String password)
database - the name of the databaseurl - the address in format //NODENAME[:PORT]username - the database loginpassword - the database passwordpublic void connect()
throws java.sql.SQLException,
java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.lang.ClassNotFoundException
java.sql.SQLException - when the url is invalid, the database doesn't exist
or access for the user is deniedjava.lang.InstantiationExceptionjava.lang.IllegalAccessExceptionjava.lang.ClassNotFoundExceptionpublic void commit()
throws java.sql.SQLException
java.sql.SQLException - when commiting is found impossiblepublic void rollback()
throws java.sql.SQLException
java.sql.SQLException - when rollback is found impossiblepublic void startTransaction()
throws java.sql.SQLException
java.sql.SQLException - when can't start the transactionpublic java.util.ArrayList<java.lang.String> getIsfNames()
public void delIsf(java.lang.String isfName)
throws java.sql.SQLException
isfName - the name of the decision problem.java.sql.SQLException - when there was no such isf name or the database operation failed