org.openxava.util
Interface IConnectionProvider

All Known Subinterfaces:
IEJBContext, IEJBContextInit
All Known Implementing Classes:
DataSourceConnectionProvider, EJB11Context

public interface IConnectionProvider

Provides JDBC connections.

Author:
Javier Paniza

Method Summary
 java.sql.Connection getConnection()
          Returns a JDBC connection by default.
 java.sql.Connection getConnection(java.lang.String dataSourceName)
          Returns a JDBC connection from a identifier.
 void setDefaultDataSource(java.lang.String dataSourceName)
          Sets the datasource name used when using getConnection().
 void setPassword(java.lang.String password)
          Sets password used to create connection.
 void setUser(java.lang.String user)
          Sets the user used to craete the connection.
 

Method Detail

getConnection

java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Returns a JDBC connection by default.

Throws:
java.sql.SQLException - If there are problem obtaining the connetion

getConnection

java.sql.Connection getConnection(java.lang.String dataSourceName)
                                  throws java.sql.SQLException
Returns a JDBC connection from a identifier.

Parameters:
dataSourceName - Name of data source from what I obtain the connection
Throws:
java.sql.SQLException - If there are problem obtaining the connetion

setPassword

void setPassword(java.lang.String password)
Sets password used to create connection.

* Must to call to setUser(java.lang.String) too. Although set user and password is not mandatory.


setDefaultDataSource

void setDefaultDataSource(java.lang.String dataSourceName)
Sets the datasource name used when using getConnection().


setUser

void setUser(java.lang.String user)
Sets the user used to craete the connection.

It is not mandatory to call this method.