Connection to DB2 may fail with SQL1248N error message after calling xa_close()
The following error may occur when trying to make a new database connection to DB2 after calling xa_close():
SQL1248N Database "<database-alias>" not defined with the transaction
- xa_close() resets the XA environment only when "Thread of Control" is set to PROCESS.
- The connection type should be set back to 1 again before making a new connection
Resolving the problem
To resolve this problem, do the following:
1. In order to ensure the XA environment is reset after calling xa_close(), "Thread of Control" needs to be set to "PROCESS" by adding "TOC=P" to the XA open string.
2. After calling xa_close(), the connection type should be set to 1 by using the sqlesetc API. This should be done before attempting a new connection.
int rc = 0;
struct sqlca ljsqlca;
struct sqle_conn_setting csetting;
csetting.type = SQL_CONNECT_TYPE;
csetting.value = SQL_CONNECT_1;
rc = sqlesetc( &csetting, 1, &ljsqlca);
More support for:
DB2 for Linux, UNIX and Windows
Application Programming - XA/Transaction Monitors
Software version: 9.5, 9.7, 10.1, 10.5
Operating system(s): AIX, HP-UX, Linux, Solaris, Windows
Reference #: 1661398
Modified date: 2014-01-08