com.nonesole.persistence.connectionpool
Class DriverDataSource

java.lang.Object
  extended by com.nonesole.persistence.connectionpool.DriverDataSource
All Implemented Interfaces:
javax.sql.DataSource

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

Local data source

 Use��
 1.Create new datasource from jdbc config
 	   DriverDataSource dds = new DriverDataSource(new DriverProperties());
 2.Create new datasource from context of server just like Tomcat��
 	   Context ctx = new InitialContext();
 	   DataSource ds = ctx.lookup("jdbc/db");
 3.Create new datasource from Persistence frame
 	   ConnectionPoolServer.initPool();
 	   DataSource ds = ConnectionPoolContext.getDataSource("mysql");
 

Version:
1.0 - build in 2009-07-04
Author:
JACK LEE

Constructor Summary
DriverDataSource(DriverProperties driver)
          Construction
 
Method Summary
 java.sql.Connection getConnection()
           
 java.sql.Connection getConnection(java.lang.String username, java.lang.String password)
           
 DriverProperties getDriverProperties()
          Get driver configuration
 int getLoginTimeout()
           
 java.io.PrintWriter getLogWriter()
           
 void setLoginTimeout(int seconds)
           
 void setLogWriter(java.io.PrintWriter out)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DriverDataSource

public DriverDataSource(DriverProperties driver)
                 throws OperationsException
Construction

Parameters:
driver - jdbc config object
Throws:
OperationsException
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)
                                  throws java.sql.SQLException
Specified by:
getConnection in interface javax.sql.DataSource
Throws:
java.sql.SQLException

getLogWriter

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

setLogWriter

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

getLoginTimeout

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

setLoginTimeout

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

getDriverProperties

public DriverProperties getDriverProperties()
Get driver configuration

See Also:
com.nonesole.persistence.connectionpool.IDriverDataSource#getDriverProperties()