Database Access on Sybase

Open/Close Support

The open and close instructions are fully supported. The open instruction opens the relevant path and attempts to log on to the database. The close instruction closes all tables and logs off from Sybase, shutting down that path.

Logging On

Logging on to Sybase differs slightly from the standard method because it requires an extra parameter. You must supply a database name, a user name and a password. The database name can consist of a database name and a server name, supplied as follows:

server.database

Note:  You cannot use server and database names that include periods (.) when logging on. Sybase allows you to define server and database names that include periods, but the SYB connector interprets periods as separators.)

For example, to log on to server ROSE and database test, with user name sa and password dba, the open ProcScript statement must be specified as follows:

open "ROSE.test|sa|dba","syb"

If no server is specified (for example: "test|sa|dba","syb"), Sybase uses the default server. This is either the Sybase server, or the server referenced by the logical name (environment variable) DSQUERY, if set.

The Sybase SQL Server for Release 10 requires that all passwords be at least six characters long.

The same format is used for path definitions and the DBMS Logon form.

Logon fails if an illegal SYB connector option is entered.

When the Uniface /pri switch is set to a value greater than or equal to 32, the following information is sent to the Uniface message frame during logon:

  • connector release—the connector sends the connector release number and the Sybase version to the message frame during the Logon request.

  • SYB connector options—the SYB connector options set using USYS$SYB_PARAMS.

Database Sort Order

Uniface requires that its dictionary be stored on a Sybase server that is configured with the default binary ASCII sort order. You can check the sort order of your data with the sp_helpsort stored procedure. This command can be used with the Uniface SQL Editor or the Sybase ISQL tool.

Using Sybase for the Repository

Sybase can be used as the Uniface Repository, in which case it is advisable to create a 4-MB application database as a minimum to hold the application definition and the data.

To configure Uniface to use Sybase as the Repository, assign the system information assignment paths to the database. For example:

$SYB=dbserver.SYBDB:|username|password
$IDF= $SYB
$SYS= $SYB
$UUU= $SYB
$DEF= $SYB

$UUU is the assignment for the compiled global objects including all the messages and global ProcScript. Uniface must have access to this file before any application can start, so if Sybase manages this information, logon information must be provided either in the command line or in an assignment table.

For example, the optional server name is denoted by the braces ({MyServer}):

$ idf/log=UUU:{MyServer\}MyDatabase|MyName|MyPassword

You can create a simple shell script to ask for the user name and password information before invoking Uniface. If you do not specify a user name, the operating system name is used, and if you do not specify a database, the default database for that user is used. This is specified inside the Sybase SQL Server.

Accessing Multiple Databases

Uniface allows an application to access multiple databases by using assignment files. For example, the following assignment tells Uniface that the customer table in the application model cs is held in the Sybase database pubs:

$SYB1 syb:pubs|username|password
dept1.cs $SYB1:dept1.*
$SYB2 syb:test_db|username|password
dept2.cs $SYB2:dept2.*

This connector allows you to connect to 12 databases simultaneously in Sybase.

Related Topics