|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.ic.doc.automed.util.db.DBAccess
uk.ac.ic.doc.automed.util.db.DBPostgres
public class DBPostgres
Field Summary |
---|
Fields inherited from class uk.ac.ic.doc.automed.util.db.DBAccess |
---|
connections, dbFQPath, password, props, user |
Method Summary | |
---|---|
void |
commit()
Only use this method if you want to commit changes immediately. In HSQLDB this can be avoided by using "SET _writeDelay 0 MILLIS" in dbname.script file. |
protected void |
executeCommand(java.lang.String cmd)
Mostly used for executing control commands, e.g. |
java.sql.ResultSet |
executeQuery(java.lang.String expression)
This method is used for SELECT statement |
void |
executeStatement(java.lang.String expression)
This method is used for making changes to data, e.g. |
java.sql.Connection |
getConnection()
|
static DBPostgres |
getDBInstance(java.lang.String dbFQPath,
java.lang.String user,
java.lang.String password,
java.util.Properties props)
Create a new DB process instance for a data source named dsName .As such, we can initiate multiple databases (data sources) at the same time. |
boolean |
isTableExist(java.lang.String name)
Return a result set of table names for manipulation |
java.sql.Connection |
newConnection()
Creates a new connection to add to the pool |
void |
printResultSet(java.sql.ResultSet rs)
A test method to print in simple tabular form a result set |
void |
setAutoCommit(boolean autoCommit)
Different data sources understands auto-commit differently. |
Methods inherited from class uk.ac.ic.doc.automed.util.db.DBAccess |
---|
closeConnection, getCurrentRow, shutdown |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static DBPostgres getDBInstance(java.lang.String dbFQPath, java.lang.String user, java.lang.String password, java.util.Properties props) throws DBInstanceException
dsName
.
dbFQPath
- the fully qualified path to data sourceuser
- user to connect topassword
- password associated to userprops
- a Properties
object specifying extra propertiesDBInstanceException
public java.sql.Connection newConnection() throws java.sql.SQLException
DBAccess
newConnection
in class DBAccess
java.sql.SQLException
public java.sql.Connection getConnection()
getConnection
in class DBAccess
public void setAutoCommit(boolean autoCommit) throws java.sql.SQLException
setAutoCommit
in class DBAccess
autoCommit
- a boolean
value: true = auto-commit; false otherwise
java.sql.SQLException
public void commit() throws java.sql.SQLException
commit
in class DBAccess
java.sql.SQLException
public java.sql.ResultSet executeQuery(java.lang.String expression) throws java.sql.SQLException
executeQuery
in class DBAccess
expression
- is an SQL statement to use
ResultSet
object of the result data
java.sql.SQLException
public void executeStatement(java.lang.String expression) throws java.sql.SQLException
executeStatement
in class DBAccess
expression
- is an SQL statement to use
java.sql.SQLException
protected void executeCommand(java.lang.String cmd) throws java.sql.SQLException
executeCommand
in class DBAccess
cmd
- the command to execute
java.sql.SQLException
public boolean isTableExist(java.lang.String name) throws java.sql.SQLException
isTableExist
in class DBAccess
java.sql.SQLException
public void printResultSet(java.sql.ResultSet rs) throws java.sql.SQLException
printResultSet
in class DBAccess
java.sql.SQLException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |