Recent

Author Topic: Can't connect to Remote Oracle DB from Linux fbc-web CGI  (Read 2469 times)

Jumpy

  • Newbie
  • Posts: 2
Can't connect to Remote Oracle DB from Linux fbc-web CGI
« on: October 07, 2016, 11:50:42 am »
Hello,
welcome to my first post in this forum  :D:

I have installed Lazarus on a 64bit Centos-Linux, including fpc-web and zeos components.
I have installed Oracle Instant Client so, that the libraries are in usr/lib/oracle/12.1/client64/lib.
I have a remote Oracle-DB.
I can connect to this DB from the Linux-machine using Oracles SQLPlus.
I can connect to this DB from the Linux-machine in a normal GUI-Test-Programm using either zeos components or Lazarus' TOracleConnection, both work.

But in a Web-CGI, compiled on the same machine, running in Apache on the same machine it won't work. Getting the following Error-Messages:

Using TOracleConnection:
Can not load Oracle client library "libociei.so". Is it installed?

Using Zeos:
None of the dynamic libraries can be found or is not loadable: libclntsh.so ! Use TZConnection.LibraryLocation if the location is invalid.

Using Zeos and filling TZConnection.LibraryLocation with above mentioned path:
Client-Library /usr/lib/oracle/12.1/client64/lib found but could not be loaded. Check compile-target and library compatibility!

Imho library is 64bit cgi-exe is 64bit. Compile-Target in Lazarus was "Default".

Why can't it find and/or load the libraries?

I'm new to Linux and Lazarus, so tell me if you need more info.

Crosspost DP
« Last Edit: October 07, 2016, 12:13:19 pm by Jumpy »

Jumpy

  • Newbie
  • Posts: 2
Re: Can't connect to Remote Oracle DB from Linux fbc-web CGI
« Reply #1 on: October 10, 2016, 07:38:25 am »
Push  :)

Thaddy

  • Hero Member
  • *****
  • Posts: 7991
Re: Can't connect to Remote Oracle DB from Linux fbc-web CGI
« Reply #2 on: October 10, 2016, 07:55:36 am »
Try if it helps to statically link the cgi against the oracle libraries and then deploy.
If that works, your CGI will contain the libs in the binary itself. No need to deploy anything other.
To link statically, you have to comment out {$Define LinkDynamically} in the oracleconnection.pp unit.
I suggest you make a copy of it in your source directory and modify the copy instead of the original in the sqldb package,
Code: Pascal  [Select]
  1. unit oracleconnection;
  2.  
  3. {
  4.     Copyright (c) 2006-2014 by Joost van der Sluis, FPC contributors
  5.  
  6.     Oracle RDBMS connector using the OCI protocol
  7.  
  8.     See the file COPYING.FPC, included in this distribution,
  9.     for details about the copyright.
  10.  
  11.  **********************************************************************}
  12.  
  13. {$mode objfpc}{$H+}
  14.  
  15. {.$Define LinkDynamically}  //the dot makes the libs linked in statically.
  16.  
« Last Edit: October 10, 2016, 08:48:05 am by Thaddy »
Hamlet 1.4 (nothing wrong with the Danish, btw)

reminder2k1

  • New member
  • *
  • Posts: 5
Re: Can't connect to Remote Oracle DB from Linux fbc-web CGI
« Reply #3 on: June 11, 2019, 03:39:37 pm »
what is solution for this problem? I found the same problem...
« Last Edit: June 12, 2019, 12:39:05 am by reminder2k1 »

Thaddy

  • Hero Member
  • *****
  • Posts: 7991
Re: Can't connect to Remote Oracle DB from Linux fbc-web CGI
« Reply #4 on: June 11, 2019, 04:40:50 pm »
Oh, well, I answered that correctly almost two years ago.... You need an Oracle license to obtain the static binaries, though.
Hamlet 1.4 (nothing wrong with the Danish, btw)