1
votes

Is there any way I can connect my Delphi application (FireDac) to an Oracle database directly?

Currently I can make the connection, but I need to install Oracle Client

on the embarcadero site (http://docwiki.embarcadero.com/RADStudio/Rio/en/Connect_to_Oracle_Server_(FireDAC)) only shows how to connect to the installed client.

I generated a demo that connects using host, port and instance name.

on the machine that the installed client works perfect. already in the machine that does not have the client, even with all the dll, does not connect, presenting the following error:

[FireDAC] [Phys] [Ora] -1309. OCI is not properly installed on this machine (NOE1 / INIT).

even the dll oci.dll being in the same directory as the application,

follows code for connection:

procedure TForm1.btnConectarClick(Sender: TObject);
begin
   conDados.Close;
   conDados.Params.DriverID := 'Ora';
   conDados.Params.Database := '(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.xxx)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = SMARTSRV)))';
   conDados.Params.UserName := 'xxxxx';
   conDados.Params.Password := 'xxxxx';
   conDados.Open();
end;

Another setting that did not work either

   conDados.Close;
   // conDados.Params.DriverID := 'Ora';
   // conDados.Params.Database := '(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.xxx)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = xxx)))';
   // conDados.Params.UserName := 'xxx';
   // conDados.Params.Password := 'xxx';
   conDados.Params.DriverID := 'Ora';
   conDados.Params.Database := '192.168.0.xxx:1521/xxx';
   conDados.Params.Values['OSAuthent'] := 'No';
   conDados.Params.UserName := 'xxx';
   conDados.Params.Password := 'xxx';
   conDados.Params.Values['CharacterSet'] := 'UTF8';
   odlDados.DriverID := 'Ora';
   odlDados.NLSLang := 'AMERICAN_AMERICA.WE8ISO8859P1';
   odlDados.VendorHome := ExtractFileDir(Application.ExeName);
   odlDados.VendorLib := ExtractFilePath(Application.ExeName) + 'oci.dll';
   conDados.Open();

Is there any way I can connect my Delphi application (FireDac) to an Oracle database directly?

Thanks

6

6 Answers

3
votes

The full Oracle Client has indeed a huge footprint (hunderths of MB), and expects to be installed before the application.

You can use the Oracle Instant Client alternative. It is a cut-down version, giving access to only the OCI library/dll (for the Basic Light edition), which requires no installation: just copy the dlls with your exe. It is supported by Oracle, gives high performance and best stability. We don't fully trust "direct TCP connection" clients written in pascal, which save a few MB, but are not certified by Oracle - if a lot of money is paid for using Oracle, you can afford the few MB of disk storage to have a 100% Oracle connection chain.

This is what we use with our Open Source SynDBOracle library, but FireDAC also officially supports it.

If you want to reduce the client footprint even more, consider switching from RAD to a REST architecture, and keep the Oracle connection on your application service side. Plain HTTPS + JSON will require no library whatsoever on the client side, easy scale to thousands of simultaneous connections (with the proper framework), and allow even JavaScript clients. Worth a direction to look into.

1
votes

Have you tried the Enterprise Connectors (based on FireDAC)? https://www.embarcadero.com/products/enterprise-connectors/enterprise-connectors

Here is more information on the Oracle connector: https://www.cdata.com/drivers/oracledb/firedac/

1
votes

For this you will ne to use proper database driver that does not require use of Oracle Client.

Luckily dbExpress provides a suitable driver for accessing Oracle databases directly through TCP/IP without Oracle Client

https://www.devart.com/dbx/oracle/

But dbExpress isn't for free and will thus increase the cost of developing of your application.

1
votes

please tell me you install oracle client 32 bit or 64 bit.which option do you install oracle client(administrator, runtime, instant client, custom)

i use win 7 64 bit, oracle database 18c,rad studio delphi 10.3 in the same computer.

i just install oracle client win 64 bit.but still get that error [FireDAC] [Phys] [Ora] -1309. OCI is not properly installed on this machine (NOE1 / INIT).

1
votes

after other attempts, we find that the error is generated by the msvcr120.dll dll, but it is not described in the error.

we installed the following microsoft software and everything worked correctly.

Visual C++ Redistributable Packages for Visual Studio 2013

1
votes

I dont know if you already solve it, but I've noticed that you forgot to setup the tnsnames.ora file.

Something similiar to this:

#ALIAS# =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = #ORACLE_IP#)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = #SERVICE#)
    )
  )

Replace the values with ## by your oracle configuration and save the file in the same directory of instant client.