Coding PowerScript to set values for the DBParm
property
Another way to specify connection parameters in a script is by
coding PowerScript to assign values to properties of the Transaction
object. PowerBuilder uses a special nonvisual object called a
Transaction object to communicate with the database. The default
Transaction object is named SQLCA, which stands for SQL Communications
Area.
SQLCA has 15 properties, 10 of which are used to connect to your
database. One of the 10 connection properties is DBParm. DBParm
contains DBMS-specific parameters that let your application take
advantage of various features supported by the database
interface.
To set values for the DBParm property in a PowerBuilder
script:
-
Open the application script in which you want to specify
connection parameters.For instructions, see the section called “Opening Script views” in Users Guide.
-
Use the following PowerScript syntax to specify DBParm
parameters. Make sure you separate the DBParm parameters with
commas, and enclose the entire DBParm string in double
quotes.1SQLCA.dbParm = "parameter_1, parameter_2, parameter_n"For example, the following statement in a PowerBuilder
script sets the DBParm property for an ODBC data source named
Sales. In this example, the DBParm property consists of two
parameters: ConnectString and Async.1SQLCA.dbParm="ConnectString='DSN=Sales; UID=PB; PWD=xyz',Async=1" -
Compile the PowerBuilder script to save your changes.
For instructions, see the section called “Compiling the script” in Users Guide.