Home » Developer & Programmer » Precompilers, OCI & OCCI » Getting TNS Error while re-creating Connections using OCCI
Getting TNS Error while re-creating Connections using OCCI [message #94070] Tue, 23 December 2003 08:07
Arvind
Messages: 23
Registered: December 2001
Junior Member
Hi,
I'm facing one peculiar problem. In order to make a highly available application, we have made our own Connection Pool Manager wherein we manage all the connections created using createConnection() of the OCCI Library. We internally allocate and deallocate those connections whenever the user of the application requests some query to be fired.

Now the problem we are facing is during the fail-over scenarios. Let's state my objective in the following line items:
1. Whenever oracle shuts down, firing an query using executeUpdate() shall throw a SQLException() with error code stating that oracle is not available.
2. When i get an SQLException which states that the oracle is not available, i close all the connections and empty all the temporary buffers.
3. Now i wait for sometime before trying to create a connection pool once again using createConnection() methods. The process continues after some fixed interval till i am able to create connections.

This way as soon as the oracle server comes up, i am able to recreate the Connection Pool with valid connections.

This process is working fine for first three or four times i.e., when oracle is shutdown for first three / four times and brought up, i am able to recreate the connection pool properly. The problem occurs after that.

On fifth or sixth time, when after shutting down the oracle server, i am bringing up the server while my client is waiting for oracle to come up so that it can re-create the connection pool, the oracle throws TNS error :
ORA-12154 : TNS Could not resolve service name.

I have cross-checked it that the file tns.ora is perfectly fine. Also, from the same client i am able to open another sql session from different process. I have also seen that TNSPing is returning true.

After receiving this Error, if i try to re-create a connection pool, i get this same error and hence my program hangs forever waiting for TNS name to resolve.

I'll highly appreciate if anybody could provide me a clue as to how to tackle this problem!!

best regards,
arvind
Previous Topic: Inserting XMLType through OCI
Next Topic: Need a s(a)imple program in Pro*C
Goto Forum:
  


Current Time: Sun Nov 24 11:58:19 CST 2024