Pro*c runtime error(SQL-02134: Invalid runtime context)

From: Jaguk Ku <twzone_at_kornet.net>
Date: Sat, 16 Feb 2002 00:18:01 +0900
Message-ID: <a4j83o$rsc$1_at_news1.kornet.net>



I have a simple pro*c example which allocate context and use it. it works under redhat 6.1 with oracle 8.1.6, but it doesn't work under solaris 7.0 with oracle 8.1.6

the sample source is below

/********************** test.pc *******************/

#include <stdio.h>
#include <sqlca.h>

#define UID "scott/tiger"

sql_context ctx;

void sql_error()
{

    printf("ERROR => %.*s\n", sqlca.sqlerrm.sqlerrml, sqlca.sqlerrm.sqlerrmc);
}

int main()
{

    printf("thread db test...\n");

    EXEC SQL ENABLE THREADS;
    EXEC SQL WHENEVER SQLERROR DO sql_error();

    printf("allocate context\n");
    EXEC SQL CONTEXT ALLOCATE :ctx;

    EXEC SQL CONTEXT USE :ctx;

    printf("connect to %s\n", UID);
    EXEC SQL CONNECT :UID;     printf("disconnect\n");
    EXEC SQL COMMIT WORK RELEASE;     printf("free context\n");
    EXEC SQL CONTEXT FREE :ctx;

    exit(0);
}

/********************** test.pc *******************/

it compiled successfully under solaris. when i run it. the output is like below

####################################

thread db test...
allocate context
connect to scott/tiger
ERROR => SQL-02134: Invalid runtime context disconnect
ERROR => SQL-02134: Invalid runtime context free context
####################################

i look up the internet about the multithreaded programming with pro*c even the sample source code in otn.oracle.com doesn't work in my solaris system

my system is
Sun Enterprise 450
Solaris 7.0
Oracle 8.1.6
Compiler : gcc 2.8.1
Oracle library : -lclntsh

i spent two days with this problem, please help me.

Thanks in advance

Jaguk Ku Received on Fri Feb 15 2002 - 16:18:01 CET

Original text of this message