How to handle connection pooling in Oracle - oracle

We have lots of micro services which need connection to DB. Oracle and PostgreSQL can handle just limited amount of connections. PostgreSQL solve this situation with PgBouncer so application connect to this URL which handle connection pooling. Is there something similar in Oracle ? What I found is oracle UCP but I think this is still pooling in application not in DB.

If your clients drivers are not too old (pre oracle-12) you can use Oracles Database Resident Connection Pooling.
See https://docs.oracle.com/en/database/oracle/oracle-database/19/jjdbc/database-resident-connection-pooling.html#GUID-D4F9DBD7-7DC6-4233-B831-933809173E39
Database Resident Connection Pooling
Database Resident Connection Pool (DRCP) is a connection pool in the server that is shared across many clients. You should use DRCP in connection pools where the number of active connections is fairly less than the number of open connections.
Especially database administrators will love this because they can have a good control on the hits on the database.

Related

ADO connection with C++

I am working with ADO connection with C++ where I connect to DataBase fetch records and close connection. ,
My porblem is we have to connect, fetch records and close connection every time for single user and we have more than one million users.
Is there any way that we can keep connection alive or have some pooling mechanism running background so we done have to connect always ?
I searched for connection pooling with C++ , but could not find anything
Thanks in advance
Connections are pooled by default with ADO classic (which uses OLEDB services for connection pooling). The cost of the physical network connection is incurred only during the initial open. As long as you properly close/dispose connections, the subsequent overhead is minimal without coding to handle persistent connections.

Can the Oracle DRCP connection pool and a middle tier connection pool run simultaneously?

We have several web applications using my-batis as a connection pool on the web server. We are using the Oracle 12c database. Now we are adding a new application X which uses individual connections for every request and is very inefficient. We would like to enable the Oracle DRCP connection pool and have application X use it without affecting the previously existing apps that have a connection pool. Our DBA informed me that it looks like all the applications will have to use the Oracle DRCP connection pool if it is enabled, meaning we will have to reconfigure the connection method in all of our applications for this application X.
Does anyone know if this is the case, or can you have the Oracle DRCP connection pool running without affecting our middle tier connection pools?
Oracle DRCP does not interfere with any other connections methods you are currently using, it only adds another option to connect to the DRCP connection pool.
This was verified when the DBA decided to give it a try and turn on the DRCP connection pool in our Oracle database. We were able to connect to the new DRCP connection pool with our new application X and our other applications continued to work without any modification necessary.

What is the maximum number of connections?

Since the native RethinkDB drivers do not support connection pooling yet, I was wondering, what is the maximum number of connections to the RethinkDB server?
There are a couple answers to this question:
Connection Pooling
There are some third-party drivers that do have connection pooling. rethinkdbdash, for example, is a great Node.js driver that has connection pooling.
Maximum Number Of Connections
I'm not sure there's a hard limit on number of connections on the RethinkDB side, but users usually run into the connection limits of the OS before really running into the maximum number of connections on the RethinkDB side (I don't think there is one). Basically, RethinkDB can easily handle thousands of connections without a problem.

How to clear the ODP.NET connection pool on connection errors?

I'm using NHibernate and ODP.NET to connect to a Oracle 11g database. Of course there can be connection errors (network failure, DB down, ...). I'm handling all these exceptions in my code, so no problem there. But of course the user can retry his actions (maybe it was just a short network failure), and there comes my problem:
ODP.NET is using connection pooling by default. No problem with that usually, but when the user retries an action after a connection error, NHibernate gets an invalid (pooled) connection from ODP.NET. The user has to retry it multiple times (until the pool is empty) to get it working again.
Of course I can disable connection pooling in ODP.NET, but I'd like to avoid that. I've also read about a setting that checks the connection to the DB for each returned connection from the pool, but this adds an additional round trip to each connection which I'd like to avoid too.
Is there any way to configure ODP.NET to automatically clear the connection pool when any connection throws an connection exception?
If you can use odac (odp) 11g, you have setting Validate Connection for your pool. It can validate the connection before you use it.
The Validate Connection attribute validates connections coming out of the pool. This attribute should be used only when absolutely necessary, because it causes a round-trip to the database to validate each connection immediately before it is provided to the application. If invalid connections are uncommon, developers can create their own event handler to retrieve and validate a new connection, rather than using the Validate Connection attribute. This generally provides better performance.
If it will not be good enough - you can try this document from oracle.
Connection Pool Management
ODP.NET connection pool management provides explicit connection pool
control to ODP.NET applications. Applications can explicitly clear
connections in a connection pool.
Using connection pool management, applications can do the following:
Note: These APIs are not supported in a .NET stored procedure. Clear
connections from connection pools using the ClearPool method.
Clear connections in all the connection pools in an application
domain, using the ClearAllPools method.
When connections are cleared from a pool, ODP.NET repopulates the pool
with new connections that have at least the number of connections set
by Min Pool Size in the connection string. New connections do not
necessarily mean the pool will have valid connections. For example, if
the database server is down when ClearPool or ClearAllPools is called,
ODP.NET creates new connections, but these connections are still
invalid because they cannot connect to the database, even if the
database comes up a later time.
It is recommended that ClearPool and ClearAllPools not be called until
the application can create valid connections back to the database.
.NET developers can develop code that continuously checks whether or
not a valid database connection can be created and calls ClearPool or
ClearAllPools once this is true.
Also, may be this post will help you.
Update:
As pointed by #MPelletier, for oracle 12 the link is different.
Generally speaking, you should avoid trying to manipulate the connection pool for any ADO.NET provider (and also WCF channels - an aside). If you application needs to be resilient in the face of underlying data errors (e.g. timeouts, broken connections in pool, etc.) then you should implement the appropriate level of transaction to ensure data integrity and retry logic to re-execute the failed operation.

ADO.NET (ODP.NET) and same Connection pool for different clients connection

We have to implement a two tier architecture to distribute a cache from a central Oracle DB to a lot of clients (circa 200) into an Intranet. After some experimentations we have opted to use a direct connection from the client to the DB server. This decision has been taken to simplify the architecture and to reduce the overheads.
Client application are made in C# and the natural choice should be to adopt ODP.NET (ADO).
But now we are trying to understand if it is possible to have and to use the same connection pool for all the clients connection. The clients will connect with the same functional username and password.
Could anyone help me in clarifying this key point?
Have you considered looking at Oracle 11g Database Resident Connection Pooling? This may resolve your issue.

Resources