AnyDAC
ContentsIndexHome
PreviousUpNext
Connect to Oracle Server

Describes how to connect to Oracle Server.

Group
Links
Supported versions

The AnyDAC native driver supports Oracle Enterprise, Standard (ex Workgroup) and Express (ex Personal) server editions version 8.0.3 and higher. Read "Using Oracle with AnyDAC" chapter for detailed discussion of Oracle usage in AnyDAC for Delphi application. 

 

Windows client software

AnyDAC requires one of the following Oracle x86 or x64 client software types to be installed on the workstation:

  • "Fat" Oracle Client (details). It requires the standard install procedure. The driver uses the client that is installed in the primary Oracle Home, if not specified explicitly.
  • "Thin" Oracle Instant Client (details). The driver uses the client, which is either copied into a folder in the PATH or into the application EXE folder, if not specified explicitly. See "Using Instant Client" below.

When the Oracle client software has not been properly installed, you will get an exception when trying to connect: 

 

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

 

Linux client software

AnyDAC requires:

  • the libclntsh.so x86 or x64 client library.

To install on Linux read the article

 

Mac OS X client software

AnyDAC requires:

  • the libclntsh.dylib x86 client library.

You can download it as Instant Client for Mac OS X (here) (more). Then extract and copy content to /usr/local/lib folder, using the commands: 

 

sudo cp * /usr/local/lib
sudo ln -s /usr/local/lib/libclntsh.dylib.10.1 /usr/local/lib/libclntsh.dylib

 

You can put tnsnames.ora and sqlnet.ora to /etc folder, using the command: 

 

sudo cp *.ora /etc

 

Driver linkage

To link the driver:

 

Connection definition parameters

To connect to an Oracle DBMS, most applications will need to specify DriverID, Database, User_Name and Password

 

DriverID=Ora  

Parameter 
Description 
Example value 
Database 
The value may be one of the following:
  • TNS alias name, specifying which database to connect to.
  • TNS connection descriptor, as it is in TNSNames.ora
  • Oracle connection string, as it is in SQL*Plus.
  • Oracle easy connect string, as it is described here.
 
  • OraSrv
  • (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = OraSrv)(PORT = 1521)))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = orcl)))
  • scott/tiger@OraSrv
  • system/manager@OraSrv as sysdba
  • OraSrv:1521/orcl
 
OSAuthent 
Specify Yes to use OS authentification, and No to use the DBMS authentification. 
No 
User_Name 
The Oracle user name, if OSAuthent=No 
Scott 
Password 
The Oracle user password, if OSAuthent=No 
tiger 
AuthMode 
The Oracle authentification mode:
  • Normal - standard user. Default value.
  • SysDBA - user with database administrator privileges.
  • SysOper - user with database operator privileges.
 
Normal 
CharacterSet 
The character set for the connection. If not specified, the NLS_LANG variable value will be used. 
  • UTF8
  • cl8mswin1251
 
BooleanFormat 
Defines how to represent Boolean values:
  • Integer - represents Boolean as Integer values, where False = 0 and True = 1. The default mode.
  • String - represents Boolean as String values, where False = 'F' and True = 'T'.
 
String 
ApplicationName 
Name of the application. If specified, this value is stored in the V$SESSION column MODULE. 
AllBooks 
OracleAdvanced 
Additional Oracle session options. See the ALTER SESSION SET chapter "Initialization Parameters and ALTER SESSION" paragraph for details. A value format is - <option>=<value>[;...]. 
 
NewPassword 
Specifies new Oracle user password. AnyDAC will connect to the DB using the old password and immediately change it to the new one. 
tiger2 
MetaDefSchema 
Specifies the default schema for the application. The design time code will omit the schema name in object names if it is equal to MetaDefSchema. 
SCOTT 

 

Using Instant Client

To install Instant Client, download the Oracle Instant x86 or x64 client archive, unpack it and copy the files:

  • oci.dll
  • oraocci11.dll
  • oraociei11.dll
  • orasql11.dll

into your application EXE folder or into a folder in the PATH. 

When you are using TNS names, put tnsnames.ora file into the same folder, or set TADPhysOracleDriverLink.TNSAdmin property value to a folder path with tnsnames.ora. Or use TNSAdmin driver configuration parameter. 

Set TADPhysOracleDriverLink.NLSLang to the required value. Or use NLSLang driver configuration parameter. 

 

Usage cases
  • Connect to a database using predefined TNS name (stored in tnsnames.ora):

 

DriverID=Ora
Database=ORA_920_APP
User_Name=ADDemo
Password=a

 

  • Connect to a database using host, port and instance name info:

 

DriverID=Ora
Database=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = OraSrv)(PORT = 1521)))
(CONNECT_DATA = (SERVER =    DEDICATED)(SERVICE_NAME = orcl)))
User_Name=ADDemo
Password=a

 

  • Connect to a local database as sysdba:

 

DriverID=Ora
User_Name=sys
AuthMode=sysdba

 

  • Connect to a database using TNS name and change the password:

 

DriverID=Ora
Database=ORA_920_APP
User_Name=ADDemo
Password=a
NewPassword=b

 

  • Connect to a database using easy connect string:

 

DriverID=Ora
Database=OraSrv:1521/orcl
User_Name=ADDemo
Password=a
What do you think about this topic? Send feedback!