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 :-)
Oracle connection issue / question
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: Oracle connection issue / question
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
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
Re: Oracle connection issue / question
@Nebulus,
through a library / dll
I am using:
Database: Server Name
LibraryLocation: C:\instantclient\oci.dll
Michal
through a library / dll
I am using:
Database: Server Name
LibraryLocation: C:\instantclient\oci.dll
Michal
Re: Oracle connection issue / question
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)
)
)
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.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Re: Oracle connection issue / question
Thanks for all the support, I thik i messed around mith my env. variables , 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 :-)
I'll play around with it next week
Thanks again for the precious hints :-)