SET OWNER
The SET OWNER statement allows you to specify one or more owner names for use during the current database connection. Think of an owner name as a Btrieve file password that is required for the MicroKernel Engine to allow access to a file. Note that no relationship exists between an owner name and any operating system or database user name. For more information, see
Owner Names.
Syntax
SET OWNER = []ownername['] [,[]ownername[']] ...
Remarks
The SET OWNER statement allows a user to provide a list of owner names for data files that require them. The Relational Engine then sets those owner names for that user’s connection session to gain file permissions as needed from the MicroKernel Engine.
In a SET OWNER statement, if an owner name begins with a nonalphabetic character, you must enclose the string in single quotation marks ( ). This requirement always applies to long owner names in hexadecimal, which must begin with 0x or 0X in the first two bytes.
A SET OWNER statement is effective only for the current connection session. If a user logs out after issuing SET OWNER, the command must be reissued the next time the user logs in.
Each SET OWNER statement resets the current owner name list for the session. You cannot add owner names to the list with more statements.
In a database with security turned off, the SET OWNER statement allows full access to any data file that has an owner name matching an owner name supplied in the statement.
In a database with security turned on, the SET OWNER statement has no effect for users other than the Master user. If the Master user has not granted itself rights, executing SET OWNER gives the Master user full access to any data file with one of the owner names provided. For other users, the Master user can authorize access in either of the following two ways:
•Execute SET OWNER with owner names, followed by GRANT with no owner name.
•Execute GRANT with an owner name.
These two options are illustrated in the following examples.
Examples
The following example specifies one owner name.
SET OWNER = '12jerry'
============
These examples provide several owner names.
SET OWNER = jimbo, terry, maximus
SET OWNER = 'serverl7 region5', '0x0123456789abcdefABCDEF0123456789'
Note that owner names may be enclosed in single quotation marks for different reasons. Here, the first one includes a space, while the second one is hexadecimal and starts with the required prefix 0x.
============
This example shows the use of multiple SET OWNER statements within the same connection.
SET OWNER = jimbo, terry, maximus
-- wner list contains jimbo, terry, maximus.
SET OWNER = fred, jennie, lucinda
-- owner list now contains fred, jennie, lucinda. Previous contents are discarded.
============
This example demonstrates the use of SET OWNER by the Master user in a secure database. Assume that security has been turned on, but no permissions have been granted in the database. The inventory data file has the owner name admin.
To grant itself permissions, the Master user has two options. The Master user can issue a SET OWNER followed by a GRANT without an owner name, or the Master user can issue a GRANT that specifies the owner name. Both methods achieve the same result:
SET OWNER = admin
GRANT ALL ON inventory TO MASTER
or
GRANT ALL ON inventory admin TO MASTER
See Also