This content has been marked as final. Show 2 replies
909348 wrote:Hi Ivan,
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?
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?
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:
Only if these can't meet your requirements would I start to look at changing code.