safejdbc
Class SimpleConnectionProvider

java.lang.Object
safejdbc.SimpleConnectionProvider
- All Implemented Interfaces:
- ConnectionProvider
- public class SimpleConnectionProvider
- extends java.lang.Object
- implements ConnectionProvider
This class provides JDBC connection via the JDBC 1 Driver.
But this is only an example-implementation and should not be used in
real-world-projects, because connections are not cached. This means
every call to getConnection() is delegated to the underlying
driver. The driver than creates a connection, wich is a very
expensive (time consuming) operation.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_driver
private java.sql.Driver _driver
_url
private java.lang.String _url
_info
private java.util.Properties _info
SimpleConnectionProvider
public SimpleConnectionProvider(java.lang.String user,
java.lang.String password,
java.lang.String url,
java.lang.String drivername)
throws java.lang.Exception
- This constructor initializes the driver via separate strings.
Example:
ConnectionProvider conprovider = new SimpleConnectionProvider
("hermanns", "password",
"jdbc:db2://192.168.11.10:8400/Test",
"COM.ibm.db2.jdbc.net.DB2Driver");
SimpleConnectionProvider
public SimpleConnectionProvider(java.lang.String url,
java.util.Properties info,
java.lang.String drivername)
throws java.lang.Exception
- This constructor initializes the driver using a map containing login information.
getConnection
public java.sql.Connection getConnection()
throws java.sql.SQLException
- This method is called by the framework to yield a database connection.
- Specified by:
getConnection in interface ConnectionProvider