|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.astroshare.astroonline.database.Database
public class Database
Implementation of the Astro-Online database connection.
The Astro-Online Database object implements connection pooling by default. Connection pooling is supported in two variants:
PoolWhether variant 1 or 2 is used, depends on the value of the node AstroOnlineConfiguration.server.database in the configuration file. If the value is JDNI, variant 2 is used, otherwise variant 1 is used.
Variant 1: Through class Pool
The class Pool is an Astro-Online implementation of a MySQL
connection pool. Astro-Online uses this option by default since the value of
the node AstroOnlineConfiguration.server.database in the configuration file
is POOL by default.
Variant 2: Through JNDI
To use JNDI a connection pool on the web server has to be setup. See the documentation of your the web server for more information on this topic.
Additional information
Astro-Online by default connects to a mysql database. Connecting to other
databases should be possible with JNDI but was not tested. It is not possible
to connect to other databases with class Pool since this class
implicitly implements a connection to MySQL. If an implementation of a pool
for another database is necessary, a new pool implementation has to be added
and class Database has to be changed to use this implementation.
As a rule of thumb it is best to use the default settings if there runs only one Astro-Online instance on a server. If more than one Astro-Online instance runs on one server, a connection pool can be shared amongst the Astro-Online instances with JNDI. Please, be aware that sharing the connection pool amongst more than one Astro-Online instances means that these instances also share the same tables and therefore use the same configuration table and template table. To give each instance a unique configuration and unique templates, a profile can be added with its own configuration records in the configuration table and its own templates in the templates table. To force an instance to use a specific profile, the node AstroOnlineConfiguration.server.profile in the configuration file has to be modified accordingly. Please read the Astro-Online documentation for more information on the topic.
Pool,
Sql| Field Summary | |
|---|---|
protected java.sql.Connection |
conn
Database connection object |
protected static org.apache.log4j.Logger |
log
init logging |
| Constructor Summary | |
|---|---|
Database()
Constructor. |
|
| Method Summary | |
|---|---|
void |
close()
Close connection. |
int |
execute(java.lang.String sqlStatement)
Execute a SQL DML statement with exception of a SELECT statement (e.q. |
java.sql.ResultSet |
executeQuery(java.lang.String sqlStatement)
Execute SQL SELECT statement. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static org.apache.log4j.Logger log
protected java.sql.Connection conn
| Constructor Detail |
|---|
public Database()
throws javax.naming.NamingException,
java.sql.SQLException
Constructor.
javax.naming.NamingException - Exception is thrown when JNDI datasource is not found
java.sql.SQLException - Exception is thrown when a connection cannot be established| Method Detail |
|---|
public void close()
Close connection.
public java.sql.ResultSet executeQuery(java.lang.String sqlStatement)
Execute SQL SELECT statement. Use method execute(java.lang.String) for other SQL
DML statements.
sqlStatement - SQL statement
execute(java.lang.String)public int execute(java.lang.String sqlStatement)
Execute a SQL DML statement with exception of a SELECT statement (e.q.
INSERT, UPDATE and DELETE). Use method executeQuery(java.lang.String) for SELECT
statements.
sqlStatement - SQL statement
executeQuery(java.lang.String)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Astro-Online © 2001 − 2008 Astro Share
Documentation generated on: Thursday August 12th 2008 (PS)