Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2004
    Location
    France
    Posts
    754

    Question Unanswered: How To Detect A Disconnection In Occi ?

    Hi,

    I'm wondering how to detect a disconnection in OCCI (Oracle C++ Call Interface). There is a method in JDBC to know if the connection to Oracle is still active, but no such method is spoken of in the Oracle OCCI documentation. Does one exist ? Is there another way to do that ? (I've thought of catching an SQLException, checking its error code, and decide whether or not I'll have to try to reconnect, but I'd sincerely like an easier way. Timeouts wouldn't be a solution).

    Any idea will be welcome !

    Oracle Version : 9.2.0.1.0
    OS : Sun Solaris 9

  2. #2
    Join Date
    Aug 2004
    Location
    France
    Posts
    754
    Google does not help at all on that matter : a search on "detect OCCI disconnection" only gives 5 useless results, while one on "OCCI disconnection" barely gives more than 10 results, only the first being useful, giving access to an Oracle Documentation on OCCI, but even this one does not help. I had already read the sections of "Oracle C++ Call Interface Programmer’s Guide" that could be useful to me on that matter, but found nothing. The problem is that I want my program to run continuously, possibly without any stop, and I would want it to detect when there is a problem with the connection to the Oracle Server, wait until the problem is solved, and reconnect, without having to stop and start my program again. As I've already said, I've thought about catching the exception, check if this may be an exception caused by a disconnection, and in that case try to reconnect (by looping on "connect try / sleep"). Has anyone a simpler and/or more elegant idea ?
    Last edited by RBARAER; 08-10-04 at 14:50.

  3. #3
    Join Date
    Aug 2004
    Location
    Iceland
    Posts
    37
    Have you tried using this one:

    getOpenConnections()
    This method returns the number of open connections in the connection pool.

    Syntax
    unsigned int getOpenConnections() const;

  4. #4
    Join Date
    Aug 2004
    Location
    France
    Posts
    754
    Right, I did not notice this one, because I don't use a Shared Pool. However, this method only gives the number of opened connections in the shared pool : I would not be able to know which connection is down. Thanks anyway. If you go on developing in OCCI and find out an easy way to detect a disconnection, please let me know !

  5. #5
    Join Date
    Aug 2004
    Location
    Iceland
    Posts
    37
    Right now I am depending on you my firend so that I can move on to develop in it....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •