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: Richard W. Zurbuchen <richard.zurbuchen_at_tangensys.com>
Date: Mon, 15 Apr 2002 08:05:50 +0200
Message-ID: <35uu8.26213$d45.3878192@monolith.news.easynet.net>


thanks for your reply, sanjay,
i know, that we should make a DISCONNECT from oracle, but how? i could not find any command close to DISCONNECT in the 8.1.6 documentation. what do you mean with 'notify the main program'? my main program? if so, that program should not stop running, because we have more than one user working with that program...

"Sanjay Dharmadhikari" <kunalsanjay_at_hotmail.com> schrieb im Newsbeitrag news:43a8d8c8.0204121053.67347307_at_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
>
> - Sanjay Dharmadhikari
>
> "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 Mon Apr 15 2002 - 01:05:50 CDT

Original text of this message

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