com.amazon.carbonado.repo.jdbc
Class SimpleDataSource

java.lang.Object
  extended by com.amazon.carbonado.repo.jdbc.SimpleDataSource
All Implemented Interfaces:
Wrapper, CommonDataSource, DataSource

public class SimpleDataSource
extends Object
implements DataSource

SimpleDataSource does not implement any connection pooling.

Author:
Brian S O'Neill

Constructor Summary
SimpleDataSource(String driverClass, String driverURL, Properties properties)
           
SimpleDataSource(String driverClass, String driverURL, String username, String password)
           
SimpleDataSource(String driverClass, String driverURL, String username, String password, Properties properties)
           
 
Method Summary
 void close()
           
 Connection getConnection()
           
 Connection getConnection(String username, String password)
           
 int getLoginTimeout()
           
 PrintWriter getLogWriter()
           
 boolean isWrapperFor(Class<?> iface)
           
 void setLoginTimeout(int seconds)
           
 void setLogWriter(PrintWriter writer)
           
<T> T
unwrap(Class<T> iface)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleDataSource

public SimpleDataSource(String driverClass,
                        String driverURL,
                        Properties properties)
                 throws SQLException
Parameters:
driverClass - JDBC driver to load; can pass null if already loaded
driverURL - JDBC driver URL
properties - optional connection properties
Throws:
SQLException
Since:
1.2

SimpleDataSource

public SimpleDataSource(String driverClass,
                        String driverURL,
                        String username,
                        String password)
                 throws SQLException
Parameters:
driverClass - JDBC driver to load; can pass null if already loaded
driverURL - JDBC driver URL
username - optional username to connect with
password - optional password to connect with
Throws:
SQLException

SimpleDataSource

public SimpleDataSource(String driverClass,
                        String driverURL,
                        String username,
                        String password,
                        Properties properties)
                 throws SQLException
Parameters:
driverClass - JDBC driver to load; can pass null if already loaded
driverURL - JDBC driver URL
username - optional username to connect with
password - optional password to connect with
properties - optional connection properties
Throws:
SQLException
Since:
1.2
Method Detail

getConnection

public Connection getConnection()
                         throws SQLException
Specified by:
getConnection in interface DataSource
Throws:
SQLException

getConnection

public Connection getConnection(String username,
                                String password)
                         throws SQLException
Specified by:
getConnection in interface DataSource
Throws:
SQLException

getLogWriter

public PrintWriter getLogWriter()
                         throws SQLException
Specified by:
getLogWriter in interface CommonDataSource
Throws:
SQLException

setLogWriter

public void setLogWriter(PrintWriter writer)
                  throws SQLException
Specified by:
setLogWriter in interface CommonDataSource
Throws:
SQLException

setLoginTimeout

public void setLoginTimeout(int seconds)
                     throws SQLException
Specified by:
setLoginTimeout in interface CommonDataSource
Throws:
SQLException

getLoginTimeout

public int getLoginTimeout()
                    throws SQLException
Specified by:
getLoginTimeout in interface CommonDataSource
Throws:
SQLException

close

public void close()
           throws SQLException
Throws:
SQLException
Since:
1.2

unwrap

public <T> T unwrap(Class<T> iface)
         throws SQLException
Specified by:
unwrap in interface Wrapper
Throws:
SQLException
Since:
1.2

isWrapperFor

public boolean isWrapperFor(Class<?> iface)
                     throws SQLException
Specified by:
isWrapperFor in interface Wrapper
Throws:
SQLException
Since:
1.2


Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.