cancel
Showing results for 
Search instead for 
Did you mean: 

Oracle listener still there? Details of listener protocol needed...

ronny_haak
Employee
Employee
0 Kudos

Hi guys,

currently I am working on a small Java application monitoring several oracle databases and different hosts.

Before attempting to connect to a db I'd like to make that

1. the host is reachable and

2. the oracle listener is running.

Therefore I open a socket connection to port 1527. If I get an UnknownHostException the host is not reachable and if I get an IOException the listener is not running.

Unfortunately there's no way to realise that the socket connection was closed by the listener. well, it works if you stop the listener with "lsnrctl stop" but it doesn't if sou simply shutdown the host.

Therefore I'd like to implement some kind of AYT-command in my application. The application should send something to the listener which in return prompts the server to send a reply. If the application won't receive a reply in time the connection is broken.

So, which command (data) can be send to the listener in order to get an instant reply?

Thanks in advance,

ron

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Ronny,

After opening the connection normally I would try to register a connection/exception listener with the connection.

This should notify the listener implementation you have to write about any problems with the connection.

Enjoy

Former Member
0 Kudos

For Oracle, I always use this:

select sysdate from dual

That will return the system date from the Oracle server. This does require that you login to the server with username/password. I'm not aware of any way to only talk to the listener.

Ray

P.S. If helpful, please award points.