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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Using Pro*C in a Windows DLL

Re: Using Pro*C in a Windows DLL

From: Dave <recneps.w.divad_at_elcaro.moc>
Date: Mon, 28 Feb 2005 12:27:42 +0000
Message-ID: <QmEUd.33$W%4.51@news.oracle.com>

Keith Bloom wrote:

>>>I've been able to get the library to compile with minor changes as a
>>>Windows DLL, and when the client program calls the connect function

>
> the
>
>>>DLL makes the connection.  However, any function called after that
>>>returns an ORA-01012 "not connected" error.  Auditing sessions in the
>>>database shows that the connection persists while the program
>>>continues to run.  So the connection is there, but the DLL is unable
>>>to find it again.

>
>
>>>Is there some way to get this to work on Windows?

>
>
>>Include a connect statement in your Pro*C code and reconsider what you
>>are doing. Sessions aren't shared between Winblows threads

>
>
> I don't quite understand. The connection function looks like this
> (eliminating irrelevancies):
>
> if (strlen(dbname) == 0) {
> EXEC SQL WHENEVER SQLERROR DO sql_error("login");
> EXEC SQL CONNECT :username IDENTIFIED BY :password;
> } else {
> EXEC SQL WHENEVER SQLERROR DO sql_error("login");
> EXEC SQL DECLARE POLREPO DATABASE;
> EXEC SQL CONNECT :username IDENTIFIED BY :password AT POLREPO
> USING :dbname;
> }
> if (strcmp(SQLSTATE, SQL_SUCCESS) != 0) {
> strcpy (*p_errcode, SQLSTATE);
> return -1;
> }
> return 0;

Interesting, with those connect statements you would need to test dbname for every SQL you performed to know whether or not to use AT POLREPO. If you connect AT POLREPO and then EXEC SQL AT somewhere_else (no AT statement implies a default), which isn't connected, then you would get ORA-1012 errors.

Dave. Received on Mon Feb 28 2005 - 06:27:42 CST

Original text of this message

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