Précédent   Forum des professionnels en informatique > Bases de données > Oracle > Interfaces de programmation
Interfaces de programmation Forum d'entraide sur l'utilisation des API Oracle : Pré-compilateurs, OCI, OCCI, etc.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 03/07/2011, 14h04   #1
Invité de passage
 
Inscription : mars 2008
Messages : 4
Détails du profil
Informations forums :
Inscription : mars 2008
Messages : 4
Points : 0
Points : 0
Par défaut [OCILIB] Instalation pour connexion Oracle

Bonjour,

Je souhaiterai installer ocilib pour me connecter à ma base oracle.

Cependant, dès le ./configure j'ai des erreurs.
Il doit y avoir un souci au niveau des variables d’environnement.

version ocilib : 3.9.0
version client oracle : 11.2
version serveur oracle : 11g
OS de la machine : Fedora14 / 32 bit

Ci dessous le log du ./configure ainsi que les valeurs des variables d’environnements nécessaire.

Log : ./configure
Code :
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
 
[root@enregistrement ocilib-3.9.0]# ./configure
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 whether the C compiler works... yes
checking FOR C compiler DEFAULT output file name... a.out
checking FOR suffix of executables...
checking whether we are CROSS compiling... no
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 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... 1572864
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... no
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... no
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... no
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 install path... /usr/LOCAL
checking FOR OCILIB version... v3.9.0
checking FOR OCILIB options... import: linkage, charset = ansi
checking FOR Oracle home... defined BY environment : /usr/lib/oracle/11.2/client
checking FOR Oracle OCI headers location... configure: error: variable NOT SET OR unable TO guess
[root@enregistrement ocilib-3.9.0]#
Variables d’environnements :
Code :
1
2
3
4
5
6
 
[root@enregistrement ocilib-3.9.0]# echo $ORACLE_HOME
/usr/lib/oracle/11.2/client
 
[root@enregistrement ocilib-3.9.0]# echo $LD_LIBRARY_PATH
/usr/lib/oracle/11.2/client/lib:/usr/include/oracle/11.2/client


J'ajouterai que j'ai essayé de lancer le ./configure avec l'argument :
Code :
1
2
 
./configure --with-oracle-headers-path=$ORACLE_HOME
Ce qui résolvais le problème, mais par la suite un erreur survenais au niveau du make :
Code :
1
2
3
4
5
6
 
IN file included FROM ocilib_defs.h:39:0,
                 FROM ocilib_types.h:38,
                 FROM ocilib_internal.h:38,
                 FROM array.c:35:
oci_import.h:48:19: fatal error: oci.h: No such file OR directory
Si vous avez besoin d'autres informations, faite le moi savoir.
Merci.
Alexandre
alex6644 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/07/2011, 21h11   #2
Rédacteur/Modérateur
 
Avatar de Vincent Rogier
 
vincent rogier
Inscription : juillet 2007
Messages : 2 355
Détails du profil
Informations personnelles :
Nom : vincent rogier
Âge : 34

Informations forums :
Inscription : juillet 2007
Messages : 2 355
Points : 3 108
Points : 3 108
salut,

le configure ne trouve pas les headers de OCI...

Ils sont usuellement dans ORACLE_HOME/rdbms/public ou ORACLE_HOME/rdbms/demo

Cherches le répertoire qui contient oci.h et si c'est pas l'un des deux cités, il faut alors passer au configure l'option --with-oracle-headers-path avec le répertoire qui contient oci.h
__________________
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
Vincent Rogier est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/07/2011, 19h17   #3
Invité de passage
 
Inscription : mars 2008
Messages : 4
Détails du profil
Informations forums :
Inscription : mars 2008
Messages : 4
Points : 0
Points : 0
Bonjour,

D'abord, merci d'avoir répondu aussi vite.
Effectivement, avec ce paramètre le ./configure c'est lancé correctement, et j'ai pu effectuer le make et le make install.
Les .h d'OCI était dans /usr/include/oracle/11.2/client/

Cependant, je ne parviens pas à compiler un petit bout de code pour initialiser la connexion à Oracle...

Saurais tu d’où viens le problème ?
Y aurai t'il eu un souci a la compilation d'ocilib ?
Ou tout simplement un linker manquant ? (j'avoue que je suis un peu perdu dans toute cette histoire, surtout que je n'ai pas la possibilité de mettre un environnement de dev (ssh oblige )

g++ main.cpp :
Code c++ :
1
2
3
4
5
6
[root@enregistrement oracle]# g++ main.cpp
/tmp/ccLqL2cj.o: In function `main':
main.cpp:(.text+0x21): undefined reference to `OCI_Initialize'
main.cpp:(.text+0x69): undefined reference to `OCI_ConnectionCreate'
main.cpp:(.text+0x72): undefined reference to `OCI_Cleanup'
collect2: ld a retourné 1 code d'état d'exécution

Contenue du main.cpp :
Code c++ :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
#include <ocilib.h>
 
using namespace std;
 
int main()
{
    OCI_Connection *cn;
 
    if (!OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT)) {
        cout << "Erreur d'initaialisation";
        return 1;
    }
    cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT);
 
 
    OCI_Cleanup();
 
    return 0;
}

Merci.
Alexandre.
alex6644 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/07/2011, 22h31   #4
Rédacteur/Modérateur
 
Avatar de Vincent Rogier
 
vincent rogier
Inscription : juillet 2007
Messages : 2 355
Détails du profil
Informations personnelles :
Nom : vincent rogier
Âge : 34

Informations forums :
Inscription : juillet 2007
Messages : 2 355
Points : 3 108
Points : 3 108
Salut,

le linker n'as pu résoudre les symboles.


Il faut rajouter :

-L/$ORACLE_HOME/lib -locilib

lors de l'édition des liens.
__________________
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
Vincent Rogier est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 05/07/2011, 18h57   #5
Invité de passage
 
Inscription : mars 2008
Messages : 4
Détails du profil
Informations forums :
Inscription : mars 2008
Messages : 4
Points : 0
Points : 0
Merci beaucoup ça fonctionne.
Le reste devrait aller tout seul maintenant.


Pour info, voici comment j'ai écris le Makefile :
Code :
1
2
3
4
5
6
7
 
main: main.cpp
        g++ main.cpp -o main -lm -L/$ORACLE_HOME/lib -locilib
 
clean:
        rm -f main
        rm -f *.o
Cordialement,
Alexandre
alex6644 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 05/07/2011, 19h45   #6
Rédacteur/Modérateur
 
Avatar de Vincent Rogier
 
vincent rogier
Inscription : juillet 2007
Messages : 2 355
Détails du profil
Informations personnelles :
Nom : vincent rogier
Âge : 34

Informations forums :
Inscription : juillet 2007
Messages : 2 355
Points : 3 108
Points : 3 108
you're welcome
__________________
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
Vincent Rogier est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 06h16.


 
 
 
 
Partenaires

Hébergement Web