com.atlassian.jira.web.action.util
Class DatabaseConnectionBean
java.lang.Object
com.atlassian.jira.web.action.util.DatabaseConnectionBean
- Direct Known Subclasses:
- BugzillaConnectionBean, FogBugzConnectionBean, MantisConnectionBean, VisualInterceptConnectionBean
- public class DatabaseConnectionBean
- extends Object
Bean for managing a JDBC connection - storing connection details,
a Connection instance, and checking if a connection can be made.
Most of this code is generic, and could be factored out if
something other than Bugzilla needs it.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
driverName
protected String driverName
DatabaseConnectionBean
public DatabaseConnectionBean(String driverName,
String url,
String username,
String password,
String testSQL,
String testErrorMessage)
isValidDriverName
public boolean isValidDriverName()
isValidUrl
public boolean isValidUrl()
getCompleteURL
public String getCompleteURL()
- Returns:
- the JDBC URL with username and password integrated
getConnection
public Connection getConnection()
throws SQLException
- Returns:
- a Connection instance - always the same one unless JDBC details are changed.
- Throws:
SQLException
isValid
public String isValid()
- Checks that we can make a connection to the specified database and run a test query.
- Returns:
- An error message, or null if everything is OK
closeConnection
public void closeConnection()
getDriverName
public String getDriverName()
setDriverName
public void setDriverName(String driverName)
getUrl
public String getUrl()
setUrl
public void setUrl(String url)
getTestSQL
public String getTestSQL()
setTestSQL
public void setTestSQL(String testSQL)
getUsername
public String getUsername()
setUsername
public void setUsername(String username)
getPassword
public String getPassword()
setPassword
public void setPassword(String password)
queryDb
public List queryDb(ResultSetTransformer transformer)
- Queries the database with the SqlQuery and then adds and transforms each row of the result into an object which are
then returned in a list
- Parameters:
transformer
-
- Returns:
- List of transformed objects
queryDbAppendCollection
public List queryDbAppendCollection(ResultSetTransformer transformer)
validateConnection
public void validateConnection(ErrorCollection errors)
getI18nBean
protected I18nBean getI18nBean()
Copyright © 2002-2007 Atlassian. All Rights Reserved.