[freetds] Exececute procedure returns errors

David Keith dkeith at logisticshealth.com
Mon Jul 26 19:14:03 EDT 2004


I've been trying to track down a problem between Kylix, ODBCExpress,
AstaIO, unixODBC, freeTDS and MS SQL 2K. Looks like freeTDS may be the
culprit, although I'm not completly certain.  I'm attempting to execute
a stored procedure that has input params and returns one output param.
If I don't explicitly start/commit/end the transaction, I get an error,
here's a snippet from the freetds.log:


sql2tds.c:120 type=1
sql2tds.c:126
sql2tds.c:261
sql2tds.c:120 type=1
sql2tds.c:126
sql2tds.c:261
sql2tds.c:120 type=1
sql2tds.c:126
sql2tds.c:261
sql2tds.c:120 type=1
sql2tds.c:126
17:34:17.419563 setting column 3 NULL bit
tds_submit_query(): state is PENDING
17:34:17.419652 tds_client_msg: #20019: "Attempt to initiate a new SQL
Server operation with results pending.".  Connection state is now 1.





If I explicitly start/commit/end the transaction, here's what I get:





Tail-end of freetds.log:

                        StrLen Or Ind = 0x83f984c
[ODBC][2353][SQLBindCol.c][250]
                Exit:[SQL_SUCCESS]
[ODBC][2353][SQLSetStmtAttr.c][236]
                Entry:
                        Statement =
0x8400740
                        Attribute = SQL_ATTR_ROW_STATUS_PTR
                        Value = 0x840206c
                        StrLen = 0
[ODBC][2353][SQLSetStmtAttr.c][685]
                Exit:[SQL_SUCCESS]
[ODBC][2353][SQLFetch.c][151]
                Entry:
                        Statement = 0x8400740
[ODBC][2353][SQLFetch.c][343]
                Exit:[SQL_SUCCESS]
[ODBC][2353][SQLFetch.c][151]
                Entry:
                        Statement = 0x8400740
[ODBC][2353][SQLFetch.c][343]
                Exit:[SQL_SUCCESS]
[ODBC][2353][SQLFetch.c][151]
                Entry:
                        Statement = 0x8400740
[ODBC][2353][SQLFetch.c][343]
                Exit:[SQL_NO_DATA]
[ODBC][2353][SQLFreeStmt.c][133]
                Entry:
                        Statement =
0x8400740
                        Option = 0
[ODBC][2353][SQLFreeStmt.c][246]
                Exit:[SQL_SUCCESS]
[ODBC][2353][SQLSetConnectAttr.c][304]
                Entry:
                        Connection =
0x83875c8
                        Attribute =
SQL_ATTR_AUTOCOMMIT
                        Value = (nil)
                        StrLen = 0x4
[ODBC][2353][SQLSetConnectAttr.c][675]
                Exit:[SQL_ERROR]
                DIAG [HY000] [FreeTDS][SQL Server]Could not change
transaction status

[ODBC][2353][SQLGetDiagRec.c][632]
                Entry:
                        Connection =
0x83875c8
                        Rec Number = 1
                        SQLState =
0x412b5792
                        Native =
0x412b5894
                        Message Text =
0x412b5692
                        Buffer Length =
256
                        Text Len Ptr = 0x412b5892
[ODBC][2353][SQLGetDiagRec.c][669]
                Exit:[SQL_SUCCESS]
                        SQLState =
HY000
                        Native = 0x412b5894 ->
0
                        Message Text = [[FreeTDS][SQL Server]Could not
change transaction status]
[ODBC][2353][SQLGetDiagRec.c][632]
                Entry:
                        Connection =
0x83875c8
                        Rec Number = 2
                        SQLState =
0x412b5792
                        Native =
0x412b5894
                        Message Text =
0x412b5692
                        Buffer Length =
256
                        Text Len Ptr = 0x412b5892
[ODBC][2353][SQLGetDiagRec.c][669]
                Exit:[SQL_NO_DATA]


freetds.conf:


# Global settings, any value here may be overridden by a database
# server specific section
[global]
        # TDS protocol version
    tds version = 8

;    initial block size = 512

    # uses some fixes required for some bugged MSSQL 7.0 server that
    # return invalid data to big endian clients
    # NOTE TDS version 7.0 or 8.0 should be used instead
;    swap broken dates = no
;    swap broken money = no

    # Database server login method, if both server and domain
    # logins are enabled, domain login is tried first if a domain
    # is specified, and if that fails the server login will be used.
    # OBSOLETE
;    try server login = yes
;    try domain login = no

    # The default authentication domain, can be overridden by
    # specifying a username with a domain prefix, e.g. DOMAIN\username
    # OBSOLETE use DOMAIN\username as username
;    nt domain = WORKGROUP

    # If the server responds with different domain try that one?
    # OBSOLETE never been used
;    cross domain login = no

    # Whether to write a TDSDUMP file for diagnostic purposes
    # (setting this to /tmp is insecure on a multi-user system)
;    dump file = /tmp/freetds.log
;    debug level = 10

    # Command and connection timeouts
;    timeout = 10
;    connect timeout = 10

    # If you get out of memory errors, it may mean that your client
    # is trying to allocate a huge buffer for a TEXT field.
    # (Microsoft servers sometimes pretend TEXT columns are
    # 4 GB wide!)   If you have this problem, try setting
    # 'text size' to a more reasonable limit
    text size = 967,295


# A typical Microsoft SQL Server 2000 configuration
[DEV1]
    host = dev1
    port = 1433
    tds version = 8.0


What's strange is that if I start up a single user app that has the
ODBCExpress components on the app, and only uses one session, I can get
this to work. If I try to execute the storedproc via a threaded session
in my AstaIO daemon, I get the above errors.

Can anyone help?

Thanks.

David Keith





More information about the FreeTDS mailing list