Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have problem with connect ApacheHttpServer with Oracle. All work on OpenSuse 12.3

At first I install Oracle instal client 11.2. Set environment variables:

ORACLE_HOME=/usr/local/instantclient_11_2/
LD_LIBRARY_PATH=$ORACLE_HOME:$LD_LIBRARY_PATH
PATH=$ORACLE_HOME:$PATH
TNS_ADMIN=$ORACLE_HOME/network/admin
export ORACLE_HOME LD_LIBRARY_PATH PATH TNS_ADMIN

After that I compile apache http :

#apr
./configure --prefix=/usr/local/apache2/apr
make
make install

#apr-util
./configure --prefix=/usr/local/apache2/apr-util --with-apr=/usr/local/apache2/apr/
make
make install

#httpd
CPPFLAGS=-IORACLE_HOME/include LDFLAGS=-LORACLE_HOME ./configure --prefix=/usr/local/apache2/httpd --with-apr=/usr/local/apache2/apr/ --with-apr-util=/usr/local/apache2/apr-util/
make
make install 

Unfortunately, the installation was not successful because mod_dbd_oracle.so didn't created. I think I was connected with that:

#./configure output:

checking oci.h usability... yes
checking oci.h presence... yes
checking for oci.h... yes
checking for OCIEnvCreate in -lclntsh... no
   setting LIBS to "-lnnz11"
checking for OCIEnvCreate in -lclntsh... no
   nulling LIBS
   setting LIBS to "-lnnz10"

I could not find a way how to solve. So I decided to use Oracle with ODBC driver. I install unixODBC 2.2.12-219.1.1.

After that I modife to odbc.ini and odbcinst.ini:

#odbc.ini 
[xe]
DRIVER = oraclevb
DSN = xe
ServerName = //192.168.56.101:1521/xe
Application Attributes = T
Attributes = W
BatchAutocommitMode = IfAllSuccessful
BindAsFLOAT = F
CloseCursor = F
DisableDPM = F
DisableMTS = T
EXECSchemaOpt =
EXECSyntax = T
Failover = T
FailoverDelay = 10`enter code here`
FailoverRetryCount = 10
FetchBufferSize = 64000
ForceWCHAR = F
Lobs = T
Longs = T
MaxLargeData = 0
MetadataIdDefault = F
QueryTimeout = T
ResultSets = T
SQLGetData extensions = F
Translation DLL =
Translation Option = 0
DisableRULEHint = T
StatementCache=F
CacheBufferSize=20
UseOCIDescribeAny=F


 #odbcinst.ini:
[oraclevb]
Description = Oracle ODBC
Driver = /usr/local/instantclient_11_2/libsqora.so.11.1
Setup =
FileUsage =
CPTimeout =
CPReuse =

I chcek how it work with command:

isql -v xe user passowrd

All was OK. So I again compile Apache Http Source. Modify httpd.conf to use ODBC:

LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbd_module modules/mod_authz_dbd.so
LoadModule authz_core_module modules/mod_authz_core.so

LoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule dbd_module modules/mod_dbd.so

DBDriver odbc
DBDParams "datasource=xe"

<Directory "/sample">
     AuthType Basic 
     AuthName "private area" 
     AuthBasicProvider dbd
     AuthDBDUserPWQuery "SELECT password FROM USERS WHERE name = %s"
     AuthzDBDQuery "SELECT group FROM GROUPS user_name = %s"
     Require dbd-group grup1 grup2
</Directory>

Start Apache HTTTP Server and I found in error logs:

[Sun Jul 14 15:19:07 2013] [dbd_odbc] SQLConnect returned SQL_ERROR (-1) at dbd/apr_dbd_odbc.c:1130 [unixODBC][Driver Manager]Can't open lib '/usr/local/instantclient_11_2/libsqora.so.11.1' : file not found 01000 
[Sun Jul 14 15:19:07.332394 2013] [dbd:error] [pid 13374:tid 140250220050240] (20014)Internal error: AH00629: Can't connect to odbc: [dbd_odbc] SQLConnect returned SQL_ERROR (-1) at dbd/apr_dbd_odbc.c:1130 [unixODBC][Driver Manager]Can't open lib '/usr/local/instantclient_11_2/libsqora.so.11.1' : file not found 01000 

I don't know what I can do with that. Any suggestions would be very helpful. Maybe there is another way that conduct authorization and authentication using the Oracle database. Or other Apache module?

share|improve this question

migrated from stackoverflow.com Jul 16 '13 at 9:13

This question came from our site for professional and enthusiast programmers.

    
If your make didn't create an .so file, didn't it stop at that point and print an error message about why it couldn't do that work? If so, please update your question to include the text of the error message. If what you quote above ..checking for OCIEnvCreate in -lclntsh... no... is the last message in the build, please indicate that. Good luck –  shellter Jul 14 '13 at 17:11
    
when I do make, the command completed with succees (no error) bur .so for oracle didn't created. I think that is problem with checking for OCIEnvCreate in -lclntsh... no –  ostry Jul 14 '13 at 20:32
    
If you're make process didn't stop at checking for OCIEnvCreate in -lclntsh... no, but continued on and did other work, then that is not the source of your problem. make files can be smart and try to use libraries from different directories What you see in the 'trace' is the make file looking for where OCIEnvCreate is installed. It goes with its best guess. If the .so wasn't found in a later part of a compile process, then the make would stop then. Your apache log error is a hint to me that not everything about your oracle installation is as it should be. –  shellter Jul 14 '13 at 20:42
    
go to the root directory where oracle is installed (something like /opt/ora and the issue the cmd find . -name 'libsqora*'. If you get a result from this search, add that to your question above. Unless you're working on a small development machine, don't do find / -name..., as it will run for hours, searching all files available , even remote files that are mounted to your server. (Or do that as a last resort, just before you go to bed ;-) ). Good luck. –  shellter Jul 14 '13 at 20:44
    
The result of find cmd is : ./libsqora.so.11.1 But I found other problem. After connect to oracle with isql -v xe user passowrd I try to execute sql statement, eg. SELECT * FROM USERS; As result isql give me : "SQLRowCount returns -1 19 rows fetched" –  ostry Jul 14 '13 at 21:54

1 Answer 1

I would try to go with Oracle without ODBC. ODBC adds one more layer and both Oracle and ODBC usually are not as well tested as MySQL or PostgreSQL. Like others noticed the problem is with checking for OCIEnvCreate in -lclntsh... no. The most probably configure cannot find required libraries. You should try two things:
1. Check config.log for error messages about OCIEnvCreate.
2. Shouldn't httpd's configure command line say LDFLAGS=-L$ORACLE_HOME/lib? Of course I install instant client from RPMs but libclntsh.so is in lib/ subdirectory.

share|improve this answer
    
Thank you for your response. I decided to use apache2 from OpenSuse 12.3 package and develop my own apache module which connects to Oracle and do what I want. –  ostry Jul 23 '13 at 9:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.