oracle.clex.persistence.jdbc
Class JDBCConnectionProvider

java.lang.Object
  |
  +--oracle.cle.persistence.ConnectionProvider
        |
        +--oracle.clex.persistence.jdbc.JDBCConnectionProvider
All Implemented Interfaces:
Connectable, java.io.Serializable

public class JDBCConnectionProvider
extends ConnectionProvider

Vital information required for CLE connection.

Attributes can automatically be set and loaded by specifying properties in the "cle-providers.xml" file at the root of the classpath (ie. WEB-INF/classes/cle-providers.xml). See the http://xmlns.oracle.com/ias/mvc/cle-providers.dtd for more on structure of the file.

Example JDBC Connection Provider in cle-providers.xml:

 <?xml version="1.0" standalone="yes"?>
 <!DOCTYPE cle-providers SYSTEM "http://xmlns.oracle.com/ias/mvc/cle-providers.dtd">
 <cle-providers>
  <provider name="personnel_jdbc" class="oracle.clex.persistence.jdbc.JDBCConnectionProvider">
    <property name="user" value="scott"/>
	  <property name="password" value="dGlnZXI="/>
	  <property name="connectionstring" value="jdbc:oracle:thin:scott/dGlnZXI=@localhost:1521:orcl"/>
	  <property name="host" value="localhost"/>
	  <property name="port" value="1521"/>
	  <property name="sid" value="orcl"/>
	  <property name="encryptiontype" value="BASE64"/>
	  <property name="drivertype" value="oracle.jdbc.driver.OracleDriver"/>
	  <property name="persistencebase" value="oracle.demo.personnel.persistence.jdbc"/>
	  <property name="failover" value=""/>
  </provider>
 </cle-providers>
 

Typical Usage in a Handler:

  public Vector aHandlerMethod(Object sessionId, <ArgumentType> aArgument)
    throws Exception
  {
    Connection conn = (Connection)getConnection(sessionId);
    .... use the connection here ...
    releaseConnection(sessionId);

    return theResult;
  } // end aHandlerMethod
 

See Also:
Serialized Form

Field Summary
protected  java.util.Hashtable pool
          Holds the Connections that this provider has pooled out
 
Fields inherited from class oracle.cle.persistence.ConnectionProvider
BASE64, connection, connectionString, CONNECTIONSTRING, defaultProperties, deploymentKey, driverType, DRIVERTYPE, encryptionType, ENCRYPTIONTYPE, failover, FAILOVER, host, HOST, NO_SCOPE, NONE, password, PASSWORD, persistenceBase, PERSISTENCEBASE, port, PORT, releasedConnectionIds, REQUEST_SCOPE, scope, SCOPE, SESSION_SCOPE, sessionConnectionIds, sid, SID, USER, userName
 
Constructor Summary
JDBCConnectionProvider(java.util.Properties properties)
          Default Constructor
 
Method Summary
 void connect()
          Connect to the database using its own provider info.
 void disconnect()
          Does Nothing
 java.lang.Object getConnection(java.lang.Object sessionId)
          Returns a connection
 java.lang.Object getConnection(java.lang.Object sessionId, int failover)
          Does Nothing..
protected  java.lang.String getPoolKey(java.lang.Object sessionId)
          This method is used in getConnection and releaseConnection to get a unique id for the pool
 int hashCode()
          Override Object.hashCode() so that we can differentiate JDBCConnection copies in the ConnectionPool.
 boolean isConnected()
          Returns the state of the connection for the Provider
 boolean isSame(ConnectionProvider provider)
          Compares this JDBCConnection info and returns true if their values are the same...
 void releaseConnection(java.lang.Object sessionId)
          Release the connection associated to the sessionId
 
Methods inherited from class oracle.cle.persistence.ConnectionProvider
addPropertyKey, addPropertyKeys, applyDynamicProperties, clone, compareDynamicProperties, compareProperty, equals, getConnection, getConnection, getConnection, getConnection, getConnection, getConnection, getConnectionString, getDefaultProperties, getDeploymentKey, getDriverType, getEncryptionType, getFailOver, getHost, getPassword, getPassword, getPersistenceBase, getPort, getProperty, getPropertyKeys, getScope, getSid, getUnspecifiedKeys, getUserName, issueWarnings, releaseAllConnections, releaseAllConnections, releaseConnection, releaseConnection, releaseConnection, releaseRequestScopedConnections, releaseRequestScopedConnections, removePropertyKey, setConnectionString, setDefaultProperties, setDeploymentKey, setEncryptionType, setHost, setPassword, setPersistenceBase, setPort, setScope, setSid, setUserName, warn
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pool

protected java.util.Hashtable pool
Holds the Connections that this provider has pooled out
Constructor Detail

JDBCConnectionProvider

public JDBCConnectionProvider(java.util.Properties properties)
Default Constructor
Method Detail

hashCode

public int hashCode()
Override Object.hashCode() so that we can differentiate JDBCConnection copies in the ConnectionPool. Uses the String class' hashCode method because the mere mortals who wrote this method didn't want to be bothered by writing it
Overrides:
hashCode in class ConnectionProvider
Following copied from class: oracle.cle.persistence.ConnectionProvider
See Also:
Object

isSame

public boolean isSame(ConnectionProvider provider)
Compares this JDBCConnection info and returns true if their values are the same... false otherwise. Returns false when projectName is different
Overrides:
isSame in class ConnectionProvider

connect

public void connect()
Connect to the database using its own provider info.

NOTE: This connect method uses the single string argument version of the DriverManager.getConnection(String connectionString) method. Therefore, you MUST specifiy the username and password for the connection in the property file for any JDBC Connections.


disconnect

public void disconnect()
Does Nothing

isConnected

public boolean isConnected()
Returns the state of the connection for the Provider

getConnection

public java.lang.Object getConnection(java.lang.Object sessionId)
                               throws java.lang.Exception
Returns a connection
Overrides:
getConnection in class ConnectionProvider

getConnection

public java.lang.Object getConnection(java.lang.Object sessionId,
                                      int failover)
Does Nothing.. returns null
Overrides:
getConnection in class ConnectionProvider

releaseConnection

public void releaseConnection(java.lang.Object sessionId)
Release the connection associated to the sessionId
Overrides:
releaseConnection in class ConnectionProvider

getPoolKey

protected java.lang.String getPoolKey(java.lang.Object sessionId)
This method is used in getConnection and releaseConnection to get a unique id for the pool


Copyright © 2003 ORACLE Corp. All Rights Reserved.