[solved] Connect Oracle DB from Linux

Forum related to Oracle Server

Moderators: gto, EgonHugeist, mdaems

JohnML1
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 12.03.2015, 08:34

[solved] Connect Oracle DB from Linux

Postby JohnML1 » 08.06.2017, 18:51

do i have to go this way???

Development with Lazarus svn and Zeoslib svn.

Oracle Database runs on Windows Server and i want to connect from a linux Debian Client:

The only functional effort was:

Download and install Oracle Client.

Setup ZConnection.LibraryPath

Startup my Application from within a shell-script:

Code: Select all


export LD_LIBRARY_PATH=/usr/lib/oracle.../libcint.so
./my_application





That was ok, i could execute some SQL-statement

But i'm shure that could be achieved much easier?!!

In Lazarus we have a SqlConnection that connects without any oracle Client installed.

On Windows XP i just have to define ZConnection.Database := server:port/ServiceName

Just curious what i'm missing on my Linux -> Windows Orcale connection.

Tipps are welcome :-)

btw.:
Lazarus SQLConnection doesn't handle German Umlauts as ä ü ö so i can't use it :-(

Thank you for ZeosLib !!!
Last edited by JohnML1 on 20.07.2017, 09:03, edited 1 time in total.

marsupilami
Gold Boarder
Gold Boarder
Posts: 552
Joined: 17.01.2011, 14:17

Re: Connect Oracle DB from Linux

Postby marsupilami » 09.06.2017, 11:27

Hello JohnML1,

I will have to set up some computer where I can test this. Just for the record: When you say Zeos from SVN you mean Zeos 7.2 from SVN?

With best regards,

Jan

JohnML1
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 12.03.2015, 08:34

Re: Connect Oracle DB from Linux

Postby JohnML1 » 09.06.2017, 15:38

thank you for your quick answer:

I'm no expert at all but TortoiseSVN tells me:

Merged revision(s) 3951-3974 from branches/testing-7.2:
Fixes a bug in the PostgreSQL driver that keeps it from changing transaction isolation...
fix for https://sourceforge.net/p/zeoslib/tickets/183/
fix for https://sourceforge.net/p/zeoslib/tickets/183/
D7 compiles again and Range checks are disable for RowAccessor
in order to think about nextgen(no raw string) -> switch ZFormatSettings to String
apply patch of https://sourceforge.net/p/zeoslib/tickets/187/ harmless
implemet stivies patch for multiple mysql stmts see: viewtopic.php?f=36&t=3098
close memleak of TZConnectionGroup see: https://sourceforge.net/p/zeoslib/tickets/191/
bind int val if fBindOrdinalBoolValues is set see: https://sourceforge.net/p/zeoslib/tickets/157/
omit 7.3 define from 7.2 inc and add some defines for NextGen
shrink two defines
apply patch of https://sourceforge.net/p/zeoslib/tickets/171/
handle the Refresh issue if Field order has been changed
see https://sourceforge.net/p/zeoslib/tickets/74/
Fix broken DateFormats after changing the TZFormatSettings
drop some GENERIC_INDEX defines
add a small Refresh for latest fix
update Cols after solving the Refresh issue was broken
omit the DataEvent override again -> see viewtopic.php?f=40&p=84699&sid=c71906ddb4a2c115ab4b8cc8194ace0f#p84699

hope you find the needed information

JohnML1
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 12.03.2015, 08:34

Re: Connect Oracle DB from Linux

Postby JohnML1 » 04.07.2017, 10:28

Hi marsupilami,

just curious ...

Did you manage to set up your Test environment?

marsupilami
Gold Boarder
Gold Boarder
Posts: 552
Joined: 17.01.2011, 14:17

Re: Connect Oracle DB from Linux

Postby marsupilami » 06.07.2017, 10:01

Hello John,

unfortunately I didn't get around to prepariung a testenvironment yet. Work has kept me quite busy unfortunately.

But I have one question: Do things work if you use the LibraryLocation property of the ZConnection without setting LD_LIBRARY_PATH? /usr/lib/oracle/... seems to be a non standrd path so the linker is expected to have trouble.
I wonder, how the Lazarus SQL components handle these things...

With best regards,

Jan

JohnML1
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 12.03.2015, 08:34

Re: Connect Oracle DB from Linux

Postby JohnML1 » 10.07.2017, 13:46

marsupilami wrote:But I have one question: Do things work if you use the LibraryLocation property of the ZConnection without setting LD_LIBRARY_PATH? /usr/lib/oracle/... seems to be a non standrd path so the linker is expected to have trouble.
I wonder, how the Lazarus SQL components handle these things...


Sorry, forgot to deliver these information:

Result: no success

With these error messages:

A) With PathName:

Screenshot_LibraryLocation_mit.png


B) just directory:

Screenshot_LibraryLocation_sans.png



p.s. i have to learn to debug Lazarus IDE, perhaps then i can see whats happening behind the scenes?!!

