Invalid database handle (no active connection)

Abstract: Invalid database handle (no active connection)

Problem: Cause: Bug 8134 Problem: GPRE is not using the "SET TRANSACTION NAME" properly. Solution: #include #include EXEC SQL SET DATABASE MyBlobDatabase = "blob.gdb"; EXEC SQL BEGIN DECLARE SECTION; ISC_QUAD blob_id; char ISC_FAR buf[100]; unsigned short blob_seg_len; void *T1; EXEC SQL END DECLARE SECTION; void main() { isc_tr_handle MyTransaction = 0L; EXEC SQL CONNECT MyBlobDatabase; if(isc_status[0] == 1 && isc_status[1]) { printf("connectn"); isc_print_status(isc_status); return; } EXEC SQL SET TRANSACTION NAME MyTransaction; if(isc_status[0] == 1 && isc_status[1]) { printf("start transn"); isc_print_status(isc_status); return; } /* * The assignment statement directly below this * comment is a workaround to the GPRE bug# 8134 */ /* bug 8134 workaround */ gds__trans = MyTransaction; EXEC SQL DECLARE MyBlobCursor CURSOR FOR INSERT BLOB blobfield INTO blobs; if(isc_status[0] == 1 && isc_status[1]) { printf("declare cursorn"); isc_print_status(isc_status); return; } EXEC SQL OPEN TRANSACTION MyTransaction MyBlobCursor INTO :blob_id; if(isc_status[0] == 1 && isc_status[1]) { printf("open cursorn"); isc_print_status(isc_status); return; } strcpy(buf, "This is my BLOB record"); blob_seg_len = strlen(buf); EXEC SQL INSERT CURSOR MyBlobCursor VALUES (:buf :blob_seg_len); if(isc_status[0] == 1 && isc_status[1]) { printf("insert cursorn"); isc_print_status(isc_status); return; } EXEC SQL CLOSE MyBlobCursor; if(isc_status[0] == 1 && isc_status[1]) { printf("close cursorn"); isc_print_status(isc_status); return; } exec sql insert transaction MyTransaction into blobs values (22, :blob_id); if(isc_status[0] == 1 && isc_status[1]) { printf("insert into tablen"); isc_print_status(isc_status); return; } EXEC SQL COMMIT TRANSACTION MyTransaction; if(isc_status[0] == 1 && isc_status[1]) { printf("commit transn"); isc_print_status(isc_status); return; } EXEC SQL DISCONNECT MyBlobDatabase; return; }
-->