Examples of Devart UniDac connecting to Oracle database

Examples of Devart Unidac connecting to an Oracle database using Oracle Client and direct connection (no Oracle Client) Unidac can connect to an Oracle database in a few different ways.  Ill show the property settings to connect to some of these, using direct and client connection, and with / without Oracle client entries. This presumes that you know the basics of the configuring the Oracle Client, so I wont explain how to configure the tnsnames.ora file. For these examples – the database server name is HRPROD – the database name is HR – the client port is 1521.  This is the default and it can be different – user name is FRED – password is BEDROCK The name of the entry in the tnsnames.ora or LDAP is HRPRODXXX You can use the server ip instead of the server name Add these components to your form or data module
  • OracleUniProvider
  • UniConnection
Change the UniConnection properties as noted below

Oracle Client with a tnsnames.ora or LDAP entry

UniConnection1.ProviderName := ‘Oracle’; UniConnection1.UserName := ‘FRED’; UniConnection1.Password := ‘BEDROCK’; UniConnection1.SpecificOptions.Values[‘Direct’] := ‘False’; UniConnection1.server := ‘HRPRODXXX’;   // tnsname or ldap entry name UniConnection1.database = ”; UniConnection1.port = 0;

Oracle Client without a tnsnames.ora or LDAP entry

UniConnection1.ProviderName := ‘Oracle’; UniConnection1.UserName := ‘FRED’; UniConnection1.Password := ‘BEDROCK’; UniConnection1.SpecificOptions.Values[‘Direct’] := ‘False’; UniConnection1.server := ‘HRPROD’;  // server name or IP address UniConnection1.database = ‘HR’;     //  if using a service instead of sid use ‘sn=HR’ UniConnection1.port = 1521;  

Direct connect to Oracle database (no Oracle Client)

UniConnection1.ProviderName := ‘Oracle’; UniConnection1.UserName := ‘FRED’; UniConnection1.Password := ‘BEDROCK’; UniConnection1.SpecificOptions.Values[‘Direct’] := ‘True’; UniConnection1.server := ‘HRPROD:1521:HR’;   // for service use ‘HRPROD:1521:sn=HR’ UniConnection1.database = ”; UniConnection1.port = 1521;  

Scott Hollows

  • Oracle & Delphi software developer based in Perth, Western Australia
  • Australian Oracle User Group – National Committee Member
  • Australian Delphi User Group – National Committee Member LinkedIn_Logo

Published by

Leave a comment