Highlighted
Frequent Contributor.
Frequent Contributor.
482 views

Oracle nca_connect_server to one of two IP addresses

Jump to solution

Hi all,

I have an Oracle NCA / Web (HTTP/HTML multi-protocol script. It contains an nca_connect_server function to connect to an Oracle database. However, we have two servers (so two I.P. addresses) sat behind a load balancer. Only one of these is available at any given time. In the event of problems or maintenance it will fail over to the other server and only that second server is now available. So we can only connect to one of these two IP addresses at any time.

The nca_connect_server function doesn't work with the load balancer's IP address so we have to supply one of the two servers. But our script doesn't know which server is available when it runs. If we try the wrong one, the function generates an error and the script fails.

I've added some code so that if the first connection attempt is to the unavailable server, the script will try connecting to the second server instead. It essentially looks like this:

int ncaCon;
lr_continue_on_error(1);
ncaCon = nca_connect_server(...try host 1...
if (ncaCon != 0) {
    ncaCon = nca_connect_server(...try host 2...
}
lr_continue_on_error(0);

 

The script now tries connecting to one of the servers, and if it that one is unavailable then it connects to the alternate server and continues to run. However, even if it then gets to the end of the script successfully the error generated by the first nca_connect_server attempt will cause the replay to fail (even with the lr_continue_on_error functions around this code).

What I'm looking for is either a way to suppress the error generated by the first nca_connect_server attempt so that this error message doesn't cause the script to fail, a way to indicate that this specific error is acceptable so that the script still passes, or a function that will be able to tell me in advance which one of the two hosts is available without generating an error. Hopefully I'm just missing something obvious! Anyone got any suggestions please?

0 Likes
1 Solution

Accepted Solutions
Highlighted
Honored Contributor.
Honored Contributor.

Re: Oracle nca_connect_server to one of two IP addresses

Jump to solution

Hi

As far as I recall this is the behavior added back when the nca was socket and never modified to prevent breaking competability for existing scripts.

I suggest you submit an enhancement request to add a configuration option in the NCA Runtime setting to support this issue.

In the mean time I can suggest the following:

1. if the load balancer returns the ip/name of the available nca server, you can correlate in the web level into parameter and replace the value in the nca_connect_server and then there is no need for the if/else condition

2. add web_url/web_custom request before the step to check the availability of the IP and wrap this request with the if/else condition

View solution in original post

2 Replies
Highlighted
Honored Contributor.
Honored Contributor.

Re: Oracle nca_connect_server to one of two IP addresses

Jump to solution

Hi

As far as I recall this is the behavior added back when the nca was socket and never modified to prevent breaking competability for existing scripts.

I suggest you submit an enhancement request to add a configuration option in the NCA Runtime setting to support this issue.

In the mean time I can suggest the following:

1. if the load balancer returns the ip/name of the available nca server, you can correlate in the web level into parameter and replace the value in the nca_connect_server and then there is no need for the if/else condition

2. add web_url/web_custom request before the step to check the availability of the IP and wrap this request with the if/else condition

View solution in original post

Highlighted
Frequent Contributor.
Frequent Contributor.

Re: Oracle nca_connect_server to one of two IP addresses

Jump to solution

Thanks for that. We're not getting the IP or host name from the load balancer so we're going with option 2 and a web_custom_request. Appreciate the reply!

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.