Java EE 5 SDK

com.sun.appserv.jdbc
Interface DataSource

All Superinterfaces:
DataSource

public interface DataSource
extends DataSource

The javax.sql.DataSource implementation of SunONE application server will implement this interface. An application program would be able to use this interface to do the extended functionality exposed by SunONE application server.

A sample code for getting driver's connection implementation would like the following.

     InitialContext ic = new InitialContext();
     com.sun.appserv.DataSource ds = (com.sun.appserv.DataSOurce) ic.lookup("jdbc/PointBase"); 
     Connection con = ds.getConnection();
     Connection drivercon = ds.getConnection(con);

     // Do db operations.

     con.close();
   

Author:
Binod P.G

Method Summary
 Connection getConnection(Connection con)
          Retrieves the actual SQLConnection from the Connection wrapper implementation of SunONE application server.
 Connection getNonTxConnection()
          Gets a connection that is not in the scope of any transaction.
 Connection getNonTxConnection(String userName, String password)
          Gets a connection that is not in the scope of any transaction.
 
Methods inherited from interface javax.sql.DataSource
getConnection, getConnection, getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
 

Method Detail

getConnection

Connection getConnection(Connection con)
                         throws SQLException
Retrieves the actual SQLConnection from the Connection wrapper implementation of SunONE application server. If an actual connection is supplied as argument, then it will be just returned.

Parameters:
con - Connection obtained from Datasource.getConnection()
Returns:
java.sql.Connection implementation of the driver.
Throws:
java.sql.SQLException - If connection cannot be obtained.
SQLException

getNonTxConnection

Connection getNonTxConnection()
                              throws SQLException
Gets a connection that is not in the scope of any transaction. This can be used to save performance overhead incurred on enlisting/delisting each connection got, irrespective of whether its required or not. Note here that this meethod does not fit in the connector contract per se.

Returns:
java.sql.Connection
Throws:
java.sql.SQLException - If connection cannot be obtained
SQLException

getNonTxConnection

Connection getNonTxConnection(String userName,
                              String password)
                              throws SQLException
Gets a connection that is not in the scope of any transaction. This can be used to save performance overhead incurred on enlisting/delisting each connection got, irrespective of whether its required or not. Note here that this meethod does not fit in the connector contract per se.

Parameters:
user - User name for authenticating the connection
password - Password for authenticating the connection
Returns:
java.sql.Connection
Throws:
java.sql.SQLException - If connection cannot be obtained
SQLException

Java EE 5 SDK

Submit a bug or feature

Copyright 2006 Sun Microsystems, Inc. All rights reserved.