Forum Stats

  • 3,734,733 Users
  • 2,247,033 Discussions
  • 7,857,474 Comments

Discussions

Failure to connect a 19c database with an old style OCI C program (Centos 7.6 x86_64)

User_F4UK4
User_F4UK4 Member Posts: 2 Green Ribbon
edited Sep 4, 2019 4:50AM in Oracle Call Interface (OCI)

I created a user "CAO/safirs" in 19c database.

I can access to this user with Sqlplus but not with a very simple old style C Ici program.

This same program can access to 12c database.

ret=orlon(&lda, &hda,"CAO",3,"safirs",6,flag);

It returns 0 (OK) when accessing to 11g, 12c Database, but 1017 when accessing 19c Database.

Thank you

Answers

  • Gaz in Oz
    Gaz in Oz Member Posts: 3,776 Bronze Crown
    edited Sep 4, 2019 12:00AM

    What Oracle versions are you using (to 4 significant digits)?

    Are you connecting on the database server or from a client machine?

    Are you trying to connect to the right instance, the one  where you actually created the user in 19.x.x.x?

    Are you connecting to the correct PDB in the 19.x.x.x database or are you trying to connect to the CDB?

    Are you using the correct service_name?

    There are many possible reasons your code is failing. It is very difficult to help diagnose when the code is non-visible and the configuration of db's is unknown etc.

  • User_F4UK4
    User_F4UK4 Member Posts: 2 Green Ribbon
    edited Sep 4, 2019 4:50AM

    Oracle Client (Centos 64-bit 7.6 IP= 10.21.3.41) release 19.0.0.0

    tnsnames.ora

    orasid=

      (DESCRIPTION =

        (ADDRESS = (PROTOCOL = TCP)(HOST = 10.21.3.70)(PORT = 1521))

        (CONNECT_DATA =

          (SERVER = DEDICATED)

          (SERVICE_NAME = orasid)

        )

      )

    Oracle Server (Centos 64-bit 7.6 IP= 10.21.3.70) release 19.3.0.0.0

    I'm connecting from the client 10.21.3.41

    I'm connecting to the right Database 19.3.0.0.0 on host 10.21.3.70

    In the client 10.21.3.41, I have :
    export ORACLE_SID=orasid

    export TWO_TASK=orasid

    My simple program is :

    #include <stdio.h>

    #include "oratypes.h"

    #if defined(SS_64BIT_SERVER) || defined(__64BIT__)

    #define CDA_SIZE 88

    #else

    # define CDA_SIZE 64

    #endif

    struct cda_head {

        sb2          v2_rc;

        ub2          ft;

        ub4          rpc;

        ub2          peo;

        ub1          fc;

        ub1          rcs1;

        ub2          rc;

        ub1          wrn;

        ub1          rcs2;

        sword        rcs3;

        struct {

            struct {

               ub4    rcs4;

               ub2    rcs5;

               ub1    rcs6;

            } rd;

            ub4    rcs7;

            ub2    rcs8;

        } rid;

        sword        ose;

        ub1           chk;

        void         *rcsp;

    };

    main()

    {

    int   ret;

    sword flag;

    struct cda_def {

        sb2          v2_rc;                                    /* V2 return code */

        ub2          ft;                                    /* SQL function type */

        ub4          rpc;                                /* rows processed count */

        ub2          peo;                                  /* parse error offset */

        ub1          fc;                                    /* OCI function code */

        ub1          rcs1;                                        /* filler area */

        ub2          rc;                                       /* V7 return code */

        ub1          wrn;                                       /* warning flags */

        ub1          rcs2;                                           /* reserved */

        sword        rcs3;                                           /* reserved */

        struct {                                              /* rowid structure */

            struct {

               ub4    rcs4;

               ub2    rcs5;

               ub1    rcs6;

            } rd;

            ub4    rcs7;

            ub2    rcs8;

        } rid;

        sword        ose;                                 /* OSD dependent error */

        ub1           chk;

        void         *rcsp;                          /* pointer to reserved area */

        ub1          rcs9[CDA_SIZE - sizeof (struct cda_head)];        /* filler */

    } CURSEUR;

    typedef struct cda_def lda_def;

    typedef char    HDA[256];

    lda_def         lda;

    HDA             hda;

    ret=orlon(&lda, &hda,"CAO",-1,"safirs",-1,flag);

    printf("\nRetour orlon =%d=\n",ret);

    exit(1)

    }

    The result is:

    Retour orlon =-1017=

  • Bilal Ghalayini
    Bilal Ghalayini Member Posts: 0 Green Ribbon

    Where you able to solve this issue. I am running into this problem and cant find a solution that works

Sign In or Register to comment.