How to connect to Oracle 11g database with Direct mode? URGENT

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
stevel
Posts: 125
Joined: Tue 02 Nov 2010 19:01

How to connect to Oracle 11g database with Direct mode? URGENT

Post by stevel » Fri 18 Feb 2022 20:36

Using: UniDAC v9.1.1 / Delphi 10.2.3 Tokyo / Win32 VCL Forms application

1. I've installed Oracle 11g Express Edition database on a Windows 10 virtual machine in VMWare Workstation. The Windows Firewall is switched off, allowing all incoming network connections.

2. From the host machine, I am able to connect to the Oracle database running in the VM using Embarcadero Rapid SQL 2016 database management tool, indicating that database connectivity between a remote client and the Oracle database server is working okay.

For the Oracle 11g XE database installation, post installation, I have enabled the default `HR` user, set a new password. I've connected with this username from the Rapid SQL database client running on the host PC, and confirmed that the connection is working successfully.

Note that on host machine (where Rapid SQL and Delphi are installed), there is no Oracle client software installed. Perhaps the Rapid SQL tool is using its own set of bundled Oracle client connection library files (*.DLL) to establish connectivity.

3. From the host machine, in Delphi, I created a new project, dropped a TUniConnection and TOracleUniProvider on a form, and then set the UniConnection's provider name property to `Oracle`, and the Server, UserName and Password properties. Then, in SpecificOptions, I set set Direct=True, and HomeName=xe. The `Server` property is set to the hostname of the Windows 10 instance running in the VM.

I found the parameter value `xe` for the HomeName option (UniConnection.SpecificOptions) from the Windows Registry key (HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_XE\ORACLE_HOME_NAME), as suggested in discussion on a tech support page explaining use of the `HomeName` connection option when connecting to Oracle database (11g).

However, when I try to connect by setting Connected =True, I get this error:
ORA-12505: TNS:listener does not currently know of SID given in connect descriptor.

What do I need to do in order so that UniConnection can connect okay to the Oracle database server? Is my configuration lacking any steps that need to be performed? Do I need to install the Oracle Database Client (Oracle Database Client 11g Winx86_64, 652MB download file containing an installer)? If Yes, then would Oracle Instant Client do (Oracle Instant Client Basic Winx86_64, 48MB download zip file containing library files) instead? If so, then is there any additional post-installation configuration that needs to be done, eg. editing and setting configuration files? If No (no need to install additional Oracle client library software), then that means something is missing from my configuration on the client (Delphi / UniDAC) side. I'm not sure what could be the issue, and could not find any related earlier posts on the UniDAC forum. Could you help me? Thanks in advance!

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: How to connect to Oracle 11g database with Direct mode? URGENT

Post by MaximG » Thu 24 Feb 2022 12:38

When using the Direct mode, you don't have to set the HomeName property or install any additional components.
The Direct mode is embedded in our components. Please try to specify the server address as follows: servername:1521:sn=XE, where servername is the hostname of the Windows 10 instance running in the VM.

Post Reply