About Transaction objects – PB Docs 70

About Transaction objects

In a PowerBuilder database connection, a Transaction
object
is a special nonvisual object that functions
as the communications area between PowerScript and the database.
The Transaction object specifies the parameters that PowerBuilder
uses to connect to a database. You must establish the Transaction
object before you can access the database in your application:

Datrn005.gif

Communicating with the database

In order to display and manipulate data in a PowerBuilder
application, the application must communicate with the database
in which the data resides:

proc.gif To communicate with the database in your PowerBuilder
application:

  1. Assign the appropriate values to the Transaction
    object.

  2. Connect to the database.

  3. Assign the Transaction object to the DataWindow
    control.

  4. Perform the database processing.

  5. Disconnect from the database.

For information about setting the Transaction
object for a DataWindow control and using the DataWindow to retrieve
and update data, see the DataWindow Programmer’s
Guide

.

Default Transaction object

When you start executing an application, PowerBuilder creates
a global default Transaction object named SQLCA (SQL Communications
Area). You can use this default Transaction object in your application
or define additional Transaction objects if your application has
multiple database connections.

Transaction object properties

Each Transaction object has 15 properties, of which:

  • Ten are used to connect
    to the database.
  • Five are used to receive status information from
    the database about the success or failure of each database operation
    (these error-checking properties all begin with SQL)
    .

Description of Transactionobject properties

The following table describes each Transaction object property.
For each of the ten connection properties, it also lists the equivalent
field in the Database Profile Setup dialog box that you complete
to create a database profile in the PowerBuilder development environment.

note.gif Transaction object properties for your PowerBuilder
database interface
For the Transaction object properties that
apply to your PowerBuilder database interface, see “Transaction object
properties and supported PowerBuilder database interfaces”
.

For information about the values you should
supply for each connection property, see the section for your PowerBuilder
database interface in Connecting to Your Database
.

Property Data type Description In a database profile
DBMS String The DBMS identifier for your connectionFor a complete list of identifiers, see the
appendix on supported database interfaces in Connecting
to Your Database
DBMS
Database String The name of the database to which you
are connecting
Database Name
UserID String The name or ID of the user who connects
to the database
User ID
DBPass String The password used to connect to the database Password
Lock String For those DBMSs that support the use
of lock values and isolation levels, the isolation level to use
when you connect to the databaseFor information about the lock values you
can set for your DBMS, see the description of the Lock DBParm parameter
in Connecting to Your Database
Isolation Level
LogID String The name or ID of the user who logs in
to the database server
Login ID
LogPass String The password used to log in to the database
server
Login Password
ServerName String The name of the server on which the database
resides
Server Name
AutoCommit Boolean For those DBMSs that support it, specifies
whether PowerBuilder issues SQL statements outside or inside the scope
of a transaction. Values you can set are:

  • True PowerBuilder issues SQL statements outside
    the scope
    of a transaction; that is, the statements are not part of a logical
    unit of work (LUW). If the SQL statement succeeds, the DBMS updates
    the database immediately as if a COMMIT statement had been issued
  • False (Default) PowerBuilder issues SQL statements inside
    the
    scope of a transaction. PowerBuilder issues a BEGIN TRANSACTION
    statement at the start of the connection. In addition, PowerBuilder
    issues another BEGIN TRANSACTION statement after each COMMIT or
    ROLLBACK statement is issued

For more information, see the AutoCommit description
in Connecting to Your Database

AutoCommit Mode
DBParm String Contains DBMS-specific connection parameters
that support particular DBMS featuresFor a description of each DBParm parameter
that PowerBuilder supports, see the chapter on setting additional connection
parameters in Connecting to Your Database
DBPARM
SQLReturnData String Contains DBMS-specific information. For
example, after you connect to an INFORMIX database and execute an
embedded SQL INSERT statement, SQLReturnData contains the serial number
of the inserted row
SQLCode Long The success or failure code of the most
recent SQL operationFor details, see “Error handling after
a SQL statement”
SQLNRows Long The number of rows affected by the most
recent SQL operation. The database vendor supplies this number,
so the meaning may be different for each DBMS
SQLDBCode Long The database vendor’s error
code.For details, see “Error handling after
a SQL statement”
SQLErrText String The text of the database vendor’s
error message corresponding to the error codeFor details, see “Error handling after
a SQL statement”

Transaction objectproperties and supported PowerBuilder database interfaces

The Transaction object properties required to connect to the
database are different for each PowerBuilder database interface.
Except for SQLReturnData, the properties that return status information
about the success or failure of a SQL statement apply to all PowerBuilder
database interfaces.

The following table lists each supported PowerBuilder database
interface and the Transaction object properties you can use with
that interface:

Database interface Transaction object properties
INFORMIX
  • DBMS
  • UserID
  • DBPass
  • Database
  • ServerName
  • DBParm
  • Lock
  • AutoCommit
  • SQLReturnData
  • SQLCode
  • SQLNRows
  • SQLDBCode
  • SQLErrText
JDBC
  • DBMS
  • LogID
  • LogPass
  • DBParm
  • Lock
  • AutoCommit
  • SQLCode
  • SQLNRows
  • SQLDBCode
  • SQLErrText
Microsoft SQL Server
  • DBMS
  • Database
  • ServerName
  • LogID
  • LogPass
  • DBParm
  • Lock
  • AutoCommit
  • SQLCode
  • SQLNRows
  • SQLDBCode
  • SQLErrText
ODBC
  • DBMS
  • #UserID
  • +LogID
  • +LogPass
  • DBParm
  • Lock
  • AutoCommit
  • SQLReturnData
  • SQLCode
  • SQLNRows
  • SQLDBCode
  • SQLErrText
OLE DB
  • DBMS
  • LogID
  • LogPass
  • DBParm
  • AutoCommit
  • SQLCode
  • SQLNRows
  • SQLDBCode
  • SQLErrText
ORACLE
  • DBMS
  • ServerName
  • LogID
  • LogPass
  • DBParm
  • SQLReturnData
  • SQLCode
  • SQLNRows
  • SQLDBCode
  • SQLErrText
Sybase DirectConnect
  • DBMS
  • Database
  • ServerName
  • LogID
  • LogPass
  • DBParm
  • Lock
  • AutoCommit
  • SQLCode
  • SQLNRows
  • SQLDBCode
  • SQLErrText
Sybase Adaptive Server Enterprise
  • DBMS
  • Database
  • ServerName
  • LogID
  • LogPass
  • DBParm
  • Lock
  • AutoCommit
  • SQLCode
  • SQLNRows
  • SQLDBCode
  • SQLErrText

# UserID is optional for ODBC (be careful
specifying the UserID property; it overrides the connection’s
UserName property returned by the ODBC SQLGetInfo call).

+ PowerBuilder uses the LogID and LogPass
properties only if your ODBC driver does not
support
the SQL driver CONNECT call.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x