Lazarus

Programming => Databases => Topic started by: Jumpy on October 07, 2016, 11:50:42 am

Title: Can't connect to Remote Oracle DB from Linux fbc-web CGI
Post by: Jumpy 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 (http://www.delphipraxis.net/190475-keine-verbindung-zu-remote-oracle-db-von-einer-linux-fbc-web-cgi.html)
Title: Re: Can't connect to Remote Oracle DB from Linux fbc-web CGI
Post by: Jumpy on October 10, 2016, 07:38:25 am
Push  :)
Title: Re: Can't connect to Remote Oracle DB from Linux fbc-web CGI
Post by: Thaddy 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.  
Title: Re: Can't connect to Remote Oracle DB from Linux fbc-web CGI
Post by: reminder2k1 on June 11, 2019, 03:39:37 pm
what is solution for this problem? I found the same problem...
Title: Re: Can't connect to Remote Oracle DB from Linux fbc-web CGI
Post by: Thaddy 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.
TinyPortal © 2005-2018