管理与程序设计指南

Net.Data 初始化、控制和宏文件的公用节

为了能够使 Net.Data 的所有组件能够作为一个整体来工作,Net.Data 初始化、配置和宏文件中 的某些部分必须一致。下表概述了这些文件中必须匹配的区域。

表 2. 对于 Net.Data 配置文件和宏的一致性需求
文件 公用节 注解
Net.Data INI 文件 环境语句 使用 Live Connection 的语言环境必须在环境语句中指定数据库 cliette 名称
Live Connection 配置变量 使用 Net.Data Live Connection 时, 需要指定 Live Connection 端口 DTW_CM_PORT。这个变量值必须与 Live Connection 配置文件中的 MAIN_PORT 值相匹配。
高速缓存配置变量 使用 Net.Data 高速缓存时,可以选择包含端口号码和机器名变量。这些 值必须和高速缓存管理器配置文件中所使用的那些值相匹配(如果使用的话)。
Live Connection 配置文件 Cliette 定义 每个 cliette 定义都必须与 INI 文件中相应的定义匹配。另外, MAIN_PORT 值必须与 INI 文件中的 DTW_CM_PORT 变量值匹配。
高速缓存管理器配置文件 高速缓存管理器配置变量 使用 Net.Data 高速缓存时,可以选择包含端口号码和机器名变量。这些 值必须和 INI 文件中所使用的那些值相匹配(如果使用的话)。

以下几段说明了宏、Net.Data 初始化文件和 Live Connection 配置文件之间的关系。两个 cliette 是由 宏使用的 (DTW_SQL:SAMPLE、DTW_SQL:CELDIAL ),它们访问两个名 为 SAMPLECELDIAL 的数据库。 Live Connection 配置文件中包含 cliette 的名称和定义。Net.Data 初始化文件中的 ENVIRONMENT 语句指 cliette 的名称。LOGIN 和 PASSWORD 的值是在 Live Connection 配置文件中指定的。

图 2显示了包含 @DTW_ASSIGN 语句的宏段,该语句定义在访问数据库时 使用哪个 cliette。

图 2. Net.Data 宏段






<3*********************************************>
<3** This is an HTML comment **>
<3** Access the SAMPLE database using **>
<3** cliette DTW_SQL:SAMPLE **>
<3*********************************************>
@DTW_ASSIGN (DATABASE, " SAMPLE ")
@insert_customer
(customer_name, customer_street, customer_city, customer_state,
customer_country, customer_zip, customer_credit, customer_expiry)



<3*********************************************>
<3** This is an HTML comment **>
<3** Process the CELDIAL database using **>
<3** the cliette DTW_SQL:CELDIAL **>
<3*********************************************>
@DTW_ASSIGN (DATABASE, " CELDIAL ")
@insert_customer
(customer_name, customer_street, customer_city, customer_state,
customer_country, customer_zip, customer_credit, customer_expiry)


请注意,DATABASE 配置变量将替换初始化文件的 ENVIRONMENT 语句,从而 生成 cliette 的名称。这允许您从同一个宏访问多个数据库。

图 3显示了包含 ENVIRONMENT 语句和相关 cliette 类型的 Net.Data 初始化文件段。对于初始化文件中的每个 cliette 类型,都有一个 ENVIRONMENT 语句。对于每个数据库 cliette 类型, ENVIRONMENT 语句指定一个 cliette 名称。这个名称是由 cliette 的类型和一个变量引用 $(DATABASE) 组成的,该变量引用是在运行期解析的。每个使用 Live Connection 的语言环境都必须在 ENVIRONMENT 语句中有一个 cliette 的定义。

图 3. Net.Data 初始化文件段






ENVIRONMENT (DTW_SQL)
(IN DATABASE, LOGIN, PASSWORD, TRANSACTION_SCOPE, SHOWSQL,
ALIGN, START_ROW_NUM, DTW_SET_TOTAL_ROWS)
CLIETTE "DTW_SQL:$(DATABASE)"


图 4显示了一段 Live Connection 配置文件,其中包含 对 DTW_SQL:CELDIAL 和 DTW_JAVAPPS 的 cliette 定义。

图 4. Live Connection 配置文件段






CONNECTION_MANAGER{
MAIN_PORT=7100
ENCRYPTION=OFF
}


###############################################################
# This is a comment in a Live Connection configuration file.
# Comments start with a pound (hash) character.
# Comments terminate at the end of the line and do not continue to
# the next line unless another pound (hash) character is specified.
# You can include comments at the end of lines containing Live
# Connection keywords except on password lines.
# You cannot include comments anywhere on lines containing the
# password keyword.
# You cannot include spaces and pound (hash) characters within any
# name, such as cliette name or in database cliette passwords.
###############################################################
CLIETTE DTW_SQL:CELDIAL{
MIN_PROCESS=1
MAX_PROCESS=5
EXEC_NAME=./dtwcdb2
DATABASE=CELDIAL
LOGIN=marshall
PASSWORD=stlpwd
}


CLIETTE DTW_JAVAPPS{
MIN_PROCESS=1
MAX_PROCESS=5
EXEC_NAME=./javaapp
}



[ 页的顶部 | 上一页 | 下一页 | 目录 | 索引 ]