Before any ORB classes can be used, you must call the init method, which:
Returns an object reference to the ORB.
Allows you to pass initialization parameters to control the operation of the ORB. For example, you can specify the password for access to the Sybase SSL certificate database.
The ORB.init() method acceps a formatted
string that can contain settings for multiple initialization parameters.
Pass initialization parameters as shown in this example, which configures
the -ORBlogFile
property and
the -ORBpin
property, to specify
a file name for logging errors and the Sybase SSL-certificate-database
password, respectively:
orb.init("-ORBlogFile=d:\jagorb.log,-ORBpin=sybase")
As shown in the example, parameter names and values must be separated by an equals sign, ‘=’, and each name/value pair must be separated from the next with a comma and no white space.
For each initialization parameter, there is an equivalent environment variable. If the environment variable and initialization parameter are set, the value of the initialization parameter is used. Parameter and environment variable names are the same as for the C++ client ORB (see Chapter 15, “Creating CORBA C++ Clients”).
You can set any initialization parameter to a value of none, which overrides the value of the environment variable and sets the value to the default, if any.
You can pass the following initialization parameters to the driver class:
ORBNameServiceURL – This parameter sets the IIOP URL to the EAServer name service. This parameter can also be set in an environment variable, JAG_NAMESERVICEURL. This parameter is used in conjunction with the EAServer name service and is specified according to the following syntax:
iiop://hostname:iiop-port/initial-context
where:
hostname is the host machine name for the server that serves as the name server for your client. If omitted, the default host name applies.
iiop-port is the IIOP port number for the server.
initial-context is the initial naming
context, which you set in the server property Initial Context. This
can be used to set a default prefix for name resolution. For example,
if you specify USA/Sybase/
,
all names that you resolve with the context are assumed to be relative
to this location in the name hierarchy. When specifying the initial
context, a trailing slash is optional; it is added automatically
if you do not specify an initial context that ends with a slash.
If your application uses a cluster of servers, the cluster may use multiple name servers. In this case, specify the URL (host machine name and IIOP port number) for each name server in a list separated by semicolons and no white space. Include the cluster’s initial naming context only with the last URL. For example:
iiop://host1:9000;iiop://host2:9000/USA/Sybase/
ORBHttp – This specifies whether the ORB should use HTTP-tunnelling to connect to the server. A setting of "true" specifies HTTP tunnelling. The default is "false". This parameter can also be set in an environment variable, JAG_HTTP. Some firewalls may not allow IIOP packets through, but most all allow HTTP packets through. When connecting through such firewalls, set this property to "true".
ORBLogIIOP – This specifies whether the ORB should log IIOP protocol trace information. A setting of "true" enables logging. The default is "false". This parameter can also be set in an environment variable, JAG_LOGIIOP. When this parameter is enabled, you must set the ORBLogFile option (or the corresponding environment variable) to specify the file where protocol log information is written.
ORBLogFile – This sets the path and name of the file to which to log client execution status and error messages. This parameter can also be set in an environment variable, JAG_LOGFILE. The default setting is no log.
ORBCodeSet – This sets the code set that the client uses. This parameter can also be set in an environment variable, JAG_CODESET. The default setting is iso_1.
ORBRetryCount – Specify the number of times to retry when the initial attempt to connect to the server fails. This parameter can also be set in an environment variable, JAG_RETRYCOUNT. The default is 5.
ORBRetryDelay – Specify the delay, in milliseconds, between retry attempts when the initial attempt to connect to the server fails.This parameter can also be set in an environment variable, JAG_RETRYDELAY. The default is 2000.
ORBProxyHost – Specifies the machine name or the IP address of an SSL proxy. See Chapter 12, “Deploying Applications Around Proxies and Firewalls,” in the EAServer Security Administration and Programming Guide for more information.
ORBProxyPort – Specifies the port number of the SSL proxy.
ORBsocketReuseLimit – Specifies the number of times that a network connection may be reused to call methods from one server. The default is 0, which indicates no limit. The default is ideal for short-lived clients. The default may not be appropriate for a long-running client program that calls many methods from servers in a cluster. If sockets are reused indefinitely, the client may build an affinity for servers that it has already connected to rather than randomly distributing its server-side processing load among all the servers in the cluster. In these cases, the property should be tuned to best balance client performance against cluster load distribution. In Sybase testing, a setting of 10 to 30 proved to be a good starting point. If the reuse limit is too low, client performance degrades.
ORBIdleConnectionTimeout – Specifies the time, in seconds, that a connection is allowed to sit idle. When the timeout expires, the ORB closes the connection. The default is 0, which specifies that connections can never timeout. The connection timeout does not affect the life of proxy instance references; the ORB may close and reopen connections transparently between proxy method calls. Specifying a finite timeout for your client applications can improve server performance. If many instances of the client run simultaneously, a finite client connection timeout limits the number of server connections that are devoted to idle clients. A finite timeout also allows rebalancing of server load in an application that uses a cluster of servers.
ORB initialization is demonstrated in the following example.
Dim orb As ORB Dim Manager As Manager Dim Session As Session Dim Factory As Factory ' Create a new ORB object Set orb = New ORB ' Initialize the ORB instance orb.init ("")
init returns an object reference to the EAServer ORB. When orb is deallocated or assigned a new object reference, it will be automatically released.
Copyright © 2005. Sybase Inc. All rights reserved. |