Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> disconnect problem with embedded sql

disconnect problem with embedded sql

From: Richard W. Zurbuchen <richard.zurbuchen_at_tangensys.com>
Date: Fri, 12 Apr 2002 16:10:21 +0200
Message-ID: <E2Ct8.19444$d45.3037077@monolith.news.easynet.net>


hi there,
we have oracle 8.1.6 running on sun solaris server, and we make db accesses with embedded sql (c++) from another server. everything is running quite well, but there is a problem with destroying the sessions on the oracle: whenever a user logs into our application, the c++ part does the following:

    struct sqlca& sqlca = m_sqlca;

    EXEC SQL ENABLE THREADS;     EXEC SQL BEGIN DECLARE SECTION;

       const char *h_database = databaseP;
       const char *h_dbname   = m_dbname;
       const char *h_username = usernameP;
       const char *h_password = passwordP;
       sql_context h_ctx      = m_contextP;
    EXEC SQL END DECLARE SECTION;     EXEC SQL CONTEXT ALLOCATE :h_ctx;
    m_contextP = h_ctx;
    EXEC SQL CONTEXT USE :h_ctx;

    EXEC SQL CONNECT :h_username IDENTIFIED BY :h_password AT :h_dbname USING :h_database;

whenever this session has not been used for more than two hours, we try to destroy it like that:

    struct sqlca& sqlca = m_sqlca;
    EXEC SQL BEGIN DECLARE SECTION;

       const char *h_dbname   = m_dbname;
       sql_context h_ctx      = m_contextP;
    EXEC SQL END DECLARE SECTION;     try
    {
        EXEC SQL CONTEXT FREE :h_ctx;
        EXEC SQL AT :h_dbname ROLLBACK WORK RELEASE;
    }
    catch( ... ) {}

fact is that the session is never destroyed on oracle. to solve that problem, we have a job running on oracle to doing "alter system kill session 'x,y'".

has anybody an idea, how we can get rid of those sessions from c++?

thanks Received on Fri Apr 12 2002 - 09:10:21 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US