Hope i get notified by mail this time?!!
You do not have the required permissions to view the files attached to this post.

marsupilami
Gold Boarder
Gold Boarder
Posts: 552
Joined: 17.01.2011, 14:17

Re: Connect Oracle DB from Linux

Postby marsupilami » 10.07.2017, 14:54

Hmmm - ok. Your example A leads me to think that the library depends on some other libraries that can not be found. *sigh*....

In example B your use of LibraryLocation is wrong. LibraryLocation is meant to be used to point to the exact library and not to a directory.

So it seems like I have to set up a testing environment finally to check these things.

You don't get notified by E-Mail even if you tick the "Notify me when a reply is posted" checkbox?

JohnML1
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 12.03.2015, 08:34

Re: Connect Oracle DB from Linux

Postby JohnML1 » 11.07.2017, 09:55

i looked again in Oracle docs:

it shows me about LD_LIBRARY_PATH:
See http://tinyurl.com/yd9o36fp

4. Install the libaio package, for example on Oracle Linux, run this as the root user:

yum install libaio

On some Linux distributions the package is called libaio1.

5. Set the environment variable LD_LIBRARY_PATH to the directory created in Step 2, for example:

export LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2:$LD_LIBRARY_PATH

Alternatively, add this path to an ldconfig configuration file if there is no other Oracle software that will be impacted.


************************************

Lazarus SQLConnection needs libociei.so as error message shows.

************************************
Other topic:
Google Chrome does not accept ZeosLib Homepage on Sourcerforge. -> unsafe -> does not show the Login-Dialog. I don't know if someone can fix that?!

************************************

I hope these message is somehow useful?!!

************************************

mhmhm: in which situations do i need tnsnames.ora? Seems to be obsolet if i use the Connection-string server:1521/ServiceName?!

I'm just a hobbyist, so sorry for these questions :-)

marsupilami
Gold Boarder
Gold Boarder
Posts: 552
Joined: 17.01.2011, 14:17

Re: Connect Oracle DB from Linux

Postby marsupilami » 11.07.2017, 15:21

Hello John,

JohnML1 wrote:i looked again in Oracle docs:

it shows me about LD_LIBRARY_PATH:
See http://tinyurl.com/yd9o36fp

[...]
5. Set the environment variable LD_LIBRARY_PATH to the directory created in Step 2, for example:

export LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2:$LD_LIBRARY_PATH

Alternatively, add this path to an ldconfig configuration file if there is no other Oracle software that will be impacted.


This step number 5 seems to be important for me. This is a part that Zeos cannot solve on its own. I wouldn't be surprised if you don't need to specify the library location in the TZConnection object anymore when you have done this.

JohnML1 wrote:Other topic:
Google Chrome does not accept ZeosLib Homepage on Sourcerforge. -> unsafe -> does not show the Login-Dialog. I don't know if someone can fix that?!

************************************

I hope these message is somehow useful?!!

************************************

The Zeos Forums don't use SSL and I assume that Chrome doesn't want you to send a username and a password over unsafe connections. Sourceforge offers SSL but I am not sure what the implications for the forums software would be if we just switch that on.

JohnML1 wrote:mhmhm: in which situations do i need tnsnames.ora? Seems to be obsolet if i use the Connection-string server:1521/ServiceName?!

Duh - I am no expert on Oracle. I try to avoid this database as much as possible. I am sure that tnsnames.ora is for systems where you cannot configure a connection name. Let's say you write an application where you specify that a connection name of MyApplicationName has to exist. This way you can configure the MyApplicaionName connection in the tnsnames.ora and don't need to worry about any other parameters one might need to setup because they are specified in the tnsnames.ora. You simply don't care wether communication is done over tcp/ip or shared memory or via smoke signs or a carrier pigeon. ;)

JohnML1 wrote:I'm just a hobbyist, so sorry for these questions :-)

Don't worry. But honestly I wonder why you bother with oracle at all if you just do this as a hobby. :)

With best regards,

Jan

JohnML1
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 12.03.2015, 08:34

Re: Connect Oracle DB from Linux

Postby JohnML1 » 12.07.2017, 09:16

Thank you, i think my first post-question has an answer:

A) I need oracle client installed to connect from Linux a Win Oracle Database!

B) I have to start my application from within a bash script where:
export LD_LIBRARY_PATH is defined pointing to the lib-directory of installed Oracle Client.

Code: Select all

#! /bin/bash

export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib
./project1


p.s.:
I developed with Lazarus on Win XP an application to retrieve Data from oracale DB on Windows Server.

I thought: Lazarus is cross-compiling, lets try if i can do the same from my Debian Sid ... and the journey began :-)

My big mistake at this point: i thought it could be sufficient if my App just sends the SQL-String to Server:1521/ServiceName
But that's wrong, we need Oracle Client at this point, on Win XP also!!

Thanks for your effort!!

Regards

JohnML


Return to “Oracle”

Who is online

Users browsing this forum: No registered users and 1 guest