Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Connect Apache Http Server with Oracle database

ostrzejszyJul 14 2013 — edited Oct 25 2013

Hi,

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

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 successful but 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?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 22 2013
Added on Jul 14 2013
1 comment
2,859 views