com.fdsapi
Class DataAccessJ2EE

java.lang.Object
  |
  +--com.fdsapi.DataAccessBase
        |
        +--com.fdsapi.DataAccessJ2EE
All Implemented Interfaces:
DataAccess

public class DataAccessJ2EE
extends DataAccessBase

Class used to connect to a JDBC data source in a J2EE environment using javax.sql.DataSource. For example in Sybase:

// This maps to the jndi resource reference of "jdbc/MyDataSource"
DataAccess da=new DataAccessJ2EE("MyDataSource");


View Code


Field Summary
 
Fields inherited from class com.fdsapi.DataAccessBase
connection, resultSet, statement
 
Constructor Summary
DataAccessJ2EE()
          Use when InitialContext uses the default constructor, and the default DataSource name should be used.
DataAccessJ2EE(javax.naming.InitialContext initialContext, java.lang.String dataSourceName)
          Use when InitialContext doesn't use the default constructor (for example when a username and password are required in the InitialContext constructor.
DataAccessJ2EE(java.lang.String dataSourceName)
          Use when InitialContext uses the default constructor.
 
Method Summary
 DataAccess createInstance()
           
 java.sql.Connection getConnection()
           
 void setDataSourceName(java.lang.String dataSourceName)
           
 
Methods inherited from class com.fdsapi.DataAccessBase
close, closeConnection, closeResultSet, closeStatement, connectionIsClosed, createStatement, executeQuery, executeUpdate, getDataSourceName, getResultSet, getResultSetConverter, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataAccessJ2EE

public DataAccessJ2EE(javax.naming.InitialContext initialContext,
                      java.lang.String dataSourceName)
Use when InitialContext doesn't use the default constructor (for example when a username and password are required in the InitialContext constructor. The dataSourceName maps to the applications DataSource in the jndi namespace.


DataAccessJ2EE

public DataAccessJ2EE(java.lang.String dataSourceName)
               throws java.sql.SQLException
Use when InitialContext uses the default constructor. The dataSourceName maps to the applications DataSource in the jndi namespace.


DataAccessJ2EE

public DataAccessJ2EE()
               throws java.sql.SQLException
Use when InitialContext uses the default constructor, and the default DataSource name should be used. The dataSourceName maps to the applications DataSource in the jndi namespace. The default DataSource name is "DataSource".

Method Detail

createInstance

public DataAccess createInstance()
                          throws java.sql.SQLException
java.sql.SQLException

setDataSourceName

public void setDataSourceName(java.lang.String dataSourceName)
Specified by:
setDataSourceName in interface DataAccess
Overrides:
setDataSourceName in class DataAccessBase

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
java.sql.SQLException