thinkmap.server
Class JDBCDatabase

java.lang.Object
  extended by thinkmap.server.JDBCDatabase
All Implemented Interfaces:
Wrapper, CommonDataSource, DataSource

public class JDBCDatabase
extends Object
implements DataSource

A javax.sql.DataSource that uses a JDBC Driver to establish connections. This class should be used for testing only. Production configurations should use the JNDIDataSource class.


Constructor Summary
JDBCDatabase()
           
 
Method Summary
 Parameter createParam()
          Create a parameter that will be passed to the Driver when establishing a connection.
 Connection getConnection()
           
 Connection getConnection(String username, String password)
           
 int getLoginTimeout()
           
 PrintWriter getLogWriter()
           
 boolean isWrapperFor(Class c)
           
 void setDriver(String driver)
          Set the JDBC driver class to be used for this DataSource
 void setLoginTimeout(int seconds)
           
 void setLogWriter(PrintWriter out)
           
 void setPassword(String password)
          Set the password to be used for connecting to the database.
 void setURL(String s)
          Set the JDBC URL to be used for this DataSource
 void setUser(String user)
          Set the user to be used for connecting to the database.
 Object unwrap(Class c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCDatabase

public JDBCDatabase()
Method Detail

setURL

public void setURL(String s)
Set the JDBC URL to be used for this DataSource

Parameters:
s - The URL

setDriver

public void setDriver(String driver)
Set the JDBC driver class to be used for this DataSource

Parameters:
s - the JDBC driver class to be used for this DataSource

setUser

public void setUser(String user)
Set the user to be used for connecting to the database.

Parameters:
user - the user to be used for connecting to the database.

setPassword

public void setPassword(String password)
Set the password to be used for connecting to the database.

Parameters:
password - the password to be used for connecting to the database.

createParam

public Parameter createParam()
Create a parameter that will be passed to the Driver when establishing a connection.

Returns:
a parameter that will be passed to the Driver when establishing a connection.

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 out)
                  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

isWrapperFor

public boolean isWrapperFor(Class c)
                     throws SQLException
Specified by:
isWrapperFor in interface Wrapper
Throws:
SQLException

unwrap

public Object unwrap(Class c)
              throws SQLException
Specified by:
unwrap in interface Wrapper
Throws:
SQLException


Copyright © 2013 Thinkmap, Inc. All Rights Reserved.