PBUseProcOwner

Description

When you access a database through the ODBC interface and define a DataWindow object that uses a stored procedure as its data source, PBUseProcOwner specifies whether PowerBuilder should qualify the stored procedure with the owner name in the SQL EXECUTE statement passed to the driver.

PowerBuilder qualifies the stored procedure with an owner only if the owner associated with the stored procedure is different from the ID of the current user (the developer building the DataWindow object or the user running the application containing the DataWindow object).

Applies to

ODBC

Syntax

PBUseProcOwner='value'

Parameter

Description

value

Specifies whether PowerBuilder should qualify the stored procedure with its owner name in the SQL EXECUTE statement built by the DataWindow object and passed to the driver. Values are:

  • Yes

    If the owner associated with the stored procedure is different from the current user ID, PowerBuilder qualifies the stored procedure with its owner name in the SQL EXECUTE statement and passes this information to the driver. This allows users to execute stored procedures they do not own. For example:

    EXECUTE FRAN.MYPROCEDURE
  • No

    (Default) PowerBuilder does not qualify the stored procedure with its owner name in the SQL EXECUTE statement passed to the driver. For example:

    EXECUTE MYPROCEDURE

Default value

PBUseProcOwner='No'

Usage

Determining the PBUseProcOwner value

PowerBuilder searches the following in this order to determine the PBUseProcOwner value:

  1. The section for your database profile in the PowerBuilder initialization file (in the development environment) or the value of the transaction object's DBParm property (in an application).

  2. The section for your ODBC driver in the PBODB initialization file.

If PowerBuilder does not find a PBUseProcOwner value in these locations, it defaults to a value of 'No'.

If DBA owns the SQL Anywhere stored procedure

DBA (database administrator) is a reserved word in SQL Anywhere syntax.

If you define a DataWindow object with a SQL Anywhere stored procedure as its data source and DBA owns the stored procedure, the painter passes the following SQL EXECUTE statement to the ODBC driver if PBUseProcOwner is set to 'Yes':

EXECUTE DBA.MYPROCEDURE

This statement generates a syntax error because it includes the DBA reserved word.

If DBA owns the SQL Anywhere stored procedure you are using, you can avoid this syntax error by setting PBUseProcOwner to No so that PowerBuilder does not qualify the stored procedure with DBA.

In some situations, however, you must qualify the stored procedure with the DBA owner. For example, the DBA might want to grant execute permission to another user ID. In this case, you can avoid errors by editing the SQL EXECUTE syntax to enclose DBA in quotes, like this:

EXECUTE "DBA".MYPROCEDURE

Examples

To specify that PowerBuilder should qualify the stored procedure with its owner name in the SQL EXECUTE statement:

  • Database profile

    Select the Qualify Stored Procedures With Owner Name check box on the Transaction page in the Database Profile Setup dialog box.

  • Application

    Type the following in code:

    SQLCA.DBParm="PBUseProcOwner='Yes'"