Owner Names

Pervasive.SQL tables have a concept called the owner name of a table. The value of an owner name is not the name of the person who created the table or the person who owns it. You should think of owner names like passwords. People who know the password have unlimited access, while people who don't, have either restricted access or no access at all.

The owner name concept was originally intended to protect unauthorized access to Btrieve files. Pervasive.SQL also offers more advanced security features that can be combined with owner names. Refer to the Pervasive.SQL documentation and Pervasive.SQL Database Mode and Security for further information.

This section describes how the DataFlex Pervasive.SQL Driver supports owner names.

Conversion Options

When you convert a table from DataFlex to Pervasive.SQL, you have the option to enter an owner name. When you enter an owner name, you can select whether you want to allow read-only access or to encrypt the data.

Read-only Access

When a table allows read-only access, it means that any application which does not know the owner name of a table can open the table, but only has read-only access to it. This means that those applications cannot make changes to the data in the table like making changes to existing records, adding records, or deleting records.

Encrypt Data

When this option has been selected when entering an owner name, Pervasive.SQL will encrypt the data when it is being stored to disk. This way, it is not readable by anyone opening the table with an application that does not know how to handle Pervasive.SQL tables. This option can be used in combination with read-only access.

How to Set or Clear an Owner Name

There are two ways to put an owner name to a table. The first is when a table is being converted to the Pervasive.SQL format using one of the conversion tools. The other way is to use a special command DFBTR_SET_Owner Name.

Conversion

When you are converting tables, you can enter an owner name for the table(s) you want to convert. When you do, you can also specify whether you allow read-only access or if you want to encrypt the table’s data.

DFBTR_SET_OWNER

This command can be used in a program to change or set the owner name of an opened table. Note that when the table has been opened, you need to have full access to the table. This means that if the table already has an owner name, you need to have it opened using that name.

When setting the owner, you can specify that you allow read-only access and/or if you want the table’s data to be encrypted.

DFBTR_SET_OWNER  SALESP.File_Number To “MYOWNER” READONLY

See Appendix B for complete syntax details.

DFBTR_CLEAR_OWNER

This command can be used to clear the owner of a table. After the owner has been cleared, any application and/or user can access the data and make changes to the data.

The table of which the owner has to be clear need to be open and needs full access to the table.

DFBTR_CLEAR_OWNER  SALESP.File_Number

See Appendix B for complete syntax details.

Opening Tables with Owner Names

Once an owner name has been put on a table, you need to pass this owner name to the DataFlex Pervasive.SQL Driver before you can open it and make changes to the data in the table. There are several ways to do this:

The first option uses the owner name specified for that table only. The other options add the owner names to an internal list of owner names.

Owner Name List

The driver keeps an internal list of owner names to use when opening Pervasive.SQL tables. Whenever a Pervasive.SQL table needs to be opened which has not been assigned an individual owner name, the driver will try the first owner name of the list to open the table. If it doesn't succeed, it will try the next owner name in the list, until it has reached the end and it still could not open the table. When it reaches the end without opening the table, it will try to open the table without owner name. When the owner name list is empty, it will immediately try to open the table without owner name. If it still could not open the table, it will generate an error BTR:51.

Setting the Owner Name in the INT File

When you are using an INT file to open a Pervasive.SQL table through the driver, you can set a line in the INT file specifying the owner name of the table. This owner name will be used to open the table. If it can’t open the table using the specified owner name, it will try the other owner names of your list of owner names and if it still can’t open it, it will try it without owner name.

Put a line like this in the INT file for your Pervasive.SQL table:

OWNER “SECRET”

NOTE: Using this method is not very secure. Anyone who has access to the INT file can read the owner name of the table.

Add the Owner Name to the DFBTRDRV.INT File

If all or a number of tables share the same owner name, you can choose to put this owner name in your DFBTRDRV.INT configuration file. Every owner listed will be added to the internal list of owner names of the driver. The names in this list will be used to open tables.

Put a line(s) like this in the DFBTRDRV.INT:

OWNER “SECRET1”

OWNER “SECRET2”

OWNER “SECRET3”

NOTE: Using this method is not very secure. Anyone that has access to the DFBTRDRV.INT file can read the owner name(s) of the table.

Pass the Owner Name at Run Time

This is the safest method to add owner names to the internal list of owner names. You can use the command DFBTR_ADD_OWNER to add an owner name to the list. The best way to do this is to start your program with a login screen in which the user can type in the owner name(s).

The syntax for adding an owner name to the list is:

DFBTR_ADD_OWNER  Owner

Owner The owner name to add to the internal list. It may be a constant or a string variable.

 

See Also

Pervasive.SQL