|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.edg.info.RemoteDatabase
Encapsulates a remote database. Currently maintains a single connection to the database, but could be expanded to use a connection pool. TODO: remove isConnectionValid() and use getState after each execute to work out if the connection is dead.
Constructor Summary | |
RemoteDatabase(java.lang.String location,
java.lang.String user,
java.lang.String password,
java.lang.String driver)
Creates a new RemoteDatabase object. |
Method Summary | |
void |
checkConnection(java.sql.SQLException e)
Checks the SQL state following an exception to determine if the connection needs to be reestablished. |
void |
close()
Closes all connections to this remote database. |
static void |
closeStatement(java.sql.Statement statement)
Closes the given statement if it is not null. |
java.sql.Connection |
getConnection()
Returns a connection to this remote database, creating one if necessary. |
java.sql.Statement |
getStatement()
Returns a Statement object to send SQL to this database. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public RemoteDatabase(java.lang.String location, java.lang.String user, java.lang.String password, java.lang.String driver)
location
- The URL of the database.user
- The user name to access the database.password
- The password to access the database.driver
- The class name of the database driver.Method Detail |
public java.sql.Connection getConnection() throws org.glite.rgma.system.RGMAInternalException
org.glite.rgma.system.RGMAException
org.glite.rgma.system.RGMAInternalException
public java.lang.String toString()
public void close()
public java.sql.Statement getStatement() throws java.sql.SQLException, org.glite.rgma.system.RGMAInternalException
java.sql.SQLException
org.glite.rgma.system.RGMAException
org.glite.rgma.system.RGMAInternalException
public void checkConnection(java.sql.SQLException e) throws org.glite.rgma.system.RGMAException, java.sql.SQLException
e
- The SQLException.
org.glite.rgma.system.RGMAException
- If the attempt to recreate the connection fails.
java.sql.SQLException
public static void closeStatement(java.sql.Statement statement)
statement
- Statement to close.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |