com.imcode.imcms.api
Class DatabaseService

java.lang.Object
  extended by com.imcode.imcms.api.DatabaseService

public class DatabaseService
extends java.lang.Object


Constructor Summary
DatabaseService(javax.sql.DataSource dataSource)
           
 
Method Summary
 java.sql.Connection getConnection()
          Get a databaseconnection from the connectionpool.
 javax.sql.DataSource getDataSource()
          Get the underlying DataSource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseService

public DatabaseService(javax.sql.DataSource dataSource)
Method Detail

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Get a databaseconnection from the connectionpool. IMPORTANT: Do not forget to make sure that the connection is closed (inside a "finally" block!), otherwise it won't be returned to the pool.

Returns:
a Connection from the connectionpool.
Throws:
java.sql.SQLException - if there was a problem getting the connection.

getDataSource

public javax.sql.DataSource getDataSource()
Get the underlying DataSource.

Returns:
a DataSource.