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 :

[OCI] Utilisation basique


Sujet :

Interfaces de programmation Oracle

  1. #1
    Membre du Club Avatar de Mayhem555
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    89
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 89
    Points : 46
    Points
    46
    Par défaut [OCI] Utilisation basique
    Salut à vous.

    Je programme actuellement un logiciel en C sous Linux (Fedora 8 :S) qui doit se connecter (puis rester connecté perpétuellement) à une base de données Oracle (version exacte inconnue mais récente).

    La seule chose que mon programme doit faire est un INSERT INTO blablabla... dans cette base. Ce qui vous en conviendrez est assez succint.

    Je cherchait donc une librairie ou une API qui me permettrait de me connecter et d'envoyer une telle requête à une base de donées Oracle. En fouillant sur leur site j'ai rapidement trouvé OCI.
    J'ai aussi trouvé sa documentation officielle qui est assez "hardcore" (1300 pages).
    Mon ami Google ne m'a pas donné trop de résultat vraiment probant sur d'éventuels tutoriels d'utilisation basique de cette API qui m'a l'air plutôt complexe.

    En connaissez vous ?

    J'ai réussi à trouver la doc de OCI mais pas les fichiers de la bibliothèque ou des .h.

    Merci de votre aide

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

    Informations forums :
    Inscription : Juillet 2007
    Messages : 2 373
    Points : 5 307
    Points
    5 307
    Par défaut
    Il y a peu de doc OCI en francais....==> donc en anglais (HTML, PDF)

    Et effectivement, c'est une API très complexe ! Mais tellement puissante ...


    Si tu trouves OCI trop hard, tu peux essayer OCILIB qui est un wrapper autour d'OCI.

    Voici un tuto en français : Développer une application Oracle en C/C++ avec la librairie OCILIB

    Exemple de code pour se connecter, faire un loop de 1000 inserts avec OCILIB et se déconnecter :

    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
    #include "ocilib.h"
     
    int main()
    {
        OCI_Connection *cn;
        OCI_Statement *st;
        int code;
        char value[20];
     
        if (OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT) == FALSE)
            return EXIT_FAILURE;
     
        cn = OCI_CreateConnection("db", "user", "pass", OCI_SESSION_DEFAULT);
     
        st = OCI_CreateStatement(cn);
     
        OCI_Prepare(st, "insert into my_table values(:code, :value)");
        OCI_BindInt(st, ":code", &code);
        OCI_BindString(st, ":value", value, 20);
     
        for (code = 1; code < 1000; code++);
        {
            sprintf(value, "value %i", code);    
            OCI_Execute(st);
        }
     
        OCI_Commit(cn);
        OCI_ConnectionFree(cn);    
        OCI_Cleanup();
     
        return EXIT_SUCCESS;
    }
    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 du Club Avatar de Mayhem555
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    89
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 89
    Points : 46
    Points
    46
    Par défaut
    Salut Vincenzo et merci pour ta réponse.

    J'ai suivi ton conseil et essayé d'installer OCILIB.

    J'ai d'abord installé Oracle 10g Express Edition, téléchargé ici ( http://www.oracle.com/technology/sof...xelinsoft.html ),
    et j'ai suivi l'installation en suivant la doc, ICI.

    Donc Oracle s'installe bien. Par contre lors de l'install d'OCILIB, lorsque je lance le ./configure, je termine sur une erreur, voyez plutôt la trace.

    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
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for a thread-safe mkdir -p... /bin/mkdir -p
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking for gcc... gcc
    checking for C compiler default output file name... a.out
    checking whether the C compiler works... yes
    checking whether we are cross compiling... no
    checking for suffix of executables... 
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking for style of include used by make... GNU
    checking dependency style of gcc... gcc3
    checking for a BSD-compatible install... /usr/bin/install -c
    checking build system type... i686-pc-linux-gnu
    checking host system type... i686-pc-linux-gnu
    checking for a sed that does not truncate output... /bin/sed
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking for ld used by gcc... /usr/bin/ld
    checking if the linker (/usr/bin/ld) is GNU ld... yes
    checking for /usr/bin/ld option to reload object files... -r
    checking for BSD-compatible nm... /usr/bin/nm -B
    checking whether ln -s works... yes
    checking how to recognize dependent libraries... pass_all
    checking how to run the C preprocessor... gcc -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking dlfcn.h usability... yes
    checking dlfcn.h presence... yes
    checking for dlfcn.h... yes
    checking for g++... g++
    checking whether we are using the GNU C++ compiler... yes
    checking whether g++ accepts -g... yes
    checking dependency style of g++... gcc3
    checking how to run the C++ preprocessor... g++ -E
    checking for g77... no
    checking for xlf... no
    checking for f77... no
    checking for frt... no
    checking for pgf77... no
    checking for cf77... no
    checking for fort77... no
    checking for fl32... no
    checking for af77... no
    checking for xlf90... no
    checking for f90... no
    checking for pgf90... no
    checking for pghpf... no
    checking for epcf90... no
    checking for gfortran... gfortran
    checking whether we are using the GNU Fortran 77 compiler... yes
    checking whether gfortran accepts -g... yes
    checking the maximum length of command line arguments... 98304
    checking command to parse /usr/bin/nm -B output from gcc object... ok
    checking for objdir... .libs
    checking for ar... ar
    checking for ranlib... ranlib
    checking for strip... strip
    checking if gcc supports -fno-rtti -fno-exceptions... no
    checking for gcc option to produce PIC... -fPIC
    checking if gcc PIC flag -fPIC works... yes
    checking if gcc static flag -static works... yes
    checking if gcc supports -c -o file.o... yes
    checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
    checking whether -lc should be explicitly linked in... no
    checking dynamic linker characteristics... GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    checking whether stripping libraries is possible... yes
    checking if libtool supports shared libraries... yes
    checking whether to build shared libraries... yes
    checking whether to build static libraries... yes
    configure: creating libtool
    appending configuration tag "CXX" to libtool
    checking for ld used by g++... /usr/bin/ld
    checking if the linker (/usr/bin/ld) is GNU ld... yes
    checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
    checking for g++ option to produce PIC... -fPIC
    checking if g++ PIC flag -fPIC works... yes
    checking if g++ static flag -static works... yes
    checking if g++ supports -c -o file.o... yes
    checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
    checking dynamic linker characteristics... GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    appending configuration tag "F77" to libtool
    checking if libtool supports shared libraries... yes
    checking whether to build shared libraries... yes
    checking whether to build static libraries... yes
    checking for gfortran option to produce PIC... -fPIC
    checking if gfortran PIC flag -fPIC works... yes
    checking if gfortran static flag -static works... yes
    checking if gfortran supports -c -o file.o... yes
    checking whether the gfortran linker (/usr/bin/ld) supports shared libraries... yes
    checking dynamic linker characteristics... GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    checking for ranlib... (cached) ranlib
    checking for OCILIB path... is /usr/local
    checking for OCILIB package... current version is : 2.4.0 
    checking for OCILIB options... import: linkage, charset = ansi 
    checking for Oracle environnement... configure: error:  Oracle installation needed.
    C'est bizarre car Oracle est normalemet correctement installé. Où ai-je fais une connerie ?

    Merci de votre aide !!

  4. #4
    Membre du Club Avatar de Mayhem555
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    89
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 89
    Points : 46
    Points
    46
    Par défaut
    Tiens, je me suis rendu compte que lorsque juste après l'install d'Oracle on me demande d'aller dans /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin
    et de lancer le script bash oracle_env.sh, celui ci ne m'a pas l'air de marcher car il est sensé donner une valeur à certaines variables d'environnement

    Ça c'est le contenu du script
    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
    ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
    export ORACLE_HOME
    ORACLE_SID=XE
    export ORACLE_SID
    NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
    export NLS_LANG
    PATH=$ORACLE_HOME/bin:$PATH
    export PATH
    if [ $?LD_LIBRARY_PATH ]
    then
    	LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
    else
    	LD_LIBRARY_PATH=$ORACLE_HOME/lib
    fi
    export LD_LIBRARY_PATH
    Or derrière, un echo $ORACLE_HOME me renvoie une ligne vide.

    Est-ce la source de l'erreur ?

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

    Informations forums :
    Inscription : Juillet 2007
    Messages : 2 373
    Points : 5 307
    Points
    5 307
    Par défaut
    Effectivement si ORACLE_HOME n'est pas défini, le configure d'OCILIB, avec les options par défaut, échouera.

    Donc, tu peux définir ORACLE_HOME dans ton .profile avec le répertoire d'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

  6. #6
    Membre du Club Avatar de Mayhem555
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    89
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 89
    Points : 46
    Points
    46
    Par défaut
    Salut Vincenzo !

    Je suis parvenu à installer OCILIB en utilisant la commande
    ./configure --with oracle-home=...
    puis le make, puis le make install.

    En revanche je n'arrive pas à compiler le petit exemple que tu m'as taper dans ce thread (au dessus). J'ai mis ça dans un main.c, mais la compilation pose des problèmes.

    Je n'ai pas tout à fait saisi la démarche à suivre dans ton tutoriel à la section III.E.

    J'ai fait un petit Makefile, mais je ne sais pas dans quelle mesure je doit ajouter les path des librairies sachant que je suis en UNICODE (Oracle 10g)

    Mon makefile est certainement foireux mais le compilateur / linker me dit qu'il ne trouve pas le fichier libnnz10.so ....qui après recherche n'existe nulle part

    Aurais tu un makefile typique pour compiler un main.c tout bête pour savoir si c'est moi qui foire (ce qui est fort probable).

    Merci

  7. #7
    Membre du Club Avatar de Mayhem555
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    89
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 89
    Points : 46
    Points
    46
    Par défaut
    Je rajoute mon makefile
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    all : ocilib main.o
    ocilib: main.o
    	gcc -o main.o -L/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib -lclntsh -L/usr/local/lib -DOCI_IMPORT_LINKAGE -DOCI_CHARSET_UNICODE
    main.o: main.c 
    	gcc -Wall -o main main.c -I/usr/local/include
    :

    et ma console

    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
    # make
    gcc -Wall -o main main.c -I/usr/local/include
    /tmp/cciPrltf.o: In function `main':
    main.c:(.text+0x29): undefined reference to `OCI_Initialize'
    main.c:(.text+0x5d): undefined reference to `OCI_ConnectionCreate'
    main.c:(.text+0x6b): undefined reference to `OCI_StatementCreate'
    main.c:(.text+0x81): undefined reference to `OCI_Prepare'
    main.c:(.text+0x9b): undefined reference to `OCI_BindInt'
    main.c:(.text+0xbd): undefined reference to `OCI_BindString'
    main.c:(.text+0xfe): undefined reference to `OCI_Execute'
    main.c:(.text+0x109): undefined reference to `OCI_Commit'
    main.c:(.text+0x114): undefined reference to `OCI_ConnectionFree'
    main.c:(.text+0x119): undefined reference to `OCI_Cleanup'
    collect2: ld returned 1 exit status
    make: *** [main.o] Error 1
    Il y a quelque chose qui ne tourne pas rond dans mon makefile, non ?

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

    Informations forums :
    Inscription : Juillet 2007
    Messages : 2 373
    Points : 5 307
    Points
    5 307
    Par défaut
    Citation Envoyé par Mayhem555 Voir le message

    Je suis parvenu à installer OCILIB en utilisant la commande
    ./configure --with oracle-home=...
    puis le make, puis le make install.
    Ok, mais tu n'aurais du avoir à le faire....

    As tu défini la variable ORACLE_HOME ?
    as tu ajouté le contenu de $ORACLE_HOME/lib à LD_LIBRARY_PATH ?

    Citation Envoyé par Mayhem555 Voir le message
    Aurais tu un makefile typique pour compiler un main.c tout bête pour savoir si c'est moi qui foire (ce qui est fort probable).
    Une fois OCILIB installé, tu peux récupérer le makefile de la demo dans .usr/local/share/doc/ocilib/demo

    De plus pour configure OCILIB en unicode, il faut faire un :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    ./configure --with-oracle-charset=unicode
    Donc, a ta place, je recommencerai par faire :
    • définir ORACLE_HOME dans ton .profile pour qu'il pointe sur ton répertoire Oracle (=> /usr/lib/oracle/xe/app/oracle/product/10.2.0/server)
    • ajouter dans ton .profile $ORACLE_HOME/lib à la variable LD_LIBRARY_PATH
    • ensuite, tu peux essayer de régénérer les shared librairies d'oracle en lancant le script $ORACLE_HOME/bin/genclntsh
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    ./configure --with-oracle-charset=unicode
    make
    make install
    • Tu récupères le makefile de la demo dans /usr/local/share/doc/ocilib/demo (ou ailleurs, c'est indiqué à la fin du make install)
    • Tu compiles et tout devrait être bon !
    Voila !
    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

  9. #9
    Membre du Club Avatar de Mayhem555
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    89
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 89
    Points : 46
    Points
    46
    Par défaut
    Merci beaucoup Vincenzo pour le temps que tu passes à m'aider !

    Alors j'ai quand même réussi à avancer, car je suis parvenu à compiler mon main.c !

    J'ai du fixer moi-même les valeurs de ORACLE_HOME et de LD_LIBRARY_PATH dans mon fichier .bashrc .

    En revanche le script que tu m'as indiqué : $ORACLE_HOME/bin/genclntsh n'existe pas chez moi ? Normal ou problème ?

    Aussi à l'éxécution :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    error while loading shared libraries: libocilib.so.2: cannot open shared object file: No such file or directory
    Or je n'arrive pas à trouver ce fichier libocilib manuellement

    Je galère un peu...

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

    Informations forums :
    Inscription : Juillet 2007
    Messages : 2 373
    Points : 5 307
    Points
    5 307
    Par défaut
    LD_LIB_PATH
    ?? tu doit mettre à jour LD_LIBRARY_PATH sur linux

    De plus, il faut que le répertoire ou se trouve libocilib.so soit aussi dans LD_LIBRAY_PATH.

    libocilib.so est génré par le make et copié dans le répertoire de destination par make intall

    Typiquement sous linux , c'est /usr/local/lib (c'est indiqué dans le résultat du make install)
    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 du Club Avatar de Mayhem555
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    89
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 89
    Points : 46
    Points
    46
    Par défaut
    OK.

    J'avais commis une erreur lors de l'affectation des valeurs à LD_LIBRARY_PATH (et non LD_LIB_PATH...erreur que j'ai commise uniquement dans ce forum ).

    Ça a l'air de fonctionner maintenant. Je mets résolu et je te tiens au courant si d'autres soucis surviennent.

    Merci beaucoup pour ton aide.

  12. #12
    Membre du Club Avatar de Mayhem555
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    89
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 89
    Points : 46
    Points
    46
    Par défaut
    Salut,

    je me permet de reposter sur ce thread afin de ne pas polluer outre mesure le forum.

    J'utilise donc OCILIB afin d'envoyer en C des insert à une base Oracle XE 10g.

    Le passage d'une requete écrite en C à la main marche parfaitement.

    Par contre, je veux automatiser les INSERT à partir de la lecture d'un fichier et en faisant une trace console de mes insert voilà en gros ce que j'obtiens :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    INSERT INTO pouet (Timestamp,Socket,Size,PGI,PI10_Identifiant_Communaute,PI19_Identifiant_Protocole_Ap�L��1�,PI20_Version_Protocole_CBCOM,PI21_Version_Protocole_Applic$�L��1�,PI23_Identifiant_Canal_RaccorK�L��1�,PI25_Identifiant_Application_t�L��1�,PI26_Identifiant_Entite_CBCOM��L��1�,PI27_Mode_Transfert,PI29_Mode_Flux,PI30_Taille_Fenetre_Anticipati   �L��1�,) VALUES (,'2008:06:13:15:34:02:249:00','C0A80A010BE4C0A80A0205EA','64','C2','CB      ','0001','14','0402','0026','TESS_33','123456123456','01','03','05') ;
    Alors forcément le OCI_Execute retourne FALSE, puisqu'il y a vraisemblablement des caractères bizarres.

    Est-ce que vous pouvez me dire à quoi cela est dû et comment palier à ce problème ?

    Merci beaucoup et bonne journée.

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

    Informations forums :
    Inscription : Juillet 2007
    Messages : 2 373
    Points : 5 307
    Points
    5 307
    Par défaut
    Tu dois avoir un souci de lecture de fichier...

    Tu peux poster ton code ou m'envoyer ca par mp/mail, stp ?
    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

  14. #14
    Membre du Club Avatar de Mayhem555
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    89
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 89
    Points : 46
    Points
    46
    Par défaut
    Salut Vincenzo,

    La connerie venait bien de moi (qui d'autre ??)...La lecture de fichier marchait parfaitement car je l'utilise dans d'autres circonstances...

    c'est juste que j'avais fait un strncpy() afin de réduire la taille de certains noms de colonnes, puisque Oracle n'est pas content lorsque le nom dépasse 30 caractères (et je le comprends !!), et du coup certaines zones mémoire erronées étaient quand même prises en compte.



    Désolé pour le dérangement!

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

    Informations forums :
    Inscription : Juillet 2007
    Messages : 2 373
    Points : 5 307
    Points
    5 307
    Par défaut
    Puisque tu as l'air d'apprécier l'auto-flagellation, allons y !!



    Trêvesde plaisanteries (), n'hésites pas à me contacter en cas de soucis / informations sur OCILIB
    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

  16. #16
    Membre du Club Avatar de Mayhem555
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    89
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 89
    Points : 46
    Points
    46
    Par défaut
    Salut Vincenzo !

    Bon, j'ai été amené a devoir réisntaller mon système et donc OCI par la meme occasion.

    Du coup J'ai une erreur non pas au ./config, mais au make install :

    make install
    cd . && /bin/sh /home/o.muret/ocilib-2.4.0/config/missing --run aclocal-1.10
    /usr/bin/m4:configure.ac:11: cannot open `acocilib.m4': No such file or directory
    autom4te: /usr/bin/m4 failed with exit status: 1
    aclocal-1.10: autom4te failed with exit status: 1
    make: *** [aclocal.m4] Erreur 1



    Honnetement je sort d'une grosse journée je pète un cable...D'où ça sort un truc comme ça ??

    Merci pour ton aide

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

    Informations forums :
    Inscription : Juillet 2007
    Messages : 2 373
    Points : 5 307
    Points
    5 307
    Par défaut
    donc, tus as bien fait ca ?

    ./configure --with-oracle-charset=unicode
    ./make
    ./ make install
    Peux tu poster l'output du configure ?

    T'a essayé de passer root avant de lancer le make install ?

    (tu peux ausssi revoir le 8eme post de ce topic)
    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

  18. #18
    Membre du Club Avatar de Mayhem555
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    89
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 89
    Points : 46
    Points
    46
    Par défaut
    Salut,

    Oui j'ai lancé en root la commande ./configure --with-oracle-charset=unicode, qui donne ceci :

    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
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for a thread-safe mkdir -p... /bin/mkdir -p
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking for gcc... gcc
    checking for C compiler default output file name... a.out
    checking whether the C compiler works... yes
    checking whether we are cross compiling... no
    checking for suffix of executables... 
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking for style of include used by make... GNU
    checking dependency style of gcc... gcc3
    checking for a BSD-compatible install... /usr/bin/install -c
    checking build system type... i686-pc-linux-gnu
    checking host system type... i686-pc-linux-gnu
    checking for a sed that does not truncate output... /bin/sed
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking for ld used by gcc... /usr/bin/ld
    checking if the linker (/usr/bin/ld) is GNU ld... yes
    checking for /usr/bin/ld option to reload object files... -r
    checking for BSD-compatible nm... /usr/bin/nm -B
    checking whether ln -s works... yes
    checking how to recognize dependent libraries... pass_all
    checking how to run the C preprocessor... gcc -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking dlfcn.h usability... yes
    checking dlfcn.h presence... yes
    checking for dlfcn.h... yes
    checking for g++... g++
    checking whether we are using the GNU C++ compiler... yes
    checking whether g++ accepts -g... yes
    checking dependency style of g++... gcc3
    checking how to run the C++ preprocessor... g++ -E
    checking for g77... no
    checking for xlf... no
    checking for f77... no
    checking for frt... no
    checking for pgf77... no
    checking for cf77... no
    checking for fort77... no
    checking for fl32... no
    checking for af77... no
    checking for xlf90... no
    checking for f90... no
    checking for pgf90... no
    checking for pghpf... no
    checking for epcf90... no
    checking for gfortran... gfortran
    checking whether we are using the GNU Fortran 77 compiler... yes
    checking whether gfortran accepts -g... yes
    checking the maximum length of command line arguments... 98304
    checking command to parse /usr/bin/nm -B output from gcc object... ok
    checking for objdir... .libs
    checking for ar... ar
    checking for ranlib... ranlib
    checking for strip... strip
    checking if gcc supports -fno-rtti -fno-exceptions... no
    checking for gcc option to produce PIC... -fPIC
    checking if gcc PIC flag -fPIC works... yes
    checking if gcc static flag -static works... yes
    checking if gcc supports -c -o file.o... yes
    checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
    checking whether -lc should be explicitly linked in... no
    checking dynamic linker characteristics... GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    checking whether stripping libraries is possible... yes
    checking if libtool supports shared libraries... yes
    checking whether to build shared libraries... yes
    checking whether to build static libraries... yes
    configure: creating libtool
    appending configuration tag "CXX" to libtool
    checking for ld used by g++... /usr/bin/ld
    checking if the linker (/usr/bin/ld) is GNU ld... yes
    checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
    checking for g++ option to produce PIC... -fPIC
    checking if g++ PIC flag -fPIC works... yes
    checking if g++ static flag -static works... yes
    checking if g++ supports -c -o file.o... yes
    checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
    checking dynamic linker characteristics... GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    appending configuration tag "F77" to libtool
    checking if libtool supports shared libraries... yes
    checking whether to build shared libraries... yes
    checking whether to build static libraries... yes
    checking for gfortran option to produce PIC... -fPIC
    checking if gfortran PIC flag -fPIC works... yes
    checking if gfortran static flag -static works... yes
    checking if gfortran supports -c -o file.o... yes
    checking whether the gfortran linker (/usr/bin/ld) supports shared libraries... yes
    checking dynamic linker characteristics... GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    checking for ranlib... (cached) ranlib
    checking for OCILIB path... is /usr/local
    checking for OCILIB package... current version is : 2.4.0 
    checking for OCILIB options... import: linkage, charset = unicode 
    checking for Oracle environnement... location: /usr/lib/oracle/xe/app/oracle/product/10.2.0/server, shared lib folder : lib
    configure: creating ./config.status
    config.status: creating README
    config.status: creating Makefile
    config.status: creating src/Makefile
    config.status: creating doc/html/Makefile
    config.status: creating demo/Makefile
    config.status: creating demo/Makefile_demo
    config.status: creating config.h
    config.status: config.h is unchanged
    config.status: executing depfiles commands
    Toujours la même erreur.

  19. #19
    Membre du Club Avatar de Mayhem555
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    89
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 89
    Points : 46
    Points
    46
    Par défaut
    Resalut,

    bon en fait je pense que OCILIB a fini par s'installer correctement...les mystères de l'informatique...j'ai juste supprimé les fichiers OCILIB et recommencé avec les fichiers de l'archive initiale.

    Par contre, dans le chapitre des mystère, même si j'arrive maintenant à compiler, mon programme fait appel à des librairies dynamiques Oracle, ce qui ne plait pas à SELinux. Je te reviens avec ça

Discussions similaires

  1. [Débutant] Utilisation basique du TChart
    Par coxycross dans le forum C++Builder
    Réponses: 4
    Dernier message: 04/06/2012, 15h05
  2. Utilisation basique de dreamweaver
    Par Philp974 dans le forum Dreamweaver
    Réponses: 4
    Dernier message: 22/07/2009, 21h35
  3. [WebServices][WSDL] Utilisation (basique) de la Google API
    Par Rom_1 dans le forum Services Web
    Réponses: 5
    Dernier message: 07/07/2009, 22h55
  4. Utilisation basique de AJAX.
    Par tomagold dans le forum JSF
    Réponses: 3
    Dernier message: 13/12/2007, 11h52
  5. [OCI] utilisation de l'interface OCI
    Par Abdelkaoui dans le forum Interfaces de programmation
    Réponses: 1
    Dernier message: 04/09/2007, 19h21

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