org.jboss.soa.esb.helpers.persist
Class SimpleDataSource

java.lang.Object
  extended by org.jboss.soa.esb.helpers.persist.SimpleDataSource
All Implemented Interfaces:
javax.sql.DataSource

public class SimpleDataSource
extends java.lang.Object
implements javax.sql.DataSource

Obtain a connection that implements the DataSource interface

Description: Enable compatible use of JdbcCleanConn from outside a J2EE app container

Version:
1.0
See Also:
JdbcCleanConn, ConfigTree

Field Summary
static java.lang.String DRIVER
           
static java.lang.String PASSWORD
           
static java.lang.String URL
           
static java.lang.String USER
           
 
Constructor Summary
SimpleDataSource(ConfigTree p_oP)
          Obtain a DataSource by providing connection parameters.
SimpleDataSource(java.lang.String p_sDriver, java.lang.String p_sDbURL, java.lang.String p_sUsr, java.lang.String p_sPwd)
          Obtain a connection to a DB using the provided arguments to call
 
Method Summary
 java.sql.Connection getConnection()
           
 java.sql.Connection getConnection(java.lang.String username, java.lang.String password)
           
 int getLoginTimeout()
           
 java.io.PrintWriter getLogWriter()
           
 boolean isWrapperFor(java.lang.Class<?> iface)
           
 void setLoginTimeout(int seconds)
           
 void setLogWriter(java.io.PrintWriter out)
           
<T> T
unwrap(java.lang.Class<T> iface)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DRIVER

public static final java.lang.String DRIVER
See Also:
Constant Field Values

URL

public static final java.lang.String URL
See Also:
Constant Field Values

USER

public static final java.lang.String USER
See Also:
Constant Field Values

PASSWORD

public static final java.lang.String PASSWORD
See Also:
Constant Field Values
Constructor Detail

SimpleDataSource

public SimpleDataSource(ConfigTree p_oP)
Obtain a DataSource by providing connection parameters. ConfigTree argument must contain the following attributes

  • driver-class
  • connection-url
  • user-name
  • password
  • Parameters:
    p_oP - ConfigTree - Parameter tree that contains the 4 attributes needed
    See Also:
    ConfigTree, SimpleDataSource(String,String,String,String), DataSource

    SimpleDataSource

    public SimpleDataSource(java.lang.String p_sDriver,
                            java.lang.String p_sDbURL,
                            java.lang.String p_sUsr,
                            java.lang.String p_sPwd)
    Obtain a connection to a DB using the provided arguments to call

    Parameters:
    p_sDriver - String - Java class of the JDBC driver to use (e.g. org.postgresql.Driver)
    p_sDbURL - String - The URL of the database (e.g. jdbc:postgresql://chodedb1:5432/cq3)
    p_sUsr - String - Username
    p_sPwd - String - Password
    See Also:
    DriverManager.getConnection(String,String,String), DataSource
    Method Detail

    getConnection

    public java.sql.Connection getConnection()
                                      throws java.sql.SQLException
    Specified by:
    getConnection in interface javax.sql.DataSource
    Throws:
    java.sql.SQLException

    getConnection

    public java.sql.Connection getConnection(java.lang.String username,
                                             java.lang.String password)
    Specified by:
    getConnection in interface javax.sql.DataSource

    getLoginTimeout

    public int getLoginTimeout()
    Specified by:
    getLoginTimeout in interface javax.sql.DataSource

    getLogWriter

    public java.io.PrintWriter getLogWriter()
    Specified by:
    getLogWriter in interface javax.sql.DataSource

    setLoginTimeout

    public void setLoginTimeout(int seconds)
    Specified by:
    setLoginTimeout in interface javax.sql.DataSource

    setLogWriter

    public void setLogWriter(java.io.PrintWriter out)
    Specified by:
    setLogWriter in interface javax.sql.DataSource

    isWrapperFor

    public boolean isWrapperFor(java.lang.Class<?> iface)
                         throws java.sql.SQLException
    Throws:
    java.sql.SQLException

    unwrap

    public <T> T unwrap(java.lang.Class<T> iface)
             throws java.sql.SQLException
    Throws:
    java.sql.SQLException