Setting options and environment variables

This topic discusses using network initialization files to set various defaults for SQL OpenNet. The topic listed below discuss some additional options and environment variables you can set.

Using network initialization files to set network defaults

There are three initialization files you can use to set network defaults:

Setting connect string defaults and encryption in net.ini

The net.ini file enables you to specify an encryption key for the client, specify time‑outs, instruct SQL Connection functions to return error codes for communication errors, and other options. When you install Connectivity Series, the installation creates a default net.ini file with a default encryption setting. To change settings in net.ini, use a text editor. See the Settings in net.ini file table.

Note the following:

Because VORTEX_HOME is set at the system level, if you install both 64‑bit and 32‑bit versions of Connectivity Series on the same 64‑bit Windows machine, the last version installed determines the VORTEX_HOME setting by overwriting the previous setting. So if you do change net.ini, you’ll need to make sure you change the correct one.

Settings in net.ini file

Option

Description and syntax

connect_timeout

Specifies the number of seconds for socket connection time‑out. The default is 0 (no time‑out). To set this, use the following syntax, where n is the number of seconds:

connect_timeout n

key_connect

Specifies a key for the algorithm used to encrypt user names and passwords for the database and for the host (if vtxnetd or vtxnet2 is also started with the ‑k option). This encrypts user names and passwords being sent across the wire.

key_connect n

where n is any number between 1 and 2,147,483,647. The value for n must be set the same on both the client (where it is set with this net.ini option) and the server (where it is set with the ‑k option on the vtxnetd or vtxnet2 command line). See vtxnetd and vtxnet2 programs.

packetsize

Sets the minimum network packet size used by SQL OpenNet. The default is 8192 bytes. This option defines a minimum size for an aggregate buffer, which is a buffer created when data for multiple network packets needs to be sent to the client. This reduces network traffic by combining packets and sending them as a unit with the specified minimum size. To set this, use the following syntax, where size is the size in bytes:

packetsize size

Changing the default packet size may cause performance problems. The packet size should not be less than that of the prefetch buffer (specified with the bufsize argument for %SSC_INIT) plus 200 bytes. If you are using a WAN, you may want to change this value to reduce load on the network. The packet size used by SQL OpenNet server is set by the packetsize setting in the net.ini file on the client.

port

Sets the communication port number, which defaults to the vtxnet setting in the services file. For information, see Specifying the port number.

port port_number

read_timeout

Specifies how long (in seconds) SQL OpenNet should wait for a read operation to complete. By default this is set to 0, which prevents a time‑out.

read_timeout time

return_errno

Instructs SQL OpenNet to return an operating system error code (rather than ‑1) if there’s a communication error. For example, if an attempt to connect to a database on a server generates the TCP/IP socket error 10061, the %SSC_CONNECT function will return “10061” if this option is set to yes and “‑1” if this option is set to no. By default return_errno is set to no.

return_errno yes|no

write_timeout

Specifies how long (in seconds) SQL OpenNet should wait for a write operation to complete. By default this is set to 0, which prevents a time‑out.

write_timeout time

The following example net.ini file sets the service to connect to a Windows machine named mywinserver, instructs the server to use the Oracle driver, sets the encryption key to 6541, etc.

rem        SQL OpenNet init file
connect_timeout 5
key_connect 6541
packetsize 1300
port 1990
return_errno yes
read_timeout 60
write_timeout 60

Using opennet.srv to set SQL OpenNet services and environment variables (Windows)

To specify filenames and parameters for services run by SQL OpenNet on a Windows system, add the service as a line in the opennet.srv file. Use the following syntax:

srv_file [-pport_no] [log]

where srv_file is the path and filename for the service (either vtxnet2 or vtxnetd) and port_no is the port number. The log option creates a log file with a .log extension in the directory that contains the service. If port_no is not specified, the default port number, 1958, is used.

For example, the following line executes the vtxnet2 service on port 1660 with logging:

vtxnet2.exe -k67834 -p1660 log

To set an environment variable in opennet.srv, use the following syntax:

env_variable=setting

The environment variable setting should precede the line that starts the service. For example:

VORTEX_HOST_LOGFILE=c:\vortex
vtxnet2.exe -k67834 -p1660 log

For more information, see Customizing the opennet.srv file.

Using startnet to set environment variables (UNIX and OpenVMS)

The startnet (UNIX) and STARTNET.COM (OpenVMS) files start SQL OpenNet Server. You can also set environment variables in these files. Environment variables set in these files will be set on the server. Use the following syntax:

Environment variable settings should precede the line that starts the SQL OpenNet server. For example:

VORTEX_HOST_LOGFILE=usr2/vortex; export VORTEX_HOST_LOGFILE
nohup vtxnetd -p1958 log &
sleep 1