SRJRCFrames
v0.1.296

de.schwarzrot.data.access.jdbc
Class DriverConnectionFactory

java.lang.Object
  extended by de.schwarzrot.data.access.jdbc.DriverConnectionFactory
All Implemented Interfaces:
org.apache.commons.dbcp.ConnectionFactory

public class DriverConnectionFactory
extends Object
implements org.apache.commons.dbcp.ConnectionFactory

as DriverManager does not work with dynamically loaded jdbc-drivers, this class is a try to bypass limitations of DriverManager. Seems to work at first sight ...

Author:
Reinhard Mantey

Constructor Summary
DriverConnectionFactory(Driver driver, String connectUri, Properties props)
          Constructor for DriverConnectionFactory, where the driver can be configured by given java.util.Properties.
DriverConnectionFactory(Driver driver, String connectUri, String uname, String passwd)
          Simple Constructor for DriverConnectionFactory.
 
Method Summary
 Connection createConnection()
           
protected  Properties setupDefaults(String uname, String passwd)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DriverConnectionFactory

public DriverConnectionFactory(Driver driver,
                               String connectUri,
                               Properties props)
Constructor for DriverConnectionFactory, where the driver can be configured by given java.util.Properties.

Parameters:
driver - the jdbc-Driver instance
connectUri - a database url of the form jdbc:subprotocol:subname
props - the properties to configure the driver and the connections it will return. The java.util.Properties should contain at least "user" and "password".

DriverConnectionFactory

public DriverConnectionFactory(Driver driver,
                               String connectUri,
                               String uname,
                               String passwd)
Simple Constructor for DriverConnectionFactory.

Parameters:
driver - the jdbc-Driver instance
connectUri - a database url of the form jdbc:subprotocol:subname
uname - the database user
passwd - the user's password
Method Detail

createConnection

public Connection createConnection()
                            throws SQLException
Specified by:
createConnection in interface org.apache.commons.dbcp.ConnectionFactory
Throws:
SQLException

setupDefaults

protected Properties setupDefaults(String uname,
                                   String passwd)

SRJRCFrames
v0.1.296

hosted at
Find SRJRCFrames at SourceForge.net. Fast, secure and free:
           Open Source Software download
Submit a bug or request a feature

SRJRCFrames is published according to the GNU General Public License
Copyright 2005-2012 Reinhard Mantey - some rights reserved.