Connection pooling of SOAPConnection objects

We have a requirement to pass SOAP Message to the Web service server. Currently we are creating the SOAP messages using SAAJ (SOAP with attachments API for java) APIs provided by SUN. The external system from where we are consuming the webservices has 2 Web servers behind a load balancer to serve the SOAP request. We are using SOAPConnection API of the javax.xml.soap package for connecting to the Web Service. Using this we are able to create SOAPMessage and send to Web Service for execution.
However, the requirement is to create a Connection Pool with the SOAP connections to the Web Service. To do this, we need some clarification
1) Is it worth creating SOAP connection (object) pool with SOAPConnection object? Because, as per the API, the actual connection to the webservice takes only when call() method of the SOAPConnection is invoked.In the same method call the connection and message passing to Web Service service is happening.
2) Is there any techniques in java to pass SOAP Message over HTTP which facilitates connection pooling aswell?

Is this for inserts/updates or for selects.
do you get this with a single object bind (in preference to binding each attribute individually)
Dom

Similar Messages

  • JDBC 8.1.6 Connection Pooling and Oracle Objects

    I managed to make OracleConnectionCacheImpl class work and I noticed one very strange thing:
    when I use simple SQL, connection cache works as good as single permanently opened connection but when I return Oracle objects with nested datasets in my result set performance degrades 10 times to compare to the same sql in case I am using single permanently opened connection.
    I am using custom classess generated by JPublisher to access the objects
    Example:
    Single permanently opened connection
    Simple SQL - 0.1 sec
    Objects with nested datasets - 0.5 sec
    Pooled connection
    Simple SQL - 0.15 sec
    Objects with nested datasets - 5 sec

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jason zheng ([email protected]):
    OracleConnectionCacheImpl occ = new OracleConnectionCacheImpl();
    occ.setURL("jdbc:oracle:thin:@xx.xx.xx.xx:1521:xxxx);
    occ.setUser("xx");
    occ.setPassword("xxx");
    //optional
    occ.setMaxLimit(3);
    occ.setMinLimit(1);
    .....//check api doc
    //retrieve connection
    Connection conn = occ.getConnection();
    //close logical connection
    conn.close()
    //close phsical connection
    occ.close();<HR></BLOCKQUOTE>
    That's all fine and dandy until you try to use JNDI with it. If you create the instance and setMinLimit() when a client tries to get a connection from a JNDI lookup it throws an error saying something like: " user credentials don't match"
    null

  • Questions regarding Connection Pooling

    Hi
    i have some confusion regarding how connection pooling is implemented..i have been doing some digging in to this lately but the more i read the more confused i get. i have some doubts here, will any of the posters here kindly clear them
    a. Do i have to connect to my database via the DataSource method to take advantage of the connection pooling provided by my app server?..i have read conflicting information about this suggesting that Connection Pooling will not be provided to my app if i use DriverManager.getConnection()
    b. if i chose to use the DataSource method do i have to implement the ConnectionPoolDataSource interface to provide the connection pooling for my app?
    c. what is the best way to implement my own custom Connection pool?
    Thanx

    DriverManager.getConnection() literally creates, that is, builds a connection to the database using the values you previously supplied when you loaded the driver.
    A connection pool is an object that contains several already made connections to the database, and simply provides you with one of those existing connections. The confusion arises because a) the method name is frequently the same and b) the connection pool object calls the driver's getConnection() method to create several connections before lending any of them out.
    In other words:
    DriverManager.getConnection() builds a connection to the database.
    ConnectionPool.getConnection() fetches an existing connection.
    So, to answer your questions...
    A. This is correct. If you use DriverManager.getConnection(), you are indeed bypassing the Connection Pool entirely.
    B. I'm not familiar with DataSource specifically, but in general, a third party connection pool will either give you the interface (and you implement the details) or they will give you the class file containing the DataSource object. All you would have to do in the latter case is to import that file, then create a new instance of it using the new keyword ( DataSource foo = new DataSource(); ). I suspect DataSource is indeed the class file.
    C. Creating a connection pool is trivial and there are many examples of it - search on this forum or check out your favorite Java/JDBC programming book. Usually, the question "Should I use a connection pool and why?" is a more important question.

  • How to get ManagedBean for C3P0 connection pool.

    Hi there,
    How to get ManagedBean(C3P0PooledDataSourceMBean) for C3P0 connection pool, as the object name is getting constructed during run time.
    Thanks,
    Sid

    Hi there,
    How to get ManagedBean(C3P0PooledDataSourceMBean) for C3P0 connection pool, as the object name is getting constructed during run time.
    Thanks,
    Sid

  • Connection pool types

    Hi gurus,
    how many types of connection pool? i heard about some connection pool like super user,mega user,general but am not aware of that if any one please explain it what is it?
    Regards,
    Prabhu

    Basically, a connection pool is used to connect the OBIEE RPD to a database. It could be any data source varying from a database to a flat file. In more detail below:
    The connection pool is an object in the Physical layer that describes access to the data source. It contains information about the connection between the Oracle BI Server and that data source.
    The Physical layer in the Administration Tool contains at least one connection pool for each database. When you create the Physical layer by importing a schema for a data source, the connection pool is created automatically. You can configure multiple connection pools for a database. Connection pools allow multiple concurrent data source requests (queries) to share a single database connection, reducing the overhead of connecting to a database.
    For each connection pool, you must specify the maximum number of concurrent connections allowed. After this limit is reached, the connection request waits until a connection becomes available.
    Increasing the allowed number of concurrent connections can potentially increase the load on the underlying database accessed by the connection pool. Test and consult with your DBA to make sure the data source can handle the number of connections specified in the connection pool. Also, if the data sources have a charge back system based on the number of connections, you might want to limit the number of concurrent connections to keep the charge-back costs down.
    In addition to the potential load and costs associated with the database resources, the Oracle BI Server allocates shared memory for each connection upon server startup. This raises the number of connections and increases Oracle BI Server memory usage.
    868844 wrote:
    how many types of connection pool? i heard about some connection pool like super user,mega user,general but am not aware of that if any one please explain it what is it?Comming back to your question regarding different type of users in the connection pool, I believe you are talking about the user of the database and his priviliges. You will need to use a database account with create priviliges, if you want to be able to create tables, write back etc in the database. If it is all about reading the data from the database then all you need a regular database account with read priviliges.
    Hope your question is answered.
    Please award points if helpful.
    Thanks,
    -Amith.

  • Cannot get a connection, pool error Timeout waiting for idle object

    my connection pool setting is
      maxActive="3" minIdle="2"                maxWait="10000"              removeAbandoed="true" logAbandoned="true"         removeAbandonedTimeout="30"         autoreconnection="true" 
    we have 7 people hitting the group of search functions ,
    about 3 minutes I get
    I got error like
    org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object         at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:104)         at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)         at Deferment.showResult.checStudent(showResult.java:135)         at Deferment.showResult.doPost(showResult.java:99)         at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)         at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:402)         at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:170)         at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    I just wonder
    1) Cannot get a connection, pool error Timeout waiting for idle object-> cause by connection pool leaking or other problem.
    2) Setting the maxactive to -1 ( suggestion from Google) , if I set my connection to ulimit , waht should I put on minIdle="2"
    3) How can I test my connection pool have problem or not ? is
    SHOW PROCESSLIST; tolding me someinformation? I use Mysql
    Thank you!

    I try something like ps2 = conn.prepareStatement(target);
                ps2.setString(1, UNumber); // set input parameter
                rs = ps2.executeQuery();
                sendMail = 0;//how many rows we can find.
                while (rs.next()) {
                    sendMail++;
                ps2.close();
                rs.close();
                conn.close();
      if ((count1 == 0) || (count2 == 0)) {
                    conn.rollback();
                } else {
                    conn.commit();
                    conn.setAutoCommit(true);
                ps.close();
                calstat2.close();
                conn.close();
    calstat = (CallableStatement) conn.prepareCall("{call findStudent}");
                calstat.executeQuery();
                calstat.close();
                conn.close();is that enought? what else I should do to make sure I did close all the connection, after I use it ?
    thank you

  • Easy JNDI + Connection Pool Question

    This is an easy question:
    Once I get the object represented by my connection pool from the
    Weblogic JNDI tree, how do I get a connection from the returned object
    of type weblogic.common.internal.ResourceAllocator?
    I keep getting ClassCastExceptions. I have tried
    ConnectionPoolDataSource, Connection, and DataSource.
    String conPool = "weblogic.jdbc.connectionPool.demoPool";
    try {
    Object obj = ctx.lookup(conPool);
    msg(DEBUG,"FROM LOOKUP" + obj.getClass().getName());
    //DataSource ds = (DataSource)ctx.lookup(conPool);
    //con = ds.getConnection();
    } catch (NameNotFoundException e) {
    // binding does not exist
    msg(ERROR,"BINDING DOES NOT EXIST",e);
    } catch (NamingException e) {
    // a failure occurred
    msg(ERROR,"NAMING FAILURE OCCURED",e);
    } catch (Exception e) {
    msg(ERROR,"SOME RANDOM ERROR",e);
    Thanks,
    -Jacob

    "Jacob Meushaw" wrote in message
    Once I get the object represented by my connection pool from the
    Weblogic JNDI tree, how do I get a connection from the returned object
    of type weblogic.common.internal.ResourceAllocator?
    I keep getting ClassCastExceptions.
    DataSource ds = (DataSource)ctx.lookup(conPool);I think, you must use narrow operation:
    Object reference = ctx.lookup(conPool);
    DataSource ds =
    (DataSource) PortableRemoteObject.narrow (ds,DataSource.class);
    I haven't got time to check it, but I hope that works.
    Wojtek

  • External Connection Pool - No Available Connections

    I am using Toplink 9.0.4 in an application deployed on WebLogic 7. Toplink is configured to use an external connection pool.
    Under heavy load we sometimes exhaust the connection pool. When this occurs we start to get failures when trying to acquire connections.
    It appears that when Toplink tries to obtain a connection from the pool and none are available the attempt immediately fails with an exception. What we would prefer to happen is for the thread to block and wait for a connection to become available.
    Do you know of any way to produce this behavior? Is there a way to configure Toplink so this occurs?
    Alternatively is there a practical way to produce this behavior by implementing logic in a ServerSession exception handler? We have implemented an exception handler that handles dropped and stale database connections, but I'm not sure if this is the appropriate place to handle a failure retrieving a connection from the external pool.
    Any suggestions are appreciated.

    Well I have tried but I am unable to write an effective exception handler that can recover from an exception retrieving a connection from an external pool. I wrote the following handler and attached it to the ServerSession.
         public Object handleException(RuntimeException exception) throws DatabaseException{
              if(exception instanceof DatabaseException){
                   DatabaseException dbex = (DatabaseException)exception;
                   String exceptionMessage = dbex.getMessage();
                   if(exceptionMessage != null && exceptionMessage.indexOf("No available connections in pool") >= 0){
                        try{
                             Thread.sleep(5000);                    
                        }catch(InterruptedException e){}
                        oracle.toplink.publicinterface.Session session = null;
                        session = serverSession.acquireClientSession();
                        dbex.setSession(session);
                        if(session != null){
                             DatabaseQuery query = dbex.getQuery();
                             if(query != null){
                                  return session.executeQuery(query);
                             }else{
                                  return null;
                        throw exception;
                   }else{
                        throw exception;
              }else{
                   throw exception;
    It works sometimes but other times I get strange errors when executing the query. I know the mappings are good, the queries succeed under normal circumstances. The following error is commmon:
    Exception Description: The parameter name [UNIQUE_ID] in the query's selection criteria does not match any parameter name defined in the query.
    The other problem I have is the recursive nature of the exception handling. If calling ServerSession.acquireClientSession() in the exception handler causes an exception, I end up in another exception handler. It's not clear which instance should execute and return the query in this case.
    Any suggestions or examples of exception handlers for this situation are appreciated.

  • Can't startup connection pool

    Hi All,
    I have defined a connection pool to Sybase ASE 12.0. On WLS startup, the connection
    fails due to a login failure. Needless to say, the user and passwords are absolutely
    the right ones. IN included the def for the pool (config.xml) and the log output
    below. Any ideas?
    From config.xml:
    <JDBCConnectionPool
         DriverName="com.sybase.jdbc.SybDriver"
    Name="egate2-pool"
    Password="none"
    Properties="user=mfinn;password=mfi123"
    URL="jdbc:sybase:Tds:egate2.dev.east.frontiercorp.com:4100"
    CapacityIncrement="1"
         InitialCapacity="1"
         MaxCapacity="2"
         RefreshMinutes="0"
         ShrinkPeriodMinutes="15"
         ShrinkingEnabled="true"
         Targets="mjf375"
         TestConnectionsOnRelease="false"
         TestConnectionsOnReserve="false"
    />
    <JDBCDataSource
         JNDIName="egate2-jdbcds"
         Name="egate2"
    PoolName="egate2-pool"
    RowPrefetchEnabled="false"
    StreamChunkSize="256"
    />
    From weblogic.log:
    ####<Jul 10, 2001 12:24:16 PM EDT> <Error> <JDBC> <egatedev1> <mjf375> <main>
    <system> <> <001060> <Cannot startup connection pool "egate2-pool" weblogic.common.ResourceException:
    Could not create pool connection. The DBMS driver exception was:
    java.sql.SQLException: JZ00L: Login failed. Examine the SQLWarnings chained to
    this exception for the reason(s).
         at com.sybase.jdbc.ErrorMessage.raiseError(ErrorMessage.java)
         at com.sybase.tds.Tds.processLoginAckToken(Tds.java)
         at com.sybase.tds.Tds.doLogin(Tds.java)
         at com.sybase.tds.Tds.login(Tds.java)
         at com.sybase.jdbc.SybConnection.<init>(SybConnection.java)
         at com.sybase.jdbc.SybDriver.connect(SybDriver.java)
         at weblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(ConnectionEnvFactory.java:188)
         at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(ConnectionEnvFactory.java:130)
         at weblogic.common.internal.ResourceAllocator.makeResources(ResourceAllocator.java:707)
         at weblogic.common.internal.ResourceAllocator.<init>(ResourceAllocator.ja
    TIA,
    Mike

    Hi Mike. Don't specify the password except
    as you have done in the properties. Let me
    know...
    Joe
    Mike wrote:
    >
    Just to add:
    1) I can login to the same URL (same login and password) from a standalone app
    using the com.sybase.jdbc.SybDriver in the weblogic.jar. This is with user/password
    being set in a properties object, as I assume is happening in WLS when the connection
    is attempted. IOW, I am using getConnection(url,props) as opposed to getConnection(url,user,passwd,props).
    2) The problem stated below also applies against a ASE 11.9.2 server.
    Mike
    "Mike" <[email protected]> wrote:
    Hi All,
    I have defined a connection pool to Sybase ASE 12.0. On WLS startup,
    the connection
    fails due to a login failure. Needless to say, the user and passwords
    are absolutely
    the right ones. IN included the def for the pool (config.xml) and the
    log output
    below. Any ideas?
    From config.xml:
    <JDBCConnectionPool
    DriverName="com.sybase.jdbc.SybDriver"
    Name="egate2-pool"
    Password="none"
    Properties="user=mfinn;password=mfi123"
    URL="jdbc:sybase:Tds:egate2.dev.east.frontiercorp.com:4100"
    CapacityIncrement="1"
    InitialCapacity="1"
    MaxCapacity="2"
    RefreshMinutes="0"
    ShrinkPeriodMinutes="15"
    ShrinkingEnabled="true"
    Targets="mjf375"
    TestConnectionsOnRelease="false"
    TestConnectionsOnReserve="false"
    />
    <JDBCDataSource
    JNDIName="egate2-jdbcds"
    Name="egate2"
    PoolName="egate2-pool"
    RowPrefetchEnabled="false"
    StreamChunkSize="256"
    />
    From weblogic.log:
    ####<Jul 10, 2001 12:24:16 PM EDT> <Error> <JDBC> <egatedev1> <mjf375>
    <main>
    <system> <> <001060> <Cannot startup connection pool "egate2-pool" weblogic.common.ResourceException:
    Could not create pool connection. The DBMS driver exception was:
    java.sql.SQLException: JZ00L: Login failed. Examine the SQLWarnings
    chained to
    this exception for the reason(s).
    at com.sybase.jdbc.ErrorMessage.raiseError(ErrorMessage.java)
    at com.sybase.tds.Tds.processLoginAckToken(Tds.java)
    at com.sybase.tds.Tds.doLogin(Tds.java)
    at com.sybase.tds.Tds.login(Tds.java)
    at com.sybase.jdbc.SybConnection.<init>(SybConnection.java)
    at com.sybase.jdbc.SybDriver.connect(SybDriver.java)
    at weblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(ConnectionEnvFactory.java:188)
    at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(ConnectionEnvFactory.java:130)
    at weblogic.common.internal.ResourceAllocator.makeResources(ResourceAllocator.java:707)
    at weblogic.common.internal.ResourceAllocator.<init>(ResourceAllocator.ja
    TIA,
    Mike
    PS: Folks: BEA WebLogic is expanding rapidly, with both entry and advanced positions
    for people who want to work with Java, XML, SOAP and E-Commerce infrastructure products.
    We have jobs at Nashua NH, Liberty Corner NJ, San Francisco and San Jose CA.
    Send resumes to [email protected]

  • Connection pool for ldap

    Hi
    My application is an interface to ldap directory. I have not used any ldap open source api to retrieve data from ldap. I have written connection pool that will help the application to connect to the ldap. It's working fine, but it's creating threads which are not invited.
    ConnectionPool class takes care of the connection storage and creation, while Housekeeping thread relases these connection when idle after a given time.
    Can someone please help in finding the problem in the code that creates additional threads.
    package com.ba.cdLookup.manager;
    import com.ba.cdLookup.exception.CDLookupException;
    import com.ba.cdLookup.server.CdLookupProperties;
    import java.util.Vector;
    import javax.naming.Context;
    import javax.naming.NamingException;
    public class HouseKeeperThread extends Thread {
             * Apache Logger to log erro/info/debug statements.
        protected static org.apache.commons.logging.Log log = org.apache.axis.components.logger.LogFactory
             .getLog(HouseKeeperThread.class.getName());
        private static HouseKeeperThread houseKeeperThread;
             * Close all connections existing.
             * @param connections
             *                void
        private void closeConnections(Vector connections) {
         String methodIdentifier = "closeConnections";
         int numOfConn = connections.size();
         try {
             for (int i = 0; i < numOfConn; i++) {
              Context context = (Context) connections.get(i);
              if (context != null) {
                  context.close();
                  context = null;
                  connections.remove(i);
                  numOfConn--;
                  log.info(" connection name:" + context
                       + " removed. Threadcount =" + (connections.size()));
         } catch (NamingException e) {
             String errMsg = "CDLdapBuilder connect() - failure while releasing connection "
                  + " Exception is " + e.toString();
             log.error(errMsg);
         } catch (Exception e) {
             String errMsg = "CDLdapBuilder connect() - failure while releasing connection "
                  + " Exception is " + e.toString();
             log.error(errMsg);
             * Thread run method
        public void run() {
         String methodIdentifier = "run";
         try {
             while(true){
              log.debug("house keeping :" + this + " ---sleep");
              //sleep(100000);
              log.debug("house keeping :" + this + " startd after sleep");
               sleep(CdLookupProperties.getHouseKeepConnectionTime());
              ConnectionPool connectionPool = ConnectionPool
                   .getConnectionPool();
              Vector connList = connectionPool.getAvailableConnections();
              closeConnections(connList);
         } catch (CDLookupException cde) {
             log.error(methodIdentifier + " " + cde.getStackTrace());
         } catch (InterruptedException ie) {
             log.error(methodIdentifier + " " + ie.getStackTrace());
         * @param connectionPool
         * @return
         * Thread
        public static Thread getInstance() {
         if(houseKeeperThread==null){
             houseKeeperThread = new HouseKeeperThread();
         return houseKeeperThread ;
    package com.ba.cdLookup.manager;
    import com.ba.cdLookup.exception.CDLookupException;
    import com.ba.cdLookup.server.CdLookupProperties;
    import com.ba.cdwebservice.schema.cdLookupPacket.LookupFailureReasons;
    import java.util.Properties;
    import java.util.Vector;
    import javax.naming.Context;
    import javax.naming.NamingException;
    import javax.naming.directory.DirContext;
    import javax.naming.directory.InitialDirContext;
    * ConnectionPool class manages, allocates LDAP connections. It works as a lazy
    * binder and retrieves connections only when required. It doesn't allow
    * connection greater then the maximum connection stated.
    * To retrieve a connection the singelton method getConnectionPool is to used,
    * which retruns thread safe singleton object for the connection.
    public class ConnectionPool implements Runnable {
        private int initialConnections = 0;
        private int maxConnections = 0;
        private boolean waitIfBusy = false;
        private Vector availableConnections, busyConnections;
        private boolean connectionPending = false;
        private static int threadCount = 0;
             * classIdentifier
        private final String classIdentifier = "ConnectionPool";
             * Apache Logger to log erro/info/debug statements.
        protected static org.apache.commons.logging.Log log = org.apache.axis.components.logger.LogFactory
             .getLog(CDLdapBuilder.class.getName());
             * To get the attribute a systemaccessfor out of the search result
        private String vendorContextFactoryClass = "com.sun.jndi.ldap.LdapCtxFactory";// "com.ibm.jndi.LDAPCtxFactory";
             * context factory to use
        private String ldapServerUrl = "LDAP://test.ldap.com"; // default ldap
             * server live used by default
        private String searchBase;
             * environment properties.
        private Properties env;
             * DirContext
        private javax.naming.directory.DirContext ctx;
             * default search base to be used in Corporate Directory searches
        private String defaultSearchBase = "dc=Pathway";
             * search criteria
        private String searchAttributes;
             * search filter to retrieve data from CD
        private String searchFilter;
             * CorporateDirectoryLookup Constructor
             * <p>
             * loads the setup parameters from the properties file and stores them
             * Makes a connection to the directory and sets default search base
             * @throws CDLookupException
             * @throws CDLookupException
        private ConnectionPool() throws CDLookupException {
         this.maxConnections = CdLookupProperties.getMaxConnection();// maxConnections;
         this.initialConnections = CdLookupProperties.getInitialConnection();
         this.waitIfBusy = CdLookupProperties.isWaitIfBusy();
         this.searchBase = CdLookupProperties.getDefaultSearchBase();
         //for local env testing
    //      this.maxConnections = 5;
    //      this.initialConnections = 1;
    //      this.waitIfBusy = true;
             * For keeping no of connections in the connection pool if
             * (initialConnections > maxConnections) { initialConnections =
             * maxConnections; }
         availableConnections = new Vector(maxConnections);
         busyConnections = new Vector(maxConnections);
         for (int i = 0; i < maxConnections; i++) {
             availableConnections.add(makeNewConnection());
             *  ConnectionPoolHolder provide Thread safe singleton
             *         instance of ConnectionPool class
        private static class ConnectionPoolHolder {
             * connection pool instance
         private static ConnectionPool connectionPool = null;
             * If no ConnectionPool object is present, it creates instance of
             * ConnectionPool class and initiates thread on that.
             * @return ConnectionPool Returns singleton object of ConnectionPool
             *         class.
             * @throws CDLookupException
         private static ConnectionPool getInstance() throws CDLookupException {
             if (connectionPool == null) {
              connectionPool = new ConnectionPool();
              new Thread(connectionPool).start();
              // Initiate house keeping thread.
              HouseKeeperThread.getInstance().start();
             return connectionPool;
             * Returns singleton object of ConnectionPool class.
             * @return ConnectionPool
             * @throws CDLookupException
        public static ConnectionPool getConnectionPool() throws CDLookupException {
         return ConnectionPoolHolder.getInstance();
             * getConnection retrieves connections to the corp directory. In case
             * there is no available connections in the pool then it'll try to
             * create one, if the max connection limit for the connection pool
             * reaches then this waits to retrieve one.
             * @return Context
             * @throws CDLookupException
        public synchronized Context getConnection() throws CDLookupException {
         String methodIdentifier = "getConnection";
         if (!availableConnections.isEmpty()) {
             int connectionSize = availableConnections.size() - 1;
             DirContext existingConnection = (DirContext) availableConnections
                  .get(connectionSize);
             availableConnections.remove(connectionSize);
                     * If connection on available list is closed (e.g., it timed
                     * out), then remove it from available list and repeat the
                     * process of obtaining a connection. Also wake up threads that
                     * were waiting for a connection because maxConnection limit was
                     * reached.
             if (existingConnection == null) {
              notifyAll(); // Freed up a spot for anybody waiting
              return (getConnection());
             } else {
              busyConnections.add(existingConnection);
              return (existingConnection);
         } else {
                     * Three possible cases: 1) You haven't reached maxConnections
                     * limit. So establish one in the background if there isn't
                     * already one pending, then wait for the next available
                     * connection (whether or not it was the newly established one).
                     * 2) You reached maxConnections limit and waitIfBusy flag is
                     * false. Throw SQLException in such a case. 3) You reached
                     * maxConnections limit and waitIfBusy flag is true. Then do the
                     * same thing as in second part of step 1: wait for next
                     * available connection.
             if ((totalConnections() < maxConnections) && !connectionPending) {
              makeBackgroundConnection();
             } else if (!waitIfBusy) {
              throw new CDLookupException("Connection limit reached", 0);
                     * Wait for either a new connection to be established (if you
                     * called makeBackgroundConnection) or for an existing
                     * connection to be freed up.
             try {
              wait();
             } catch (InterruptedException ie) {
              String errMsg = "Exception raised =" + ie.getStackTrace();
              log.error(errMsg);
              throw new CDLookupException(classIdentifier, methodIdentifier,
                   errMsg, ie);
             // connection freed up, so try again.
             return (getConnection());
             * You can't just make a new connection in the foreground when none are
             * available, since this can take several seconds with a slow network
             * connection. Instead, start a thread that establishes a new
             * connection, then wait. You get woken up either when the new
             * connection is established or if someone finishes with an existing
             * connection.
        private void makeBackgroundConnection() {
         connectionPending = true;
         try {
             Thread connectThread = new Thread(this);
             log.debug("background thread created");
             connectThread.start();
         } catch (OutOfMemoryError oome) {
             log.error("makeBackgroundConnection ="+ oome.getStackTrace());
             * Thread run method
        public void run() {
         String methodIdentifier = "run";
         try {
             Context connection = makeNewConnection();
             synchronized (this) {
              availableConnections.add(connection);
              connectionPending = false;
              notifyAll();
         } catch (Exception e) { // SQLException or OutOfMemory
             // Give up on new connection and wait for existing one
             // to free up.
             String errMsg = "Exception raised =" + e.getStackTrace();
             log.error(errMsg);   
             * This explicitly makes a new connection. Called in the foreground when
             * initializing the ConnectionPool, and called in the background when
             * running.
             * @return Context
             * @throws CDLookupException
        private Context makeNewConnection() throws CDLookupException {
         String methodIdentifier = "makeNewConnection";
         Context context = null;
         env = new Properties();
         log.debug("inside " + methodIdentifier);
         try {
             env.put(Context.INITIAL_CONTEXT_FACTORY,
                  getVendorContextFactoryClass());
             env.put(Context.PROVIDER_URL, getLdapServerUrl());
             env.put("com.sun.jndi.ldap.connect.pool", "true");
             context = new InitialDirContext(env);
         } catch (NamingException e) {
             String errMsg = "CDLdapBuilder connect() - failure while attempting to contact "
                  + ldapServerUrl + " Exception is " + e.toString();
             throw new CDLookupException(classIdentifier, methodIdentifier,
                  errMsg, e, LookupFailureReasons.serviceUnavailable);
         } catch (Exception e) {
             String errMsg = "CDLdapBuilder connect() - failure while attempting to contact "
                  + ldapServerUrl + " Exception is " + e.toString();
             throw new CDLookupException(classIdentifier, methodIdentifier,
                  errMsg, e, LookupFailureReasons.serviceUnavailable);
         log.info("new connection :" + (threadCount++) + " name =" + context);
         log.debug("exit " + methodIdentifier);
         return context;
             * releases connection to the free pool
             * @param context
        public synchronized void free(Context context) {
         busyConnections.remove(context);
         availableConnections.add(context);
         // Wake up threads that are waiting for a connection
         notifyAll();
             * @return int give total no of avail connections.
        public synchronized int totalConnections() {
         return (availableConnections.size() + busyConnections.size());
             * Close all the connections. Use with caution: be sure no connections
             * are in use before calling. Note that you are not <I>required</I> to
             * call this when done with a ConnectionPool, since connections are
             * guaranteed to be closed when garbage collected. But this method gives
             * more control regarding when the connections are closed.
        public synchronized void closeAllConnections() {
         closeConnections(availableConnections);
         availableConnections = new Vector();
         closeConnections(busyConnections);
         busyConnections = new Vector();
             * Close all connections existing.
             * @param connections
             *                void
        private void closeConnections(Vector connections) {
         String methodIdentifier = "closeConnections";
         try {
             for (int i = 0; i < connections.size(); i++) {
              Context context = (Context) connections.get(i);
              if (context != null) {
                  log.info(" connection name:" + context
                       + " removed. Threadcount =" + (threadCount++));
                  context.close();
                  context = null;
         } catch (NamingException e) {
             String errMsg = "CDLdapBuilder connect() - failure while attempting to contact "
                  + ldapServerUrl + " Exception is " + e.toString();
             log.error(errMsg);
        public synchronized String toString() {
         String info = "ConnectionPool(" + getLdapServerUrl() + ","
              + getVendorContextFactoryClass() + ")" + ", available="
              + availableConnections.size() + ", busy="
              + busyConnections.size() + ", max=" + maxConnections;
         return (info);
             * @return the defaultSearchBase
        public final String getDefaultSearchBase() {
         return defaultSearchBase;
             * @param defaultSearchBase
             *                the defaultSearchBase to set
        public final void setDefaultSearchBase(String defaultSearchBase) {
         this.defaultSearchBase = defaultSearchBase;
             * @return the ldapServerUrl
        public final String getLdapServerUrl() {
         return ldapServerUrl;
             * @param ldapServerUrl
             *                the ldapServerUrl to set
        public final void setLdapServerUrl(String ldapServerUrl) {
         this.ldapServerUrl = ldapServerUrl;
             * @return the vendorContextFactoryClass
        public final String getVendorContextFactoryClass() {
         return vendorContextFactoryClass;
             * @param vendorContextFactoryClass
             *                the vendorContextFactoryClass to set
        public final void setVendorContextFactoryClass(
             String vendorContextFactoryClass) {
         this.vendorContextFactoryClass = vendorContextFactoryClass;
         * @return the availableConnections
        public final Vector getAvailableConnections() {
            return availableConnections;
    }

    Hi,
    As the connection pool implmentation has the bug of not extending more than the min size, workaround I use is MIN_CONN=100 and MAX_CONN=101,and just waiting for the bug to get fixed. (using Netscape SDK for java4.0)

  • Connection pool not re-establishing connections, throwing exception instead

    Hello,
    I've just set up a connection pool on the sun java system application server 8 for a MySQL database using the official mysql-connector/j 5.0. Everything is working great, except when the connections timeout (or i kill them all manually from the database server) and then request a page that needs to use the DataSource object, the following exception is thrown:
    Exception thrown: com.mysql.jdbc.CommunicationsException -- Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.io.EOFException
    STACKTRACE:
    java.io.EOFException
         at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1913)
         at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2304)
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2803)
         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:3118)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:3047)
         at com.mysql.jdbc.Statement.executeQuery(Statement.java:1166)
         at com.mysql.jdbc.jdbc2.optional.StatementWrapper.executeQuery(StatementWrapper.java:705)
         at beans.MySessionBean.businessMethod(MySessionBean.java:73)
         at org.apache.jsp.index_jsp._jspService(index_jsp.java:70)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:336)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:251)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
         at sun.reflect.GeneratedMethodAccessor98.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
         at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:185)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:653)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:534)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doTask(ProcessorTask.java:403)
         at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:55)
    ** END NESTED EXCEPTION **
    Last packet sent to the server was 16 ms ago.What could be wrong?
    Thank you.

    The code is here:
        public String businessMethod() {
            //TODO implement businessMethod
            try
                InitialContext ic = new InitialContext();
                Object obj = ic.lookup("jdbc/MyDS");
                System.out.println("Object is: " + obj + " | Class is: " + obj.getClass().getName());
                DataSource ds = (DataSource)obj;
                Connection conn = ds.getConnection();
                Statement stmt = conn.createStatement();
                ResultSet rs = stmt.executeQuery("SELECT a,b FROM test");
                String ret = "";
                while(rs.next())
                    ret += rs.getString(1) + " - " + rs.getString(2) + "<br/>";
                conn.close();
                return ret;
            catch(Exception e)
                return "Exception thrown: " + e.getClass().getName() + " -- " + e.getMessage();
        }On the server, it is set up as XADataSource. I don't really have a big need for distributed transactions, but does it hurt badly to use it anyways? Could it be causing this problem?

  • Connection pool exausted

    Dear all,
    I am new to j2ee environment.
    RFC from PI Java stack to PI ABAP stack failing intermittently. Error message: Error while lookupProblem when calling an adapter by using communication channel CC_RFC_LookUp (Party: , Service: PPICLNT900, Object ID: 2e663396395c3213aaecd4e7746a8ddd) XI AF API call failed. Module exception: 'error while processing the request to rfc-client: com.sap.aii.af.rfc.afcommunication.RfcAFWException: error while processing message to remote system:com.sap.aii.af.rfc.core.client.RfcClientException: resource error: could not get a client from JCO.Pool: com.sap.mw.jco.JCO$Exception: (106) JCO_ERROR_RESOURCE: Connection pool RfcClient[CC_RFC_LookUp]2e663396395c3213aaecd4e7746a8ddd is exhausted. The current pool size limit (max connections) is 1 connections.'. Cause Exception: 'error while processing message to remote system:com.sap.aii.af.rfc.core.client.RfcClientException: resource error: could not get a client from JCO.Pool: com.sap.mw.jco.JCO$Exception: (106) JCO_ERROR_RESOURCE: Connection pool RfcClient[CC_RFC_LookUp]2e663396395c3213aaecd4e7746a8ddd is exhausted. The current pool size limit (max connections) is 1 connections.'
    When we go to http://hostname:50100/webdynpro/dispatcher/sap.com
    we can see RFC CC_RFC_LookUp and MAx connection parameter set to 1.
    Rest of RFCs are having maximum connections as 20.
    Please let us know what is the procedure to change MAX connection parameter for this
    particular RFC CC_RFC_LookUp and which parameter we need to change and where should we find
    this parameter?
    Regards,
    RR

    Thanks Manoj,
    I have gone through VA nodes ... could please mention which node i need to make this pareameter changes.
    Please note : currently all other JCO pool RFCs are set to Max connections 20 .
    But this particular RFC CC_RFC_LookUp under JCO pool tab shows
    max connections set to only 1.
    Please let me know where in VA i will find this parameter?

  • Connection pool size limit error

    Hi all,
    I am trying to execute a BAPI function from MII, execution fails with the following message;
    [ERROR] Unable to make RFC call Exception: [Problem retrieving JCO.Function object: Connection pool <ECC_Server>:800:02:EN:ECCUser is exhausted. The current pool size limit (max connections) is 1 connections.]
    [WARN] [SAP_JCo_Function_0] Skipping execution of output links due to action failure.
    [ERROR] Uncaught exception from SAP_JCo_Function_0, Problem retrieving JCO.Function object: Connection pool <ECC_Server>:800:02:EN:ECCUser is exhausted. The current pool size limit (max connections) is 1 connections.
    Config:
    1. In 'SAP MII: Connections' of type JCO and have given pool size to 100.
    2. In 'SAP MII: Credential Stores' store is created and same is being used in Start Session.
    3. In  JCO_Function block, we can search for the Function Module and set it.
    MII Version:
    14.0.2 Build(82)
    Am I missing something?
    Has any one seen this? please advise.
    Thanks,
    Message was edited by: Shridhar N

    Check if there is another JCo connection configured with the same IP and User. I have found in the past that even though there are two connections configured because they have the same ip and user they are put into one pool with the lowest max pool of the two connections.

  • Cursor bound to out parameter with Connection Pool

    Is it possible to retrieve a cursor bound to an out parameter when using the thin
    driver to establish the connection pool to the database? I am currently using
    the JDriver to connect create the pool and the pool driver to connect from the
    app to the connection pool. We'd like to avoid using the Oracle client if possible.
    Currently I register the out parameter as java.sql.Types.OTHER, then call getResultSet(1)
    on the weblogic.jdbc.pool.CallableStatement object. But it breaks when I change
    the connection pool to use the thin driver. The error is at the bottom of this
    post.
    I think I could possibly get the current pool driver to work if can find some
    documentation on these two methods:
    void registerOutParameter(int i, int j, int k, int l)
    void registerOutParameter(int i, int sqlType, java.lang.String typeName)
    I have no idea what to put in for the ints in the first method or for sqlType
    or typeName. Can anyone point me to where I can find this documentation?
    E-docs mentions this class: weblogic.jdbc.vendor.oracle.OracleCallableStatement.
    (http://edocs.bea.com/wls/docs61/jdbc/thirdparty.html#1023867). Should I consider
    this? If so where is it?
    Thanks a lot,
    Matt Savino
    <<< error when using thin driver >>>
    preparing callable stmt
    callable stmt prepared, java.sql.Types.OTHER = 1111
    java.sql.SQLException: Invalid column type
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:273)
    at oracle.jdbc.driver.OracleStatement.get_internal_type(OracleStatement.java:4560)
    at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:225)
    at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:350)
    at weblogic.jdbc.pool.Statement.registerOutParameter(Statement.java:617)
    at jsp_servlet._reportmanager.__thin_outputresultset._jspService(__thin_outputresultset.java:145)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:263)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2390)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1959)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

    Thanks Joe, your answer pointed me in the right direction. Just in case anyone
    wants to know, the solution took two changes:
    CHANGE
    cStat.registerOutParameter(1, java.sql.Types.OTHER);
    TO
    cStat.registerOutParameter(1, oracle.jdbc.driver.OracleTypes.CURSOR);
    (cStat is an instance of weblogic.jdbc.pool.CallableStatement)
    AND
    rs = cStat.getResultSet(1);
    TO
    rs = cStat.getCursor(1);
    Thanks again,
    Matt
    Joseph Weinstein <[email protected]> wrote:
    Hi Matt.
    Look at the Oracle thin driver documentation to determine what type you
    should define in the registerOutParameter call. We use 'OTHER', but
    their driver may use something else for CURSOR output parameters.
    joe
    Matt Savino wrote:
    Is it possible to retrieve a cursor bound to an out parameter whenusing the thin
    driver to establish the connection pool to the database? I am currentlyusing
    the JDriver to connect create the pool and the pool driver to connectfrom the
    app to the connection pool. We'd like to avoid using the Oracle clientif possible.
    Currently I register the out parameter as java.sql.Types.OTHER, thencall getResultSet(1)
    on the weblogic.jdbc.pool.CallableStatement object. But it breaks whenI change
    the connection pool to use the thin driver. The error is at the bottomof this
    post.
    I think I could possibly get the current pool driver to work if canfind some
    documentation on these two methods:
    void registerOutParameter(int i, int j, int k, int l)
    void registerOutParameter(int i, int sqlType, java.lang.String typeName)
    I have no idea what to put in for the ints in the first method or forsqlType
    or typeName. Can anyone point me to where I can find this documentation?
    E-docs mentions this class: weblogic.jdbc.vendor.oracle.OracleCallableStatement.
    (http://edocs.bea.com/wls/docs61/jdbc/thirdparty.html#1023867). Should
    I consider
    this? If so where is it?
    Thanks a lot,
    Matt Savino
    <<< error when using thin driver >>>
    preparing callable stmt
    callable stmt prepared, java.sql.Types.OTHER = 1111
    java.sql.SQLException: Invalid column type
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:273)
    at oracle.jdbc.driver.OracleStatement.get_internal_type(OracleStatement.java:4560)
    at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:225)
    at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:350)
    at weblogic.jdbc.pool.Statement.registerOutParameter(Statement.java:617)
    at jsp_servlet._reportmanager.__thin_outputresultset._jspService(__thin_outputresultset.java:145)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:263)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2390)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1959)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    PS: Folks: BEA WebLogic is expanding rapidly, with both entry and advanced
    positions
    for people who want to work with Java, XML, SOAP and E-Commerce infrastructure
    products.
    We have jobs at Nashua NH, Liberty Corner NJ, San Francisco and San Jose
    CA.
    Send resumes to [email protected]

  • Connection pool and Connection factory difference?

    Hi,
    Can someone clarify the difference between connection pool and connection factory.
    I know connection pool is some thing like a pool of database connection manitained at one place so that an application or client can use it when it requires.
    Then wat exactly is connection factory..say in 10g we always put a connection factory name in all adapters and acces the data sources like DB ,FTP,AQ ..etc
    can someone clarify??
    regards,

    To conserve system resources and to improve the performance of transactional applications, WebLogic allows you to define a pool of client connections (generally database but may be a FTP,FILE etc. as well)
    A Connection Factory object encapsulates a set of connection configuration parameters that has been defined by an administrator. A client uses it to create a connection with a service provider (generally JMS).
    Regards,
    Anuj

Maybe you are looking for

  • How do I print a photo from my computer to a CD disc? I have a PIXMA MG6320

    I can't seem to get a photo that is in "My Pictures" to print on a CD disc.  Anyone know what I am doing wrong? Thanks for any help Solved! Go to Solution.

  • Need Inputs on transferring data thru Webservice

    Hi All, Can we use webservice to transfer huge amount of data (i.e. An XML which has 20,000 rows from a table of 15 columns) from the webserver to the client. Currently am passing this as a String. Is it okay to pass it in this way? or is there any o

  • Lost gift card money

    Orinal account would not let me utilize gift card money. Home page showed money available but password would not work. Tried redoing the ID and password...money did not transfer. Talked with Apple person for 21/2 hours relaying info back and forth to

  • My ipod has the sad face

    well my ipod got int the washing machine and anyway it was all messed up the screen was all foggy and wet, but now the screen looks normal and all and now the sad face won't go away. And i've tried putting it into disk mode like they say to but it wo

  • NEF files not readable in Lightroom

    I have just bought a D7000 and a first time user of Lightroom 3. Updated saftware to 3.5 but program will not show NEF files. Installed Nikon NX program and it will display all the NEF files I shot. I spent several hours trying to find a solution on