org.qriterium.dogma
Class BaseConnection

java.lang.Object
  extended by org.qriterium.dogma.BaseConnection

public class BaseConnection
extends java.lang.Object

The BaseConnection class handles the database connection and query handling of the Dogma ResourceBase. A ResourceBase can have only one BaseConnection to handle it's queries. Notice that there are no exception handling, this is done with the ResourceBase class. The BaseConnection assumes that it uses HSQLDB, but it can be altered to use other kinds of databases as well, provided that these databases have an available JDBC driver.

Author:
bjorkgre

Constructor Summary
BaseConnection(java.lang.String dbtype, java.lang.String db, java.lang.String user, java.lang.String pass)
          Creates a BaseConnection.
 
Method Summary
 void closeConnection()
          closeConnection closeConnection method closes the database connection.
 void sqlExec(java.lang.String sql)
          sqlExec executes an SQL command, typically an INSERT, DELETE or UPDATE command.
 java.sql.ResultSet sqlQuery(java.lang.String sql)
          sqlQuery executes an SQL query, typically SELECT.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseConnection

public BaseConnection(java.lang.String dbtype,
                      java.lang.String db,
                      java.lang.String user,
                      java.lang.String pass)
               throws java.sql.SQLException
Creates a BaseConnection. It asks the database type (possible types include mem, file and server, webserver database types are not handled).

Parameters:
dbtype -
db -
user -
pass -
Throws:
java.sql.SQLException
Method Detail

sqlQuery

public java.sql.ResultSet sqlQuery(java.lang.String sql)
                            throws java.sql.SQLException
sqlQuery executes an SQL query, typically SELECT. Other types of SQL queries are handled by sqlExec.

Parameters:
sql -
Returns:
Throws:
java.sql.SQLException

sqlExec

public void sqlExec(java.lang.String sql)
             throws java.sql.SQLException
sqlExec executes an SQL command, typically an INSERT, DELETE or UPDATE command. SQL SELECT queries are handled by sqlQuery.

Parameters:
sql -
Throws:
java.sql.SQLException

closeConnection

public void closeConnection()
                     throws java.sql.SQLException
closeConnection closeConnection method closes the database connection.

Throws:
java.sql.SQLException