|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.radrails.db.core.DatabaseHelper
Provides a helper class around the IDatabaseConnection class.
Method Summary | |
java.sql.Connection |
connect(java.io.File project,
java.lang.String environment)
Establishes a database connection based on the parameters. |
java.lang.String[] |
getAdapters()
Gets a list of the available adapters. |
DatabaseConnection |
getConnectionForName(java.lang.String adapterName)
Gets the database connection based on the adapter name. |
static DatabaseHelper |
getInstance()
Gets an instance of this class. |
boolean |
testConnection(java.io.File project,
java.lang.String environment)
Tests is a database connection can be established based on the project and environment type. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static DatabaseHelper getInstance()
public java.lang.String[] getAdapters()
public boolean testConnection(java.io.File project, java.lang.String environment)
project
- The project to test a connection on.environment
- The environment from the database.yml file to use. Use the
IDatabaseConstants for the available environment strings.
true
if a database connection could be
established, false
otherwise.public java.sql.Connection connect(java.io.File project, java.lang.String environment) throws java.sql.SQLException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.io.FileNotFoundException, java.io.IOException
project
- The location to the project.environment
- The environment to test
(Use IDatabaseConstants).
java.sql.SQLException
- If an error occured while connecting to the
database.
java.lang.InstantiationException
- If the adaptor for the specified
database could not be created.
java.lang.IllegalAccessException
- If the user specified does
not have access to the database.
java.io.FileNotFoundException
- If the project's database.yml file
could not be found.
java.io.IOException
- If an I/O error occurs while connecting.public DatabaseConnection getConnectionForName(java.lang.String adapterName)
adapterName
- The name of the adapter. Use the IDatabaseConstants class for
the available adapters.
null
if no IDatabaseConnection is defined for the
specified adapter name.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |