database
Class ScoringDBAO
java.lang.Object
database.ScoringDBAO
public class ScoringDBAO
- extends java.lang.Object
ScoringDBAO manages a database datasource.
Anything wishing to connection to the database must go through this class to
get a connection.
Currently this class supports HSQLDB connections, however it could be
extended to support other databases with some subclasses.
Several context parameters that will override the default params can be
specified in the web.xml file.
The default configuration is shown below.
Instead of scoring.db.urlprefix and scoring.db.relurl it is also possible
to specify scoring.db.url which will be used as the absolute url to the database.
It is expected to include the name of the DB as well.
scoring.db.relurl if not specified will default to the default "work" directory
of the web application.
scoring.db.driver
org.hsqldb.jdbcDriver
The JDBC driver class.
scoring.db.user
sa
Username for database access.
scoring.db.password
Password for database access.
scoring.db.urlprefix
jdbc:hsqldb:file:
Prefix for the URL of the database.
scoring.db.name
scoringdb
The name of the database.
scoring.db.initfile
init.sql
The SQL file used to initialize an new database. The file is
relative to /WEB-INF/db directory.
Constructor Summary |
ScoringDBAO(javax.servlet.ServletContext context)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ScoringDBAO
public ScoringDBAO(javax.servlet.ServletContext context)
throws java.sql.SQLException,
java.net.MalformedURLException,
java.io.IOException
- Throws:
java.sql.SQLException
java.net.MalformedURLException
java.io.IOException
getConnection
public java.sql.Connection getConnection()
throws java.sql.SQLException
- Throws:
java.sql.SQLException
remove
public void remove()
throws java.sql.SQLException
- Throws:
java.sql.SQLException