org.mentawai.db
Interface ConnectionHandler

All Known Implementing Classes:
C3P0ConnectionHandler, DataSourceConnectionHandler, DBCPConnectionHandler, JNDIConnectionHandler

public interface ConnectionHandler

This interface describes the behaviour of a Mentawai database connection provider. Classes implementing this interface may or may not use an underlying connection pool. This is a transparent way to get a connection to a database with Mentawai.

Author:
Sergio Oliveira

Method Summary
 void destroy()
          Destroy the connection pool, closing and cleaning all connections.
 java.sql.Connection getConnection()
          Returns a Connection to the database.
 void release(java.sql.Connection conn)
          Release this connection.
 

Method Detail

getConnection

java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Returns a Connection to the database. Notice that it can never return null. If no connection can be acquired, then a SQLException is thrown.

Returns:
A connection to the database.
Throws:
java.sql.SQLException - if there were problems trying to acquire the connection.

release

void release(java.sql.Connection conn)
Release this connection. If this connection handler is using a database pool, the connection is returned to the pool. If this connection handler is not using a database pool, the connection is closed. If the connection passed as an argument is null, nothing is done.

Parameters:
conn - The connection to release.

destroy

void destroy()
Destroy the connection pool, closing and cleaning all connections. This is important for restarting the web context.

Since:
1.11


Copyright © 2005 Mentawai Team. All Rights Reserved.