Oracle connection caching 
Author Message
 Oracle connection caching

Has anyone used Oracle's implementaion of connection cashing and
pooling? I am trying to use the sample example but getting the
SQLException.  But the exception message is poorly constructed.  Has
anyone been able to run it. Here is my code:

import java.sql.*;
import javax.sql.*;
import oracle.jdbc.driver.*;
import oracle.jdbc.pool.*;

class PooledConnection
{
  public static void main (String args [])
       throws SQLException
  {
    OracleConnectionCacheImpl ods = new OracleConnectionCacheImpl();
tcp)(PORT=1523))(CONNECT_DATA=(SID=scorm)))");
    ods.setUser("towner");
    ods.setPassword("towner");

    ods.setDriverType("thin");
    ods.setServerName("strauss");
    ods.setDatabaseName("scorm");
    ods.setPortNumber(1523) ;

     // Set the Max Limit
    ods.setMaxLimit (10);

    Connection conn1 = null;
    System.out.println("get connection");
    conn1 = ods.getConnection();
    if (conn1 != null)
      System.out.println("Connection 1 " + " Succeeded!");
    else
      System.out.println("Connection 1 " + " Failed !!!");

    Connection conn2 = null;
    conn2 = ods.getConnection();
    if (conn2 != null)
      System.out.println("Connection 2 " + " Succeeded!");
    else
      System.out.println("Connection 2 " + " Failed !!!");

    Connection conn3 = null;
    conn3 = ods.getConnection();
    if (conn3 != null)
      System.out.println("Connection 3 " + " Succeeded!");
    else
      System.out.println("Connection 3 " + " Failed !!!");

    Connection conn4 = null;
    conn4 = ods.getConnection();
    if (conn4 != null)
      System.out.println("Connection 4 " + " Succeeded!");
    else
      System.out.println("Connection 4 " + " Failed !!!");

    Connection conn5 = null;
    conn5 = ods.getConnection();
    if (conn5 != null)
      System.out.println("Connection 5 " + " Succeeded!");
    else
      System.out.println("Connection 5 " + " Failed !!!");

    System.out.println("Active size : " + ods.getActiveSize());
    System.out.println("Cache Size is " + ods.getCacheSize());

    // Close 3 logical Connections
    conn1.close();
    conn2.close();
    conn3.close();

    System.out.println("Active size : " + ods.getActiveSize());
    System.out.println("Cache Size is " + ods.getCacheSize());

    // close the Data Source
    ods.close();

    System.out.println("Active size : " + ods.getActiveSize());
    System.out.println("Cache Size is " + ods.getCacheSize());
  }

Quote:
}

Here is the error I am getting:

/weber/ps/projects/scormdev/code/4.2/connPool> run.sh PooledConnection
get connection
Setting the user name and passwwdd towner  towner
Exception in thread "main" java.sql.SQLException: Invalid Oracle URL
specified: OracleDataSource.makeURL
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:156)
        at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:775)
        at oracle.jdbc.pool.OracleDataSource.makeURL(OracleDataSource.java:413)
        at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:100)
        at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection(OracleConnectionPoolDataSource.java:98)
        at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:77)
        at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:61)
        at oracle.jdbc.pool.OracleConnectionCacheImpl.getNewPoolConnection(OracleConnectionCacheImpl.java:264)
        at oracle.jdbc.pool.OracleConnectionCacheImpl.getConnection(OracleConnectionCacheImpl.java:214)
        at oracle.jdbc.pool.OracleConnectionCacheImpl.getConnection(OracleConnectionCacheImpl.java:157)
        at PooledConnection.main(PooledConnection.java:39)
/weber/ps/projects/scormdev/code/4.2/connPool>

I will really appreciate any suggestions.

Thanks

Jamal



Wed, 24 Mar 2004 06:01:50 GMT
 
 [ 1 post ] 

 Relevant Pages 

1. Oracle connection cache problem

2. Caching connections and Application Roles

3. Specifying client cache size within MSOLAP connection string

4. Connection Pooling/Cache Code available

5. DAO caches UID and PWD for a given ODBC connection

6. Connection String Parameter = Cache Policy=7

7. Connection Caching in JSP over application scope

8. Problems with dao and connection caching

9. JET ODBC Cached Connections remains open after a Snapshot Close Method is used

10. Newbie: Connection pooling and Statement caching

11. dao connection caching problem

12. Connection cache?


 
Powered by phpBB® Forum Software