Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

safejdbc
Class SimpleConnectionProvider  view SimpleConnectionProvider download SimpleConnectionProvider.java

java.lang.Object
  extended bysafejdbc.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.


Field Summary
private  java.sql.Driver _driver
           
private  java.util.Properties _info
           
private  java.lang.String _url
           
 
Constructor Summary
SimpleConnectionProvider(java.lang.String url, java.util.Properties info, java.lang.String drivername)
          This constructor initializes the driver using a map containing login information.
SimpleConnectionProvider(java.lang.String user, java.lang.String password, java.lang.String url, java.lang.String drivername)
          This constructor initializes the driver via separate strings.
 
Method Summary
 java.sql.Connection getConnection()
          This method is called by the framework to yield a database connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_driver

private java.sql.Driver _driver

_url

private java.lang.String _url

_info

private java.util.Properties _info
Constructor Detail

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.

Method Detail

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