Oracle Data Access Components 3.60 Copyright 1997-2001, Core Lab. All Rights Reserved --------------------------------------------------Oracle Data Access Components (ODAC) library offers some nonvisual components for Borland Delphi, C++ Builder and Kylix. They serve for access to Oracle RDBMS. ODAC is an alternative to standard way processing data by Borland Database Engine (BDE).ODAC uses Oracle Call Interface (OCI) directly. The Oracle Call Interface is an application programming interface (API) that allows an application developer to use a third-generation language's native procedure or function calls to access the Oracle database server and control all phases of SQL statement execution. The OCI provides a library of standard database access and retrieval functions in the form of a dynamic runtime library, ORA*.DLL, that can be linked in by the application. Also with Net option ODAC allows to connect without Oracle client software installed on workstation. In such case ODAC requires only TCP/IP protocol and allows to build really thin database application.
Using BDE in Oracle oriented client/server applications has some deficiencies. So in consequence of BDE community get unable server specific features, use more resources, reduce speed of processing data, cumbrous distribution of an application and its administration.In case of using BDE transfer way of data is:[Oracle RDBMS] <> [SQL*Net] <> [OCI] <> [SQL Links] <> [BDE] <> [Application]ODAC works directly through Oracle Call Interface. It allows to avoid using BDE and SQL Links: [Oracle RDBMS] <> [SQL*Net] <> [OCI] <> [Application]ODAC Net provides optimal transfer way: [Oracle RDBMS] <> [TCP/IP] <> [Application]Version 3.50 of ODAC includes following components: TOraSession - controls server connection; TMemDataSet - base class for TOraDataSet and TVirtualTable; TOraDatSet - base class for TOraQuery and TSmartQuery; TOraQuery - queries execution, operates record set, flexible way updating database tables; TSmartQuery - easy in using and an alternative to TOraQuery, automatically builds INSERT, DELETE, UPDATE queries, automatic locking and refreshing records; TOraSQL - executes SQL statements, PL/SQL blocks, stored procedure; TOraPackage - allows to execute package procedures and functions and provides access to package variables; TOraTable - allows to retrieve and update data single table without writing SQL statement; TOraStoredProc - executes stored procedures and functions, allows to edit cursor data returned as parameter; TOraNestedTable - controls nested table's data; TOraProvider - provides data to and applies updates from a client dataset; TOraScript - executes sequence of SQL and PL/SQL statements; TOraAlerter - allows to transfer messages between sessions; TOraLoader - provides quick loading data to Oracle database; TOraSQLMonitor - allows to monitor dynamic SQL executing in ODAC based applications; TOraErrorHandler - translates error messages; TBDESession - allows to integrate ODAC components into BDE based application; TConnectDialog - serves for enter username, password and server name; TCRDBGrid - extends TDBGrid capabilities, provides visual access to filters and incremental search; TVirtualTable - dataset stores data in memory.Using Oracle Data Access gives you the following advantages: - Doesn't require Oracle's software on client side with Net option; - No distributing, installing and configuring the BDE and ODBC; - You can use any Delphi Professional Edition to develop client/server applications; - Enables you to use many Oracle specific features; - Supports Oracle 8 features: BLOB, CLOB and BFile data types, objects, arrays, references, nested tables; - Simplifies data updating; - Offers two way of updating data: more flexible with TOraQuery and more easy with TSmartQuery; - Speeds up fetch record from database; - Provides automatic locking and refreshing records; - Allows to execute longtime stored procedure separated thread; - Advanced design time editors; - Interface (methods, properties) of ODAC components is similar to standard BDE data access components (TDatabase, TQuery, ..); - Supports all data-aware components; - Uses OraTools Add-in to build and check queries with OraDesigner, design and debug PL/SQL blocks with OraDebugger and explore database schemas with OraExplorer; - and so on.Compatibility -------------ODAC supports Oracle 7.3, 8.0, 8i and 9i, including Personal and Lite.Note: ODAC for Delphi 4 requires Update Pack 3 (Delphi 4 Build 5.108).Installation ------------Since ODAC 3.20 run- and design-time packages are separated. ODAC installer copies these files to folders where they should be resided. odacXX.bpl - ODAC run-time package (located in Windows\System folder) dclodacXX.bpl - ODAC design-time package (located in Delphi\bin folder) oraprovXX.bpl - TOraProvider component (located in Delphi\bin folder) crcontrolsXX.bpl - TCRDBGrid component (located in Delphi\bin folder) Delphi To compile ODAC based application add $(DELPHI)\ODAC\Lib to Project Options|Search path. C++ Builder To compile ODAC based application add $(BCB)\ODAC\Lib to Project Options|Library path and $(BCB)\ODAC\Include to Project Options|Include path. Kylix Select the Kylix Component/Install Packages menu. Press the Add button and select the bplodac.so file from the odac directory and press OK. Now components are available in the Oracle Access group. Add odac/lib directory to Search Path of your project. TOraProvider component If you use Delphi or C++ Builder Enterprise edition you can install TOraProvider component separately. To do it compile and install oraprovXX.bpk package. OraTools add-in Since ODAC 3.50 there is no design-time package oratoolsXX.bpl. OraTools now provided as a separate add-in. It is installed once and can be used by Delphi and C++ Builder. Kylix is not supported by now.Trial version restrictions -------------------------- Note following restrictions when using ODAC trial version: - when running ODAC based application IDE should be running either - if Net option is on only six fields are available in TOraDataSet
连接方式和连接SQL一样,只是用的驱动不一样!!
用ODBC中的哪种方法可以不用安装客户端!??
然后连接字符串可以这样写(ADO的方式,我的Oracle是9i版的):
"Provider=OraOLEDB.Oracle.1;Persist Security Info=True;User ID=登录用户名;Password=登录密码;Data Source=数据库服务名",其中Provider部分也可以写成MSDAORA.1,但根据我的经验这个驱动经常出错。
搞定!
配置Oracle的,Net Configuration assistant建立网络数据库服务器的VHF
具体配置,不同Oracle版本不同,8.05和8i就不一样。
不过就是建立一个本地网络服务名,网络服务名字为你安装时候的数据库名字
默认是ORCL,用TCP/IP连接,然后输入IP地址或者你的配置文件名字。
然后就是测试,通过之后为这个连起一个你喜欢的名字。
Oracle部分就OK了。
之后
进入Delphi用 BDE,ADO,DBExpress
看你的需要,BDE连接复杂一点,
要到BDE里面建立一个Oracle的连接驱动
以ADO为例子:
你放置好了Connection
到了选择驱动画面:你选择
Oracle provide For OLE DB
然后出现一个下一个画面:
DataSource:就是你刚刚建立的VHF名字
输入User_Name和Password测试连接就可以了
Copyright 1997-2001, Core Lab. All Rights Reserved
--------------------------------------------------Oracle Data Access Components (ODAC) library offers some nonvisual
components for Borland Delphi, C++ Builder and Kylix. They serve
for access to Oracle RDBMS. ODAC is an alternative to standard
way processing data by Borland Database Engine (BDE).ODAC uses Oracle Call Interface (OCI) directly. The Oracle Call
Interface is an application programming interface (API) that allows
an application developer to use a third-generation language's native
procedure or function calls to access the Oracle database server and
control all phases of SQL statement execution. The OCI provides a
library of standard database access and retrieval functions in the
form of a dynamic runtime library, ORA*.DLL, that can be linked in
by the application.
Also with Net option ODAC allows to connect without Oracle client
software installed on workstation. In such case ODAC requires only
TCP/IP protocol and allows to build really thin database application.
Using BDE in Oracle oriented client/server applications has some
deficiencies. So in consequence of BDE community get unable server
specific features, use more resources, reduce speed of processing
data, cumbrous distribution of an application and its administration.In case of using BDE transfer way of data is:[Oracle RDBMS] <> [SQL*Net] <> [OCI] <> [SQL Links] <> [BDE] <> [Application]ODAC works directly through Oracle Call Interface. It allows to
avoid using BDE and SQL Links: [Oracle RDBMS] <> [SQL*Net] <> [OCI] <> [Application]ODAC Net provides optimal transfer way: [Oracle RDBMS] <> [TCP/IP] <> [Application]Version 3.50 of ODAC includes following components: TOraSession - controls server connection;
TMemDataSet - base class for TOraDataSet and TVirtualTable;
TOraDatSet - base class for TOraQuery and TSmartQuery;
TOraQuery - queries execution, operates record set, flexible way
updating database tables;
TSmartQuery - easy in using and an alternative to TOraQuery,
automatically builds INSERT, DELETE, UPDATE queries, automatic
locking and refreshing records;
TOraSQL - executes SQL statements, PL/SQL blocks, stored procedure;
TOraPackage - allows to execute package procedures and functions and
provides access to package variables;
TOraTable - allows to retrieve and update data single table without
writing SQL statement;
TOraStoredProc - executes stored procedures and functions, allows
to edit cursor data returned as parameter;
TOraNestedTable - controls nested table's data;
TOraProvider - provides data to and applies updates from a client
dataset;
TOraScript - executes sequence of SQL and PL/SQL statements;
TOraAlerter - allows to transfer messages between sessions;
TOraLoader - provides quick loading data to Oracle database;
TOraSQLMonitor - allows to monitor dynamic SQL executing in ODAC
based applications;
TOraErrorHandler - translates error messages;
TBDESession - allows to integrate ODAC components into BDE based
application;
TConnectDialog - serves for enter username, password and server name;
TCRDBGrid - extends TDBGrid capabilities, provides visual access to
filters and incremental search;
TVirtualTable - dataset stores data in memory.Using Oracle Data Access gives you the following advantages: - Doesn't require Oracle's software on client side with Net option;
- No distributing, installing and configuring the BDE and ODBC;
- You can use any Delphi Professional Edition to develop
client/server applications;
- Enables you to use many Oracle specific features;
- Supports Oracle 8 features: BLOB, CLOB and BFile data types,
objects, arrays, references, nested tables;
- Simplifies data updating;
- Offers two way of updating data: more flexible with TOraQuery and
more easy with TSmartQuery;
- Speeds up fetch record from database;
- Provides automatic locking and refreshing records;
- Allows to execute longtime stored procedure separated thread;
- Advanced design time editors;
- Interface (methods, properties) of ODAC components is similar
to standard BDE data access components (TDatabase, TQuery, ..);
- Supports all data-aware components;
- Uses OraTools Add-in to build and check queries with OraDesigner,
design and debug PL/SQL blocks with OraDebugger and explore
database schemas with OraExplorer;
- and so on.Compatibility
-------------ODAC supports Oracle 7.3, 8.0, 8i and 9i, including Personal and Lite.Note: ODAC for Delphi 4 requires Update Pack 3 (Delphi 4 Build 5.108).Installation
------------Since ODAC 3.20 run- and design-time packages are separated.
ODAC installer copies these files to folders where they should be resided. odacXX.bpl - ODAC run-time package (located in Windows\System folder)
dclodacXX.bpl - ODAC design-time package (located in Delphi\bin folder)
oraprovXX.bpl - TOraProvider component (located in Delphi\bin folder)
crcontrolsXX.bpl - TCRDBGrid component (located in Delphi\bin folder) Delphi To compile ODAC based application add $(DELPHI)\ODAC\Lib to Project
Options|Search path. C++ Builder To compile ODAC based application add $(BCB)\ODAC\Lib to
Project Options|Library path and $(BCB)\ODAC\Include to
Project Options|Include path. Kylix Select the Kylix Component/Install Packages menu. Press the Add
button and select the bplodac.so file from the odac directory and
press OK. Now components are available in the Oracle Access group.
Add odac/lib directory to Search Path of your project. TOraProvider component If you use Delphi or C++ Builder Enterprise edition you can install
TOraProvider component separately. To do it compile and install
oraprovXX.bpk package. OraTools add-in Since ODAC 3.50 there is no design-time package oratoolsXX.bpl.
OraTools now provided as a separate add-in. It is installed once
and can be used by Delphi and C++ Builder. Kylix is not supported
by now.Trial version restrictions
--------------------------
Note following restrictions when using ODAC trial version:
- when running ODAC based application IDE should be running either
- if Net option is on only six fields are available in TOraDataSet
1.在安装了Oracle客户端程序后,在Oracle安装目录下有如下目录和文件是连接Oracle数据库服务器所必需的:(最好保持目录层次关系结构)
2.Oracle\BIN及子目录文件,并且保证应用程序可以找到该目录,即该目录为系统目录或者PATH目录。
3.Oracle\OCOMMON\NLS\ADMIN目录以及其下所有文件
4.Oracle\OCOMMON\NLS\MESG目录以及其下所有文件
5.Oracle\NETWORK\ADMIN\tnsnames.ora 这个文件是配置网络服务名用的
可以用记事本打开,改为正确的配置。
6.Oracle\ORACORE\Mesg以及其下所有MSB文件 7.导入注册表到客户机:
REGEDIT5
[HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE]
"inst_loc"="C:\\Program Files\\Oracle\\Inventory"
"ORACLE_HOME"="D:\\oracle\\ora81"
"ORACLE_HOME_NAME"="OraHome81"
"API"="D:\\oracle\\ora81\\dbs"
"ORACLE_GROUP_NAME"="Oracle - OraHome81"
"NLS_LANG"="NA"
"OLEDB"="D:\\oracle\\ora81\\oledb\\mesg"
"VOBHOME2.0"="D:\\oracle\\ora81"
"OO4O"="D:\\oracle\\ora81\\oo4o\\mesg" [HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\ALL_HOMES]
"HOME_COUNTER"="1"
"DEFAULT_HOME"="OraHome81"
"LAST_HOME"="0" [HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\ALL_HOMES\ID0]
"NAME"="OraHome81"
"PATH"="D:\\oracle\\ora81"
"NLS_LANG"="NA" [HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME0]
"ID"="0"
"ORACLE_GROUP_NAME"="Oracle - OraHome81"
"ORACLE_HOME_NAME"="OraHome81"
"ORACLE_HOME"="D:\\oracle\\ora81"
"NLS_LANG"="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
"ORACLE_SID"="QIAODB" //这个要和服务器的sid一致
"ORACLE_HOME_KEY"="Software\\ORACLE\\HOME0"
"SQLPATH"="D:\\oracle\\ora81\\dbs"
"ORACLE_BASE"="D:\\oracle"
"MSHELP_TOOLS"="D:\\oracle\\ora81\\MSHELP"
"RDBMS_CONTROL"="D:\\oracle\\ora81\\DATABASE"
"RDBMS_ARCHIVE"="D:\\oracle\\ora81\\DATABASE\\ARCHIVE"
注册表信息要把目录改成相应的目录,
我用的Oracle817整个客户端大概30M左右(没有压缩)。
所以速度和性能都比BDE,ADO,ODBC要好,不过中文资料比较少。DOA我应用于C/S的项目过,
效果很好。其他不做评价。
ADO和BDE,DOA好像都要装oracle客户端。BDE配置更麻烦一些。
ODAC可以不装客户端。
但据说ODAC和DOA性能不太好。听说,我自己也不清楚。
个人感觉用D做Oracle项目用webservice好一些。可以解决程序发布的问题。不然太麻烦了。