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 -> Re: disconnect problem with embedded sql

Re: disconnect problem with embedded sql

From: Sanjay Dharmadhikari <kunalsanjay_at_hotmail.com>
Date: 12 Apr 2002 11:53:08 -0700
Message-ID: <43a8d8c8.0204121053.67347307@posting.google.com>


I am not sure if you've written another routine to disconnect the session. If so, please review the following:

I think to end a session you need to DISCONNECT from the program that you used to CONNECT to the oracle database.

You can write another routine to notify the main program to stop running. Depending on the platform you can use mail boxes, message queues or event flags to handle communication between 2 programs.

HTH

"Richard W. Zurbuchen" <richard.zurbuchen_at_tangensys.com> wrote in message news:<W2Ct8.19445$d45.3037174_at_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 - 13:53:08 CDT

Original text of this message

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