ODBC - Freeze (doing open, close, open, <freeze>...)
Original Reporter info from Mantis: ozznixon
-
Reporter name: Ozz Nixon
Original Reporter info from Mantis: ozznixon
- Reporter name: Ozz Nixon
Description:
[$] ./test8 sandbox db2inst1 testing
- Connecting, Connected, Closing, Closed.
- Connecting, Connected, Closing, &LtPos;cursor sits here blinking>
-- We are developing a middleware solution for FPC, and originally I though this was an OpenLink issue, however, the problem happens on my Linux boxes too. In this example the problem is happening when calling "Close". In my middleware solution the problem is when calling "TODBCConnection.Open()". If I have a session connect, send credentials to the DB layer and connect, but for error handling I drop the connection before issuing SQL commands, and do it over and over - it dies within 2 or 3 tries. (the code I submit with this fails on second try EVERYTIME - iODBC and unixODBC, to DB2 8.2 and 9.7).
Steps to reproduce:
TEST8.PP SOURCE:
Program Test18;
{$IFNDEF LINUX}
{$IFDEF POWERPC}
{$DEFINE MAC}
{$ELSE}
{$IFDEF DARWIN}
{$DEFINE MAC}
{$ELSE}
{$DEFINE WIN32}
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$IFNDEF FPC}
{$DEFINE DELPHI}
{$ELSE}
{$MODE DELPHI}{$H+}
{$ENDIF}
{$ASMMODE INTEL}
{$IFDEF FPC}
{$IFDEF UNIX}
{$DEFINE FPC_LINUX}
{$DEFINE FPC_MAC}
{$DEFINE FPC_UNIX}
{$ENDIF}
{$ENDIF}
{$DEFINE ODBC}
uses
{$IFDEF ODBC}
ODBCConn, // ODBC descendant of TSQLConnection {TODBCConnection}
SQLdb,
{$ENDIF}
sysutils;
var
{$IFDEF ODBC}
conn:TODBCConnection; {ODBCConn}
tmgr:TSQLTransaction; {SQLdb}
quer:TSQLQuery; {SQLdb}
{$ENDIF}
Loop:Longint;
begin
Randomize;
For Loop:=1 to 10 do begin
System.Write(Loop,') Connecting, ');
{$IFDEF ODBC}
conn:=TODBCConnection.Create(Nil);
conn.LoginPrompt:=False;
tmgr:=TSQLTransaction.Create(Nil);
tmgr.Database:=conn;
quer:=TSQLQuery.Create(Nil);
quer.Transaction:=tmgr;
quer.Database:=conn;
conn.DatabaseName:=paramstr(1);
conn.UserName:=paramstr(2);
conn.Password:=paramstr(3);
conn.Open;
{$ENDIF ODBC}
System.Write('Connected, Closing, ');
{$IFDEF ODBC}
conn.Close;
quer.Free;
tmgr.Free;
conn.Free;
{$ENDIF}
System.Writeln('Closed.');
end;
end.
Additional information:
ODBC TRACE:
[ODBC][14316][__handles.c][444]
Exit:[SQL_SUCCESS]
Environment = 0x8118b28
[ODBC][14316][SQLSetEnvAttr.c][182]
Entry:
Environment = 0x8118b28
Attribute = SQL_ATTR_ODBC_VERSION
Value = 0x3
StrLen = 0
[ODBC][14316][SQLSetEnvAttr.c][349]
Exit:[SQL_SUCCESS]
[ODBC][14316][SQLAllocHandle.c][345]
Entry:
Handle Type = 2
Input Handle = 0x8118b28
[ODBC][14316][SQLAllocHandle.c][463]
Exit:[SQL_SUCCESS]
Output Handle = 0x8119100
[ODBC][14316][SQLDriverConnect.c][678]
Entry:
Connection = 0x8119100
Window Hdl = (nil)
Str In = [DSN=sandbox;UID=db2inst1;PWD=********;][length = 38]
Str Out = 0xb7daab28
Str Out Max = 1024
Str Out Ptr = 0xbfb0a89c
Completion = 0
UNICODE Using encoding ASCII 'ISO8859-1' and UNICODE 'UCS-2LE'
[ODBC][14316][SQLDriverConnect.c][1487]
Exit:[SQL_SUCCESS]
Connection Out [DSN=SANDBOX;UID=db2inst1;PWD=testing;AUTOCOMMIT=1;LOBMAXCOLUMNS...]
[ODBC][14316][SQLDisconnect.c][204]
Entry:
Connection = 0x8119100
[ODBC][14316][SQLDisconnect.c][285]
Exit:[SQL_SUCCESS]
[ODBC][14316][SQLFreeHandle.c][268]
Entry:
Handle Type = 2
Input Handle = 0x8119100
[ODBC][14316][SQLFreeHandle.c][317]
Exit:[SQL_SUCCESS]
[ODBC][14316][SQLAllocHandle.c][345]
Entry:
Handle Type = 2
Input Handle = 0x8118b28
[ODBC][14316][SQLAllocHandle.c][463]
Exit:[SQL_SUCCESS]
Output Handle = 0x8119100
[ODBC][14316][SQLDriverConnect.c][678]
Entry:
Connection = 0x8119100
Window Hdl = (nil)
Str In = [DSN=sandbox;UID=db2inst1;PWD=********;][length = 38]
Str Out = 0xb7daa9f8
Str Out Max = 1024
Str Out Ptr = 0xbfb0a89c
Completion = 0
[ODBC][14316][SQLDriverConnect.c][826]
Exit:[SQL_SUCCESS]
[ODBC][14316][SQLDisconnect.c][204]
Entry:
Connection = 0x8119100
[ODBC][14316][SQLDisconnect.c][263]
Exit:[SQL_SUCCESS]
[ODBC][14316][SQLFreeHandle.c][268]
Entry:
Handle Type = 2
Input Handle = 0x8119100
Mantis conversion info:
- Mantis ID: 14610
- OS: Leopard 10.5.7 and Ubuntu 8.04
- OS Build: 10.5.7/8.04
- Platform: MAC and LINUX
- Version: 2.2.4