Hi Hiroyuki,
Thanks for the log. Although the CLI trace shows a SQL_SUCCESS after
freeing ENV handle a -1 (SQL_ERROR) [log in dbi trace: "return code from
Freeing ENV Handle -1"] is been received in the driver, hence the error
during disconnect is seen.
To narrow down the problem, I have added one more log statement and have
initialised the "ret" variable to 0, to check if this is DBD-DB2 problem
or a problem in CLI. Could you apply the new patch attached and let me
know the dbi trace.
If this turns out to be a CLI problem then I will take this up with the
CLI team and check what could have gone wrong.
--
Thanks
Praveen
IBM OpenSource Application Development Team
India Software Labs, Bangalore (India)
--- perl/DBD-DB2/dbdimp.c version 1.79 Wed Jul 14 10:04:46 2010
+++ perl/DBD-DB2-1.79/dbdimp.c patched version 1.79 Tue Aug 10 21:05:41 2010
@@ -51,10 +51,16 @@
if(DBIc_TRACE_LEVEL(imp_xxh) >=3){
case SQL_SUCCESS_WITH_INFO:
case SQL_NO_DATA_FOUND:
+ PerlIO_printf( DBILOGFP,
+ "For trace level > 3 - rc = %d\n",
+ rc );
setErrorFromDiagRecInfo(perlHandle, handleType, handle, "");
break;
}
case SQL_ERROR:
+ PerlIO_printf( DBILOGFP,
+ "For condition SQL_ERROR - rc =%d\n",
+ rc );
setErrorFromDiagRecInfo(perlHandle, handleType, handle, Nullch);
break;
case SQL_INVALID_HANDLE:
@@ -644,6 +650,9 @@
SQLRETURN ret;
ret = SQLDisconnect(imp_dbh->hdbc);
+ PerlIO_printf( DBILOGFP,
+ "return code after SQLDisconnect %d\n",
+ ret );
CHECK_ERROR(dbh, SQL_HANDLE_DBC, imp_dbh->hdbc, ret, "Disconnect Failed");
EOI(ret);
@@ -654,6 +663,9 @@
DBIc_ACTIVE_off(imp_dbh);
ret = SQLFreeHandle( SQL_HANDLE_DBC, imp_dbh->hdbc );
+ PerlIO_printf( DBILOGFP,
+ "return code from Freeing Connect Handle %d\n",
+ ret );
CHECK_ERROR(dbh, SQL_HANDLE_DBC, imp_dbh->hdbc, ret, "Free Connect Failed");
EOI(ret);
@@ -665,12 +677,23 @@
SvREFCNT_dec( imp_drh->svNUM_OF_FIELDS );
imp_drh->svNUM_OF_FIELDS = NULL;
}
+ PerlIO_printf( DBILOGFP,
+ "return code Before Freeing ENV Handle %d\n",
+ ret );
+
+ ret = 0;
ret = SQLFreeHandle( SQL_HANDLE_ENV, imp_drh->henv );
+
+ PerlIO_printf( DBILOGFP,
+ "return code from Freeing ENV Handle %d\n",
+ ret );
CHECK_ERROR(dbh, SQL_HANDLE_ENV, imp_drh->henv, ret, "Free HENV Failed");
EOI(ret);
imp_drh->henv = SQL_NULL_HENV;
}
-
+ PerlIO_printf( DBILOGFP,
+ "Returning from disconnect %d\n",
+ ret );
/* We don't free imp_dbh since a reference still exists */
/* The DESTROY method is the only one to 'free' memory. */
/* Note that statement objects may still exist for this dbh! */