2 Replies Latest reply: Feb 1, 2013 11:06 AM by Jon Stone RSS

    OCI Session pooling and OCIPing

    912351
      Hello!

      I created an OCI application that uses session pooling (session pool created with OCISessionPoolCreate). I also need to use OCIPing for this pool since we're behind a firewall to keep connection alive.

      My question is -> how number of sessions in a pool reflects to number of TCP connections established between client and server? How can I make sure that I do OCIPing on all established TCP connections so none of them would be destroyed by firewall?

      BR,
      ivan
        • 1. Re: OCI Session pooling and OCIPing
          jchristian
          909348 wrote:
          Hello!

          I created an OCI application that uses session pooling (session pool created with OCISessionPoolCreate). I also need to use OCIPing for this pool since we're behind a firewall to keep connection alive.

          My question is -> how number of sessions in a pool reflects to number of TCP connections established between client and server? How can I make sure that I do OCIPing on all established TCP connections so none of them would be destroyed by firewall?

          BR,
          ivan
          Hi Ivan,

          If nobody can provide a better answer, perhaps the suggestion below may be helpful:

          Oracle's provided access to the connection pool's attributes such as number of open sessions via the OCIAttrGet. You can see all of the attributes in the oci.h header file. You can get the number of items which are open and/or busy via attributes: OCI_ATTR_SPOOL_OPEN_COUNT and OCI_ATTR_SPOOL_BUSY_COUNT

          On windows or Unix, you can use the netstat command to view the network connections. You'll need the port number for the connections.

          At least, you can experimentally answer your first question.

          **I am confused by the second question. OCIPing doesn’t appear to allow you to do a ping on a particular connection. It appears to take the service context as a parameter. In case, doesn't it ping on all the open connections?

          Cheers,

          JC
          • 2. Re: OCI Session pooling and OCIPing
            Jon Stone
            My first suggestion would be to look at the OS's TCP keepalive settings. These can be set to send a keepalive packet on idle TCP connections, which is often enough to keep the connection alive in the firewall's state table.

            If that doesn't work, I'd then consider setting SQLNET.EXPIRE_TIME, which does a similar thing at the SQL*Net level:
            http://docs.oracle.com/cd/E11882_01/network.112/e10835/sqlnet.htm#BIIEEGJH

            Only if these can't meet your requirements would I start to look at changing code.