Perform tnsping with java

107 views Asked by At

I am trying to perform tnsping to a server with java. I am trying to retrieve the port number and hostname of a database.

Locally I have installed the oracle universal installer. I will do a tnsping with a name I get something like this: `C:\oracle_db_home\network\admin\sqlnet.ora

Used LDAP adapter to resolve the alias Attempting to contact (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=amrpop000008656.test.com)(PORT=63000)))(CONNECT_DATA=(SERVICE_NAME=ia055653.test.com)))`

note: I don't have the tnsname.ora file in the server when I am executing this. sqlnet.ora and ldap.ora are configured to get it from another server.

I am trying to create an api that when you will give it the name of the database(as it is in the tnsname.ora) it will return the hostname and the port. The tricky part is that this API will run on AWS lamda so there is no tnsping functionality where the API is running.

I am using spring framework, so how do I utilize the sqlnet.ora and ldap.ora files that I have so I can get the response (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=amrvop000008656.test.com)(PORT=63000)))(CONNECT_DATA=(SERVICE_NAME=ia055653.test.com))) with java?

Executing an SSH command to perform tnsping is not doable in serverless where you can't install oracle.

0

There are 0 answers