Oracle connection issue / question

The offical for ZeosLib 7.3 Report problems, ask for help, post proposals for the new version of Zeoslib 7.3/v8
Quick Info:
-We made two new drivers: odbc(raw and unicode version) and oledb
-GUID domain/field-defined support for FB
-extended error infos of Firebird
-performance ups are still in queue
In future some more feature will arrive, so stay tuned and don't hassitate to help
Post Reply
Nebulus
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 04.02.2021, 14:03

Oracle connection issue / question

Post by Nebulus »

Hi,

I wanted to test the Zeos Component with Lazarus as well as with Delphi on our Oracle Database, but not sure how this is supposed to work, I get an error

Compiled and installed the components, no error.

I dropped a ZConnection on the form and entered these properties:

Database : prod1
HostName : db.orsrv.intra (also tried with IP address)
Port : 1521
Password : xxx
User : xxx
Protocol : oracle

When I click to enable 'Connected' it takes about 15 seconds wait and it says : SQL Error : OCI_ERROR: ORA-12154: TNS ^:could not resolve the connect identifier specified
The TNS string I use in the ODBC config, and that works fine from other programs is : db.orsrv.intra:1521/prod1

is it the wrong way to do or did I forget something ? Is Zeos accessing Oracle natively or through a library / dll ?

Thanks in advance for any good hint :-)
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1935
Joined: 17.01.2011, 14:17

Re: Oracle connection issue / question

Post by marsupilami »

Hello Nebulus,

I very rarely use Oracle, so my advice might be of limited help. I seem to remember that the database property of the TZConnection is linked to entries of the tnsnames.ora. So maybe you have to somehow specify your connection settings in tnsnames.ora and then use that in the database name?

Best regards,

Jan
miab3
Zeos Test Team
Zeos Test Team
Posts: 1310
Joined: 11.05.2012, 12:32
Location: Poland

Re: Oracle connection issue / question

Post by miab3 »

@Nebulus,

through a library / dll

I am using:
Database: Server Name
LibraryLocation: C:\instantclient\oci.dll

Michal
User avatar
aehimself
Zeos Dev Team
Zeos Dev Team
Posts: 786
Joined: 18.11.2018, 17:37
Location: Hungary

Re: Oracle connection issue / question

Post by aehimself »

Jan is right.

oci.dll requires a TNSNames.ora file and an entry for the connection, because... Oracle.
Also, an environment variable must be created on the PC named TNS_ADMIN, pointing to the folder where your TNSNames.ora file is located. E.g.: C:\Oracle\TNSNames.ora -> SET TNS_ADMIN=C:\Oracle

Then, set up Zeos like this:
Database: connection entry name in TNSNames.ora
User / Pass: credentials
Host name can be empty, not used for Oracle. Target is stored in TNSNames.ora
Catalog: the schema name to use. Important for metadata, if multiple schemas exists with same tables / procedures / etc.

An average TNSNames.ora entry will look like this:

IDENTIFIER =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = SOMETHING)
)
)
Delphi 12.1, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmariadb.dll 3.3.8
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.13
- MSSQL 2012, 2019; sybdb.dll FreeTDS_2435
- SQLite 3.45.2
Nebulus
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 04.02.2021, 14:03

Re: Oracle connection issue / question

Post by Nebulus »

Thanks for all the support, I thik i messed around mith my env. variables :shock: , probable reason why it didn't work, discovered I had a similar issue when accessing Orable db through Excel VBA.

I'll play around with it next week

Thanks again for the precious hints :-)
Post Reply