IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Interfaces de programmation Oracle Discussion :

[PRO*C] Compiler sous Windows


Sujet :

Interfaces de programmation Oracle

  1. #1
    Membre averti
    Inscrit en
    Août 2008
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 33
    Par défaut [PRO*C] Compiler sous Windows
    Bonjour,
    Je suis en train de développer une application en proc*c la précompilation en fichier codé en c se passe bien mais j'ai du mal a compiler ce fichier.c pour obtenir l'exécutable
    y'aurait-il un compilateur c en particulier à utiliser avec le pro*c??

  2. #2
    Rédacteur
    Avatar de Vincent Rogier
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    2 373
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 2 373
    Par défaut
    Tout compilo C90 fera l'affaire quelque soit la plateforme !

    Quels sont les problèmes ?

    Tu ne donne aucune infos...
    Vincent Rogier.

    Rubrique ORACLE : Accueil - Forum - Tutoriels - FAQ - Livres - Blog

    Vous voulez contribuer à la rubrique Oracle ? Contactez la rubrique !

    OCILIB (C Driver for Oracle)

    Librairie C Open Source multi-plateformes pour accéder et manipuler des bases de données Oracle

  3. #3
    Membre averti
    Inscrit en
    Août 2008
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 33
    Par défaut erreurs lors de la compilation
    Bonjour,
    Merci Vicenzo pour ta réponse, alors je vous explique la situation:
    j'essaie de faire un petit pgm en pro*c qui fait une selection d'un champ dans une table donnée, la pré-compilation sous pro*c se passe sans pb mais lorsque je veux compiler le source c j'obtiens les erreurs suivantes:

    C:\DOCUME~1\fadil\LOCALS~1\Temp/ccEXb2wV.o:test.c.text+0xce): undefined reference to `ECPGget_sqlca'
    C:\DOCUME~1\fadil\LOCALS~1\Temp/ccEXb2wV.o:test.c.text+0x29d): undefined reference to `sqlcxt'
    C:\DOCUME~1\fadil\LOCALS~1\Temp/ccEXb2wV.o:test.c.text+0x2fb): undefined reference to `ECPGget_sqlca'
    C:\DOCUME~1\fadil\LOCALS~1\Temp/ccEXb2wV.o:test.c.text+0x41c): undefined reference to `sqlcxt'


    les outils utilisés: Mingw en tant que compilateur et emacs en tant qu'éditeur
    O.S: Windows XP

  4. #4
    Rédacteur
    Avatar de Vincent Rogier
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    2 373
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 2 373
    Par défaut
    salut,

    ce n'est pas une erreur de compilation mais une erreur de linkage...

    Il faut indiquer à ton linker la librairie pro*c : orasqlX.lib ou X est la version de Oracle.
    Vincent Rogier.

    Rubrique ORACLE : Accueil - Forum - Tutoriels - FAQ - Livres - Blog

    Vous voulez contribuer à la rubrique Oracle ? Contactez la rubrique !

    OCILIB (C Driver for Oracle)

    Librairie C Open Source multi-plateformes pour accéder et manipuler des bases de données Oracle

  5. #5
    Membre averti
    Inscrit en
    Août 2008
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 33
    Par défaut Pb linkage souw windows
    J'ai effectivement inséré les paths des librairies nécessaires c'est à dire orasql9.lib, orasqx9.lib et oci.lib mais sans résultat j'ai tjrs le même pb. Je vous envoie la ligne de commande gcc:

    gcc -L,I:\oracle\ora92\precomp\lib\msvc\orasql9.lib,I:\oracle\ora92\precomp\lib\msvc\orasqx9.lib,I:\oracle\ora92\oci\lib\msvc\oci.lib test.c

  6. #6
    Membre averti
    Inscrit en
    Août 2008
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 33
    Par défaut pb de linkage
    j'ai cherché partout sur le net mais la majorité des forums traitent ce pb par rapport à unix où il faut juste linker vers libclntsh.so
    Mais quand il s'agit de windows les forums n'apportent pas de réponse

  7. #7
    Rédacteur
    Avatar de Vincent Rogier
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    2 373
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 2 373
    Par défaut
    tu n'as pas besoin de passer orasqx9.lib et oci.lib...

    Seul orasql9.lib est nécessaire..

    parce que tu utilise gcc, tu devrais faire la chose suivante :

    - dans le répertoire I:\oracle\ora92\precomp\lib\msvc, fais une copie de orasql9.lib que tu nommes liborasql9.lib

    - et ensuite utilises la ligne de commande suivante :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    gcc -L"I:\oracle\ora92\precomp\lib\msvc" -lorasql9 test.c
    et ca devrait le faire...
    Vincent Rogier.

    Rubrique ORACLE : Accueil - Forum - Tutoriels - FAQ - Livres - Blog

    Vous voulez contribuer à la rubrique Oracle ? Contactez la rubrique !

    OCILIB (C Driver for Oracle)

    Librairie C Open Source multi-plateformes pour accéder et manipuler des bases de données Oracle

  8. #8
    Membre averti
    Inscrit en
    Août 2008
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 33
    Par défaut linkage windows
    ça ne marche toujours pas,
    je recois tjrs le meme message:

    C:\DOCUME~1\fadil\LOCALS~1\Temp/ccMcAdGa.o:test.c.text+0xce): undefined reference to `ECPGget_sqlca'
    C:\DOCUME~1\fadil\LOCALS~1\Temp/ccMcAdGa.o:test.c.text+0x29d): undefined reference to `sqlcxt'
    C:\DOCUME~1\fadil\LOCALS~1\Temp/ccMcAdGa.o:test.c.text+0x2fb): undefined reference to `ECPGget_sqlca'
    C:\DOCUME~1\fadil\LOCALS~1\Temp/ccMcAdGa.o:test.c.text+0x41c): undefined reference to `sqlcxt'

  9. #9
    Membre averti
    Inscrit en
    Août 2008
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 33
    Par défaut OCILIB
    Est ce que l'utilisation de la librairie ocilib pourrait résoudre le pb??

  10. #10
    Rédacteur
    Avatar de Vincent Rogier
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    2 373
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 2 373
    Par défaut
    Pour pro*c, cela reste un souci de config de projet... si tu pouvait poster ou m'envoyer ton projet par mail, je pourrais essayer de voir...

    Sinon, tu peux toujours essayer ocilib qui est plus riche de pro*c.

    De plus, tes exe ne seront pas dépendant de la version d'oracle et le code applicatif beaucoup plus simple à écrire et débugger !

    ps : ocilib fonctionne très avec mingw...
    Vincent Rogier.

    Rubrique ORACLE : Accueil - Forum - Tutoriels - FAQ - Livres - Blog

    Vous voulez contribuer à la rubrique Oracle ? Contactez la rubrique !

    OCILIB (C Driver for Oracle)

    Librairie C Open Source multi-plateformes pour accéder et manipuler des bases de données Oracle

  11. #11
    Membre averti
    Inscrit en
    Août 2008
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 33
    Par défaut Linkage
    Je vous envoie mon code tt de suite

  12. #12
    Rédacteur
    Avatar de Vincent Rogier
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    2 373
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 2 373
    Par défaut
    Bon, j'ai testé et le souci vient de ta précompilation !!

    postes le fichier de config ou les options que tu as passé à pro*c pour générer ton fichier....
    Vincent Rogier.

    Rubrique ORACLE : Accueil - Forum - Tutoriels - FAQ - Livres - Blog

    Vous voulez contribuer à la rubrique Oracle ? Contactez la rubrique !

    OCILIB (C Driver for Oracle)

    Librairie C Open Source multi-plateformes pour accéder et manipuler des bases de données Oracle

  13. #13
    Membre averti
    Inscrit en
    Août 2008
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 33
    Par défaut linkage compilation windows
    alors je vous explique j'ai écrit le code pro*c sous un éditeur fourni par oracle qui s'appelle proC-C++ donc je n'ai pas de commandes précises je ne fais que cliquer sur précompiler et j'obtiens mon source en c
    Pourriez vous m'indiquer la démarche à suivre svp?

  14. #14
    Membre averti
    Inscrit en
    Août 2008
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 33
    Par défaut
    pourriez vous me donner des renseignements sur la nature du problème vous avez dit qu'il s'agissait d'une erreur de précompilation mais je n'arrive pas a comprendre
    svp aidez moi c'est extrêmement urgent

  15. #15
    Membre averti
    Inscrit en
    Août 2008
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 33
    Par défaut
    commande:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    gcc -L"I:\oracle\ora92\precomp\lib\msvc" -lorasql9 test.c
    Message d'erreur:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    undefined reference to `sqlcxt'
    Code:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
     
    /* Result Sets Interface */
    #ifndef SQL_CRSR
    #  define SQL_CRSR
      struct sql_cursor
      {
        unsigned int curocn;
        void *ptr1;
        void *ptr2;
        unsigned long magic;
      };
      typedef struct sql_cursor sql_cursor;
      typedef struct sql_cursor SQL_CURSOR;
    #endif /* SQL_CRSR */
     
    /* Thread Safety */
    typedef void * sql_context;
    typedef void * SQL_CONTEXT;
     
    /* Object support */
    struct sqltvn
    {
      unsigned char *tvnvsn; 
      unsigned short tvnvsnl; 
      unsigned char *tvnnm;
      unsigned short tvnnml; 
      unsigned char *tvnsnm;
      unsigned short tvnsnml;
    };
    typedef struct sqltvn sqltvn;
     
    struct sqladts
    {
      unsigned int adtvsn; 
      unsigned short adtmode; 
      unsigned short adtnum;  
      sqltvn adttvn[1];       
    };
    typedef struct sqladts sqladts;
     
    static struct sqladts sqladt = {
      1,1,0,
    };
     
    /* Binding to PL/SQL Records */
    struct sqltdss
    {
      unsigned int tdsvsn; 
      unsigned short tdsnum; 
      unsigned char *tdsval[1]; 
    };
    typedef struct sqltdss sqltdss;
    static struct sqltdss sqltds =
    {
      1,
      0,
    };
     
    /* File name & Package Name */
    struct sqlcxp
    {
      unsigned short fillen;
               char  filnam[15];
    };
    static const struct sqlcxp sqlfpn =
    {
        14,
        "C:\\dev\\test.pc"
    };
     
     
    static unsigned long sqlctx = 1123595;
     
     
    static struct sqlexd {
       unsigned int   sqlvsn;
       unsigned int   arrsiz;
       unsigned int   iters;
       unsigned int   offset;
       unsigned short selerr;
       unsigned short sqlety;
       unsigned int   occurs;
          const short *cud;
       unsigned char  *sqlest;
          const char  *stmt;
       sqladts *sqladtp;
       sqltdss *sqltdsp;
                void  **sqphsv;
       unsigned int   *sqphsl;
                int   *sqphss;
                void  **sqpind;
                int   *sqpins;
       unsigned int   *sqparm;
       unsigned int   **sqparc;
       unsigned short  *sqpadto;
       unsigned short  *sqptdso;
                void  *sqhstv[4];
       unsigned int   sqhstl[4];
                int   sqhsts[4];
                void  *sqindv[4];
                int   sqinds[4];
       unsigned int   sqharm[4];
       unsigned int   *sqharc[4];
       unsigned short  sqadto[4];
       unsigned short  sqtdso[4];
    } sqlstm = {10,4};
     
    /* SQLLIB Prototypes */
    extern void sqlcxt (void **, unsigned long *,struct sqlexd *, const struct sqlcxp *);
    extern void sqlcx2t(void **, unsigned long *,struct sqlexd *, const struct sqlcxp *);
    extern void sqlbuft(void **, char *);
    extern void sqlgs2t(void **, char *);
    extern void sqlorat(void **, unsigned long *, void *);
     
    /* Forms Interface */
    static const int IAPSUCC = 0;
    static const int IAPFAIL = 1403;
    static const int IAPFTL  = 535;
    extern void sqliem(char *, int *);
     
    typedef struct { unsigned short len; unsigned char arr[1]; } VARCHAR;
    typedef struct { unsigned short len; unsigned char arr[1]; } varchar;
     
    /* cud (compilation unit data) array */
    static const short sqlcud0[] =
    {10,4130,178,0,0,
    5,0,0,1,0,0,27,27,0,0,4,4,0,1,0,1,9,0,0,1,9,0,0,1,9,0,0,1,10,0,0,
    36,0,0,2,45,0,4,28,0,0,1,0,0,1,0,2,9,0,0,
    };
     
     
    #include <stdio.h>
    #include <string.h>
    #include <sqlca.h>
    #include <stdlib.h>
    #include <sqlda.h>
    #include <sqlcpr.h>
    #include <oraca.h>
     
     
    /* EXEC SQL INCLUDE ORACA; 
     */ 
    /*
     * $Header: oraca.h 31-jul-99.19:33:19 apopat Exp $ oraca.h 
     */
     
    /* Copyright (c) 1985, 1996, 1998, 1999 by Oracle Corporation. */
     
    /*
    NAME
      ORACA : Oracle Communications Area.
    FUNCTION
      Contains no code. Provides supplementary communications to/from
      Oracle (in addition to standard SQLCA).
    NOTES
      **************************************************************
      ***                                                        ***
      *** This file is SOSD.  Porters must change the data types ***
      *** appropriately on their platform.  See notes/pcport.doc ***
      *** for more information.                                  ***
      ***                                                        ***
      **************************************************************
     
      oracchf : Check cursor cache consistency flag. If set AND oradbgf
                is set, then directs SQLLIB to perform cursor cache
                consistency checks before every cursor operation
                (OPEN, FETCH, SELECT, INSERT, etc.).
      oradbgf : Master DEBUG flag. Used to turn all DEBUG options
                on or off.
      orahchf : Check Heap consistency flag. If set AND oradbgf is set,
                then directs SQLLIB to perform heap consistency checks
                everytime memory is dynamically allocated/free'd via
                sqlalc/sqlfre/sqlrlc. MUST BE SET BEFORE 1ST CONNECT
                and once set cannot be cleared (subsequent requests
                to change it are ignored).
      orastxtf: Save SQL stmt text flag. If set, then directs SQLLIB
                to save the text of the current SQL stmt in orastxt
                (in VARCHAR format).
      orastxt : Saved len and text of current SQL stmt (in VARCHAR
                format).
      orasfnm : Saved len and text of filename containing current SQL
                stmt (in VARCHAR format).
      oraslnr : Saved line nr within orasfnm of current SQL stmt.
     
      Cursor cache statistics. Set after COMMIT or ROLLBACK. Each
      CONNECT'd DATABASE has its own set of statistics.
     
      orahoc  : Highest Max Open OraCursors requested. Highest value
                for MAXOPENCURSORS by any CONNECT to this DATABASE.
      oramoc  : Max Open OraCursors required. Specifies the max nr
                of OraCursors required to run this pgm. Can be higher
                than orahoc if working set (MAXOPENCURSORS) was set
                too low, thus forcing the PCC to expand the cache.
      oracoc  : Current nr of OraCursors used.
      oranor  : Nr of OraCursor cache reassignments. Can show the
                degree of "thrashing" in the cache. Optimally, this
                nr should be kept as low as possible (time vs space
                optimization).
      oranpr  : Nr of SQL stmt "parses".
      oranex  : Nr of SQL stmt "executes". Optimally, the relation-
                ship of oranex to oranpr should be kept as high as
                possible.
     
     
      If the symbol ORACA_NONE is defined, then there will be no ORACA
      *variable*, although there will still be a struct defined.  This
      macro should not normally be defined in application code.
     
      If the symbol ORACA_INIT is defined, then the ORACA will be
      statically initialized. Although this is not necessary in order
      to use the ORACA, it is a good pgming practice not to have
      unitialized variables. However, some C compilers/OS's don't
      allow automatic variables to be init'd in this manner. Therefore,
      if you are INCLUDE'ing the ORACA in a place where it would be
      an automatic AND your C compiler/OS doesn't allow this style
      of initialization, then ORACA_INIT should be left undefined --
      all others can define ORACA_INIT if they wish.
     
    OWNER
      Clare
    DATE
      10/19/85
    MODIFIED
        apopat     07/31/99 -  [707588] TAB to blanks for OCCS
        lvbcheng   10/27/98 -  change long to int for oraca
        pccint     10/03/96 -  Add IS_OSD for linting
        jbasu      12/12/94 -  Bug 217878: note this is an SOSD file
        losborne   09/04/92 -  Make oraca variable optional 
        Osborne    05/24/90 - Add ORACA_STORAGE_CLASS construct
      Clare      02/20/86 - PCC [10101l] Feature: Heap consistency check.
      Clare      03/04/86 - PCC [10101r] Port: ORACA init ifdef.
      Clare      03/12/86 - PCC [10101ab] Feature: ORACA cuc statistics.
    */
    /* IS_OSD */ 
    #ifndef  ORACA
    #define  ORACA     1
     
    struct   oraca
             {
        /* text */ char oracaid[8];        /* Reserved                            */
        /* ub4  */ int oracabc;            /* Reserved                            */
     
    /*       Flags which are setable by User. */
     
       /* ub4 */ int  oracchf;             /* <> 0 if "check cur cache consistncy"*/
       /* ub4 */ int  oradbgf;             /* <> 0 if "do DEBUG mode checking"    */
       /* ub4 */ int  orahchf;             /* <> 0 if "do Heap consistency check" */
       /* ub4 */ int  orastxtf;            /* SQL stmt text flag                  */
    #define  ORASTFNON 0                   /* = don't save text of SQL stmt       */
    #define  ORASTFERR 1                   /* = only save on SQLERROR             */
    #define  ORASTFWRN 2                   /* = only save on SQLWARNING/SQLERROR  */
    #define  ORASTFANY 3                   /* = always save                       */
             struct
               {
      /* ub2  */ unsigned short orastxtl;
      /* text */ char  orastxtc[70];
               } orastxt;                  /* text of last SQL stmt               */
             struct
               {
      /* ub2  */   unsigned short orasfnml;
      /* text */   char       orasfnmc[70];
               } orasfnm;                  /* name of file containing SQL stmt    */
      /* ub4 */ int   oraslnr;             /* line nr-within-file of SQL stmt     */
     
      /* ub4 */ int   orahoc;              /* highest max open OraCurs requested  */
      /* ub4 */ int   oramoc;              /* max open OraCursors required        */
      /* ub4 */ int   oracoc;              /* current OraCursors open             */
      /* ub4 */ int   oranor;              /* nr of OraCursor re-assignments      */
      /* ub4 */ int   oranpr;              /* nr of parses                        */
      /* ub4 */ int   oranex;              /* nr of executes                      */
             };
     
    #ifndef ORACA_NONE
     
    #ifdef ORACA_STORAGE_CLASS
    ORACA_STORAGE_CLASS struct oraca oraca
    #else
    struct oraca oraca
    #endif
    #ifdef ORACA_INIT
             =
             {
             {'O','R','A','C','A',' ',' ',' '},
             sizeof(struct oraca),
             0,0,0,0,
             {0,{0}},
             {0,{0}},
             0,
             0,0,0,0,0,0
             }
    #endif
             ;
     
    #endif
     
    #endif
    /* end oraca.h */
     
    /* EXEC SQL BEGIN DECLARE SECTION; */ 
     
    /* VARCHAR util[7]; */ 
    struct { unsigned short len; unsigned char arr[7]; } util;
     
    /* VARCHAR pass[7]; */ 
    struct { unsigned short len; unsigned char arr[7]; } pass;
     
    /* VARCHAR db[9]; */ 
    struct { unsigned short len; unsigned char arr[9]; } db;
     
    /* VARCHAR a[11]; */ 
    struct { unsigned short len; unsigned char arr[11]; } a;
     
    /* EXEC SQL END DECLARE SECTION; */ 
     
    /* EXEC SQL INCLUDE SQLCA.H;
     */ 
    /*
     * $Header: sqlca.h,v 1.3 1994/12/12 19:27:27 jbasu Exp $ sqlca.h 
     */
     
    /* Copyright (c) 1985,1986, 1998 by Oracle Corporation. */
     
    /*
    NAME
      SQLCA : SQL Communications Area.
    FUNCTION
      Contains no code. Oracle fills in the SQLCA with status info
      during the execution of a SQL stmt.
    NOTES
      **************************************************************
      ***                                                        ***
      *** This file is SOSD.  Porters must change the data types ***
      *** appropriately on their platform.  See notes/pcport.doc ***
      *** for more information.                                  ***
      ***                                                        ***
      **************************************************************
     
      If the symbol SQLCA_STORAGE_CLASS is defined, then the SQLCA
      will be defined to have this storage class. For example:
     
        #define SQLCA_STORAGE_CLASS extern
     
      will define the SQLCA as an extern.
     
      If the symbol SQLCA_INIT is defined, then the SQLCA will be
      statically initialized. Although this is not necessary in order
      to use the SQLCA, it is a good pgming practice not to have
      unitialized variables. However, some C compilers/OS's don't
      allow automatic variables to be init'd in this manner. Therefore,
      if you are INCLUDE'ing the SQLCA in a place where it would be
      an automatic AND your C compiler/OS doesn't allow this style
      of initialization, then SQLCA_INIT should be left undefined --
      all others can define SQLCA_INIT if they wish.
     
      If the symbol SQLCA_NONE is defined, then the SQLCA variable will
      not be defined at all.  The symbol SQLCA_NONE should not be defined
      in source modules that have embedded SQL.  However, source modules
      that have no embedded SQL, but need to manipulate a sqlca struct
      passed in as a parameter, can set the SQLCA_NONE symbol to avoid
      creation of an extraneous sqlca variable.
     
    MODIFIED
        lvbcheng   07/31/98 -  long to int
        jbasu      12/12/94 -  Bug 217878: note this is an SOSD file
        losborne   08/11/92 -  No sqlca var if SQLCA_NONE macro set 
      Clare      12/06/84 - Ch SQLCA to not be an extern.
      Clare      10/21/85 - Add initialization.
      Bradbury   01/05/86 - Only initialize when SQLCA_INIT set
      Clare      06/12/86 - Add SQLCA_STORAGE_CLASS option.
    */
     
    #ifndef SQLCA
    #define SQLCA 1
     
    struct   sqlca
             {
             /* ub1 */ char    sqlcaid[8];
             /* b4  */ int     sqlabc;
             /* b4  */ int     sqlcode;
             struct
               {
               /* ub2 */ unsigned short sqlerrml;
               /* ub1 */ char           sqlerrmc[70];
               } sqlerrm;
             /* ub1 */ char    sqlerrp[8];
             /* b4  */ int     sqlerrd[6];
             /* ub1 */ char    sqlwarn[8];
             /* ub1 */ char    sqlext[8];
             };
     
    #ifndef SQLCA_NONE 
    #ifdef   SQLCA_STORAGE_CLASS
    SQLCA_STORAGE_CLASS struct sqlca sqlca
    #else
             struct sqlca sqlca
    #endif
     
    #ifdef  SQLCA_INIT
             = {
             {'S', 'Q', 'L', 'C', 'A', ' ', ' ', ' '},
             sizeof(struct sqlca),
             0,
             { 0, {0}},
             {'N', 'O', 'T', ' ', 'S', 'E', 'T', ' '},
             {0, 0, 0, 0, 0, 0},
             {0, 0, 0, 0, 0, 0, 0, 0},
             {0, 0, 0, 0, 0, 0, 0, 0}
             }
    #endif
             ;
    #endif
     
    #endif
     
    /* end SQLCA */
     
     
    int main(){
            int a;
            /* ...  USING :db */
            //char a[11];
    	char *util;
    	char *pass;
    	char *db;
    	util="jb_riad";
    	pass="riad_jb";
    	db="riad_data";
    	/* EXEC SQL CONNECT :util identified by :pass using :db; */ 
     
    {
     struct sqlexd sqlstm;
     sqlstm.sqlvsn = 10;
     sqlstm.arrsiz = 4;
     sqlstm.sqladtp = &sqladt;
     sqlstm.sqltdsp = &sqltds;
     sqlstm.iters = (unsigned int  )10;
     sqlstm.offset = (unsigned int  )5;
     sqlstm.cud = sqlcud0;
     sqlstm.sqlest = (unsigned char  *)&sqlca;
     sqlstm.sqlety = (unsigned short)256;
     sqlstm.occurs = (unsigned int  )0;
     sqlstm.sqhstv[0] = (         void  *)&util;
     sqlstm.sqhstl[0] = (unsigned int  )9;
     sqlstm.sqhsts[0] = (         int  )9;
     sqlstm.sqindv[0] = (         void  *)0;
     sqlstm.sqinds[0] = (         int  )0;
     sqlstm.sqharm[0] = (unsigned int  )0;
     sqlstm.sqadto[0] = (unsigned short )0;
     sqlstm.sqtdso[0] = (unsigned short )0;
     sqlstm.sqhstv[1] = (         void  *)&pass;
     sqlstm.sqhstl[1] = (unsigned int  )9;
     sqlstm.sqhsts[1] = (         int  )9;
     sqlstm.sqindv[1] = (         void  *)0;
     sqlstm.sqinds[1] = (         int  )0;
     sqlstm.sqharm[1] = (unsigned int  )0;
     sqlstm.sqadto[1] = (unsigned short )0;
     sqlstm.sqtdso[1] = (unsigned short )0;
     sqlstm.sqhstv[2] = (         void  *)&db;
     sqlstm.sqhstl[2] = (unsigned int  )11;
     sqlstm.sqhsts[2] = (         int  )11;
     sqlstm.sqindv[2] = (         void  *)0;
     sqlstm.sqinds[2] = (         int  )0;
     sqlstm.sqharm[2] = (unsigned int  )0;
     sqlstm.sqadto[2] = (unsigned short )0;
     sqlstm.sqtdso[2] = (unsigned short )0;
     sqlstm.sqphsv = sqlstm.sqhstv;
     sqlstm.sqphsl = sqlstm.sqhstl;
     sqlstm.sqphss = sqlstm.sqhsts;
     sqlstm.sqpind = sqlstm.sqindv;
     sqlstm.sqpins = sqlstm.sqinds;
     sqlstm.sqparm = sqlstm.sqharm;
     sqlstm.sqparc = sqlstm.sqharc;
     sqlstm.sqpadto = sqlstm.sqadto;
     sqlstm.sqptdso = sqlstm.sqtdso;
     sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
    }
     
     
            /* EXEC SQL SELECT max(d_date) INTO :a FROM tsuivifich; */ 
     
    {
            struct sqlexd sqlstm;
            sqlstm.sqlvsn = 10;
            sqlstm.arrsiz = 4;
            sqlstm.sqladtp = &sqladt;
            sqlstm.sqltdsp = &sqltds;
            sqlstm.stmt = "select max(d_date) into :b0  from tsuivifich ";
            sqlstm.iters = (unsigned int  )1;
            sqlstm.offset = (unsigned int  )36;
            sqlstm.selerr = (unsigned short)1;
            sqlstm.cud = sqlcud0;
            sqlstm.sqlest = (unsigned char  *)&sqlca;
            sqlstm.sqlety = (unsigned short)256;
            sqlstm.occurs = (unsigned int  )0;
            sqlstm.sqhstv[0] = (         void  *)&a;
            sqlstm.sqhstl[0] = (unsigned int  )13;
            sqlstm.sqhsts[0] = (         int  )0;
            sqlstm.sqindv[0] = (         void  *)0;
            sqlstm.sqinds[0] = (         int  )0;
            sqlstm.sqharm[0] = (unsigned int  )0;
            sqlstm.sqadto[0] = (unsigned short )0;
            sqlstm.sqtdso[0] = (unsigned short )0;
            sqlstm.sqphsv = sqlstm.sqhstv;
            sqlstm.sqphsl = sqlstm.sqhstl;
            sqlstm.sqphss = sqlstm.sqhsts;
            sqlstm.sqpind = sqlstm.sqindv;
            sqlstm.sqpins = sqlstm.sqinds;
            sqlstm.sqparm = sqlstm.sqharm;
            sqlstm.sqparc = sqlstm.sqharc;
            sqlstm.sqpadto = sqlstm.sqadto;
            sqlstm.sqptdso = sqlstm.sqtdso;
            sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
    }
     
     
            /* ... */
            printf("The salary is %d\n", a);
            /* ... */
    	exit(EXIT_SUCCESS);
        }
    Svp aidez moi

  16. #16
    Rédacteur
    Avatar de Vincent Rogier
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    2 373
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 2 373
    Par défaut
    postes le fichier source (*.pc) et pas le fichier C
    Vincent Rogier.

    Rubrique ORACLE : Accueil - Forum - Tutoriels - FAQ - Livres - Blog

    Vous voulez contribuer à la rubrique Oracle ? Contactez la rubrique !

    OCILIB (C Driver for Oracle)

    Librairie C Open Source multi-plateformes pour accéder et manipuler des bases de données Oracle

  17. #17
    Membre averti
    Inscrit en
    Août 2008
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 33
    Par défaut test.pc
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    #include <stdio.h>
    #include <string.h>
    #include <sqlca.h>
    #include <stdlib.h>
    #include <sqlda.h>
    #include <sqlcpr.h>
     
     
    EXEC SQL INCLUDE ORACA; 
    EXEC SQL BEGIN DECLARE SECTION;
    VARCHAR util[7];
    VARCHAR pass[7];
    VARCHAR db[9];
    VARCHAR a[11];
    EXEC SQL END DECLARE SECTION;
    EXEC SQL INCLUDE SQLCA.H;
     
    void main(){
            int a;
            /* ...  USING :db */
            char a[11];
    	char util[7];
    	char pass[7];
    	char db[9];
    	util="jb_riad";
    	pass="riad_jb";
    	db="riad_data";
    	EXEC SQL CONNECT :util identified by :pass using :db; 
            EXEC SQL SELECT max(d_date) INTO :a FROM tsuivifich;
            /* ... */
            printf("The salary is %d\n", a);
            /* ... */
    	exit(EXIT_SUCCESS);
        }

  18. #18
    Rédacteur
    Avatar de Vincent Rogier
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    2 373
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 2 373
    Par défaut
    commence par remplacer

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    #include <sqlca.h>
    #include <stdlib.h>
    #include <sqlda.h>
    #include <sqlcpr.h>
    par

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    #include <oraca.h>
    #include <sqlca.h>
    #include <stdlib.h>
    ensuite, retire les lignes suivantes :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    EXEC SQL INCLUDE ORACA;
    EXEC SQL INCLUDE SQLCA.H;
    enfin, recompiles le source pro*c et recompiles le source c
    Vincent Rogier.

    Rubrique ORACLE : Accueil - Forum - Tutoriels - FAQ - Livres - Blog

    Vous voulez contribuer à la rubrique Oracle ? Contactez la rubrique !

    OCILIB (C Driver for Oracle)

    Librairie C Open Source multi-plateformes pour accéder et manipuler des bases de données Oracle

  19. #19
    Membre averti
    Inscrit en
    Août 2008
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 33
    Par défaut
    tjrs la même erreur

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    undefined reference to `sqlcxt'

  20. #20
    Membre averti
    Inscrit en
    Août 2008
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 33
    Par défaut
    au fait il y'a une ligne qui pose pb
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);

Discussions similaires

  1. Réponses: 0
    Dernier message: 04/08/2009, 18h46
  2. Réponses: 8
    Dernier message: 27/04/2009, 12h27
  3. [Lazarus] Compiler sous Windows pour Linux
    Par JoseF dans le forum Lazarus
    Réponses: 3
    Dernier message: 13/06/2007, 21h43
  4. Compilation sous windows avec devc++
    Par dr_octopus74 dans le forum Dev-C++
    Réponses: 4
    Dernier message: 17/01/2007, 22h48
  5. Code compilable sous Windows et Unix
    Par xzed dans le forum C
    Réponses: 9
    Dernier message: 16/05/2006, 16h06

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo