10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

How <strong>Programming</strong> for Multiple Sessions WorksWhen autocommit is on, the database session can have only one cursor openat a time (including a query object opened in cursor mode). When a cursor isopen, the only valid database statements that the application can issue in thecursor's database session are cursor statements. For example, if autocommit ison and the application is running a single database session, you cannot open acursor in one frame, call or open another frame, and then perform anotherunrelated database operation in the new frame before returning to the firstframe and continuing the cursor operation.How You Can Use the Exit Statement with TransactionsThe effect of the exit statement on an open transaction is undefined. Beforeexiting an application, your application should check for open transactions andprovide some procedure for any that are found. Any open cursors are closedon exit.How <strong>Programming</strong> for Multiple Sessions WorksDeveloping an application with multiple concurrent frames raises issues abouttransaction management. If operations in the frames are related, you mightwant to maintain a single transaction for the entire application. A singletransaction forces a commit or rollback statement issued in any one of theopen frames to affect all open transactions. Designing applications whosetransactions do not span frames or event blocks is recommended, however, toimprove concurrency.However, maintaining one transaction throughout several concurrent framesalso can cause locking conflicts. If operations in the frames are not related,you might want to open a different database session (each with its owntransaction) for each frame.In a single OpenROAD application, you can use multiple sessions to provideseparate database sessions for concurrent transactions (with the same ordifferent flag settings) in the same database or to connect each session to adifferent database.Although you can open any number of sessions, you should limit the number ofopen sessions according to your transaction processing needs. If you need toaccess data from different databases, you need multiple connections tosupport this access. However, you should not open more sessions than youcan easily manage because:• You might lose track of them• There is a DBMS limit to the number of concurrent sessions (exceeding thelimit prevents other frames or applications from connecting)188 <strong>Programming</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!