9.37 DEFINE_DB_SERVER

Note: Built-In Function Rules     Usage Options

Defines details of a database that is to be used for files that are specifically redirected to use this database.

Primarily, this is for the purpose of supporting Other Files and SQL Views in Other databases. Other Files and SQL Views are loaded into LANSA using Load Other Files on the File Control menu.

It can also be used to access LANSA User Files in a different partition or in an external database. These file definitions must be exported from the repository for the external database into the current repository. Whenever the file definition is changed in the external repository it will need to be re-imported to the current repository and the OAM re-built.

The definition details are not persistent and only exist while the LANSA environment remains active.

The time taken to define a database is minimal.

Note 1: This BIF has a similar purpose to DEFINE_OTHER_SERVER except that the OAMs still reside on the local PC and database I/O is used to access the server. See Database Connection.

Note 2: This BIF requires a local database connection established, otherwise it will return an error.

Arguments

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

SSN (Server Symbolic Name) This is the name that will be used in all future references to this server by this and other RDML functions.

1

10

 

 

2

A

Req

Database Identifier.

1

32

 

 

3

A

Opt

Connection Parameter Overrides (may be blank).

1

256

 

 

4

A

Opt

RRN Path Override (may be blank). If it is specified, it must end with a path separator - on MS Windows, this is a back slash.

1

256

 

 

5

A

Opt

Database Type Override (may be blank). Specify a valid database type from The X_DBMENV.DAT File.

1

32

 

 

6

A

Opt

ODBI= Override to specifically set the transaction isolation level for this database. May be 0-4 or blank. 0 means the default setting for the database. Blank means the same as the ODBI= parameter. For more information, refer to The ODBI=Parameter.

1

1

 

 

7

A

Opt

ODBA= This parameter has been deprecated. For more information, refer to The ODBA=Parameter.

1

1

 

 

 

Return Values

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

Return Code.

OK - Server Defined

ER - Server not defined and error message(s) issued.

2

2

 

 

 

Technical Notes

Example

The following example defines a database server called CHICAGO that connects to the database MYDATABASE and sets the user id and password to null so that ODBC prompts for the user id and password.

USE BUILTIN(DEFINE_DB_SERVER) WITH_ARGS(CHICAGO MYDATABASE "UID=;PWD=;") TO_GET(#RETCOD)

The connection will be made when the first file that is associated with MYDATABASE is used.

A Note on Error Handling

It is very strongly recommended that you avoid building complex error handling schemes into your applications. Use a very simple trap like this at all levels of your application:

if (#retcode *ne OK)

abort msgtxt('Failed to .............................')

endif

Let the standard error handling built into every generated application, take care of the problem. Situations have arisen where user defined error handling logic has become so complex as to consume 40 - 50% of all RDML code (with no obvious benefit to the application). Do not fall into this trap.