Internal transaction management
What it does
When the DataWindow control uses internal transaction management,
it handles connecting, disconnecting, commits, and rollbacks. It automatically performs
connects and disconnects as needed; any errors that occur cause
an automatic rollback.
Whenever the DataWindow needs to access the database (such
as when a Retrieve or Update method is executed), the DataWindow
issues an internal CONNECT statement, does the appropriate data
access, then issues an internal DISCONNECT.
Whether to use it
When not to use it
Do not use internal transaction management when:
-
Your application requires the best possible performance
Internal transaction management is slow and uses considerable
system resources because it must connect and disconnect for every
database access. -
You want control over when a transaction is committed
or rolled backBecause internal transaction management must disconnect after
a database access, any changes are always committed immediately.
When to use it
If the number of available connections at your site is limited, you
might want to use internal transaction management because connections are
not held open.
Internal transaction management is appropriate in simple situations
when you are doing pure retrievals (such as in reporting) and do
not need to hold database locks—when application control
over committing or rolling back transactions is not an issue.
How it works
PowerBuilder
To use internal transaction management, you specify connection
values for a transaction object, which could be the automatically instantiated
SQLCA. Then you call the SetTrans method, which copies the values
from a specified transaction object to the DataWindow control’s
internal transaction object.
1 |
SQLCA.DBMS = ProfileString("myapp.ini", & |
1 |
"database", "DBMS", " ") |
1 |
... // Set more connection parameters |
1 |
dw_employee.SetTrans(SQLCA) |
1 |
dw_employee.Retrieve( ) |
When you use SetTrans, you do not need to explicitly code
a CONNECT or DISCONNECT statement in a script. CONNECT and DISCONNECT statements
are automatically issued when needed.
For more information about PowerBuilder transaction objects,
see PowerBuilder Application Techniques.
Web ActiveX
To use internal transaction management, set the transaction properties
for the DataWindow Web ActiveX control instead of using a DataWindow
Transaction Object control. You can set the properties using Param
elements or in a script. This example sets the DbParm property and
calls Retrieve in a script:
1 |
dw_employee.DbParm = |
1 |
"Driver='com.sybase.jdbc3.jdbc.SybDriver', |
1 |
URL='jdbc:sybase:Tds:www.domain.com:7373'"; |
1 |
dw_employee.Retrieve( ); |
For internal transaction management, you do not call SetTransObject.
If you change the DataWindow object during execution, the connection
information is still available and the DataWindow connects as needed.
You can change the connection information by changing the value
of the DbParm property.