[freetds] TDS Version problem

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Wed Feb 27 08:58:54 EST 2008


> 
> Hi, I am new to the list, so hello to all!
>  
> I am trying to configure PHP5 with UnixODBC and FreeTDS on 
> SLES10 to connect to an MS SQL2000 server and am having 
> problem making it all work properly.
> 
> The versions on SLES are UnixODBC 2.2.11, PHP 5.1.2-29.54, 
> and Apache 2.2.3-16.15. I have installed FreeTDS v0.83.dev.20080208.
>  

Please, if you can download 0.82 branch or 0.82rc1.

> FreeTDS works fine from cli with tsql. UnixODBC works fine 
> from cli with isql and I can query the database, but the same 
> query from PHP does not work. I am using a modified version 
> of the odbctest.php file that comes with UnixODBC (modified 
> to point to my server/DSN). Basically, if I change TDS 
> Version to 4.2 it works. With TDS version at 8.0 it doesn't. 
> The db server is SQL2000 so 8.0 should be the correct TDS 
> version. What gives? I have tried both the DSN-only style of 
> connections and the freetds.conf style, and neither work as 8.0.
>  
> The difference I can see in the sql.log from UnixODBC is this 
> error occurs when its set to 8.0:
> [ODBC][2535][SQLExtendedFetch.c][159]
>   Entry:            
>    Statement = 0x8024bed0            
>    Fetch Type = 1            
>    Row = 1            
>    PcRow = 0xbfc6473c            
>    Row Status = 0xbfc6474a
> [ODBC][2535][SQLExtendedFetch.c][316]
>   Exit:[SQL_ERROR]
>   DIAG [42000] [FreeTDS][SQL Server]sp_cursorfetch: The value 
> of parameter 'nrows' is invalid.
>  
> Note: I have PHP4 and Apache 1.3 servers connecting to this 
> database server with TDS version 8.0 in their freetds.conf, 
> so I don't think its a problem on the SQL server end.
> 
> Any help would be gratefully appreciated.
>  
> Thanks
>  
> Robin
>  
> Here's the relevant files:
>  
> ***************
> odbc.ini:
>  
> [TestERP7]
> Description = Test ERP7 Data Source
> Driver  = FreeTDS
> Database = iERP72
> Port  = 1433
> Server  = erp7.ndigital.com
> TDS_Version = 8.0
> 
> [TestERP7TDS]
> Description = Test ERP7 Data Source
> Driver  = FreeTDS
> Database = iERP72
> Port  = 1433
> ServerName = ERP7
> TDS_Version = 8.0
> ***************
> odbcinst.ini:
>  
> [FreeTDS]
> Description  = v0.83.dev with protocol v8.0
> Driver  = /usr/local/lib/libtdsodbc.so
> Setup  = /usr/lib/unixODBC/libtdsS.so
>  
> [ODBC]
> Trace  = Yes
> TraceFile  = /tmp/sql.log
> ForceTrace  = Yes
> Pooling  = No
>  
> **************
> freetds.conf
>  
> [global]
>         # TDS protocol version
>  tds version = 8.0
>  
>  dump file = /tmp/freetds.log
>  debug flags = 0xffff
>  text size = 64512
>  
> [ERP7]
>         host = erp7.ndigital.com
>         port = 1433
>         tds version = 8.0
> sql.log
> [ODBC][2535][__handles.c][444]
>   Exit:[SQL_SUCCESS]
>    Environment = 0x80208fc8
> [ODBC][2535][SQLAllocHandle.c][346]
>   Entry:
>    Handle Type = 2
>    Input Handle = 0x80208fc8
> [ODBC][2535][SQLAllocHandle.c][464]
>   Exit:[SQL_SUCCESS]
>    Output Handle = 0x80205d70
> [ODBC][2535][SQLConnect.c][3550]
>   Entry:            
>    Connection = 0x80205d70            
>    Server Name = [TestERP7][length = 8 (SQL_NTS)]            
>    User Name = [readerp][length = 7 (SQL_NTS)]            
>    Authentication = [*******][length = 7 (SQL_NTS)]
>   UNICODE Using encoding ASCII 'ISO8859-1' and UNICODE 'UCS-2LE'
>  
> [ODBC][2535][SQLConnect.c][4124]
>   Exit:[SQL_SUCCESS]
> [ODBC][2535][SQLAllocHandle.c][511]
>   Entry:
>    Handle Type = 3
>    Input Handle = 0x80205d70
> [ODBC][2535][SQLAllocHandle.c][873]
>   Exit:[SQL_SUCCESS]
>    Output Handle = 0x8024bed0
> [ODBC][2535][SQLGetInfo.c][214]
>   Entry:            
>    Connection = 0x80205d70            
>    Info Type = SQL_FETCH_DIRECTION (8)            
>    Info Value = 0xbfc6473c            
>    Buffer Length = 4            
>    StrLen = (nil)
> [ODBC][2535][SQLGetInfo.c][528]
>   Exit:[SQL_SUCCESS]
> [ODBC][2535][SQLSetStmtOption.c][174]
>   Entry:            
>    Statement = 0x8024bed0            
>    Option = SQL_ATTR_CURSOR_TYPE            
>    Value = 2
> [ODBC][2535][SQLSetStmtOption.c][370]
>   Exit:[SQL_SUCCESS]
> [ODBC][2535][SQLExecDirect.c][233]
>   Entry:            
>    Statement = 0x8024bed0            
>    SQL = [SELECT * FROM PRO][length = 17 (SQL_NTS)]
> [ODBC][2535][SQLExecDirect.c][496]
>   Exit:[SQL_SUCCESS]
> [ODBC][2535][SQLNumResultCols.c][149]
>   Entry:            
>    Statement = 0x8024bed0            
>    Column Count = 0x8024be84
> [ODBC][2535][SQLNumResultCols.c][234]
>   Exit:[SQL_SUCCESS]                
>    Count = 0x8024be84 -> 35
> [ODBC][2535][SQLColAttributes.c][267]
>   Entry:            
>    Statement = 0x8024bed0            
>    Column Number = 1            
>    Field Identifier = SQL_COLUMN_NAME            
>    Character Attr = 0x8025a798            
>    Buffer Length = 32            
>    String Length = 0xbfc6470a            
>    Numeric Attribute = (nil)
> [ODBC][2535][SQLColAttributes.c][584]
>   Exit:[SQL_SUCCESS]
> [ODBC][2535][SQLColAttributes.c][267]
>   Entry:            
>    Statement = 0x8024bed0            
>    Column Number = 1            
>    Field Identifier = SQL_DESC_CONCISE_TYPE            
>    Character Attr = (nil)            
>    Buffer Length = 0            
>    String Length = (nil)            
>    Numeric Attribute = 0x8025a7c0
> [ODBC][2535][SQLColAttributes.c][584]
>   Exit:[SQL_SUCCESS]
> [ODBC][2535][SQLColAttributes.c][267]
>   Entry:            
>    Statement = 0x8024bed0            
>    Column Number = 1            
>    Field Identifier = SQL_DESC_DISPLAY_SIZE            
>    Character Attr = (nil)            
>    Buffer Length = 0            
>    String Length = (nil)            
>    Numeric Attribute = 0xbfc64704
> [ODBC][2535][SQLColAttributes.c][584]
>   Exit:[SQL_SUCCESS]
> [ODBC][2535][SQLBindCol.c][165]
>   Entry:            
>    Statement = 0x8024bed0            
>    Column Number = 1            
>    Target Type = 1 SQL_CHAR            
>    Target Value = 0x80205b38            
>    Buffer Length = 26            
>    StrLen Or Ind = 0x8025a7bc
> [ODBC][2535][SQLBindCol.c][251]
>   Exit:[SQL_SUCCESS]
> [ODBC][2535][SQLColAttributes.c][267]
>   Entry:            
>    Statement = 0x8024bed0            
>    Column Number = 2            
>    Field Identifier = SQL_COLUMN_NAME            
>    Character Attr = 0x8025a7c4            
>    Buffer Length = 32            
>    String Length = 0xbfc6470a            
>    Numeric Attribute = (nil)
> [ODBC][2535][SQLColAttributes.c][584]
>   Exit:[SQL_SUCCESS]
> [ODBC][2535][SQLColAttributes.c][267]
>   Entry:            
>    Statement = 0x8024bed0            
>    Column Number = 2            
>    Field Identifier = SQL_DESC_CONCISE_TYPE            
>    Character Attr = (nil)            
>    Buffer Length = 0            
>    String Length = (nil)            
>    Numeric Attribute = 0x8025a7ec
> [ODBC][2535][SQLColAttributes.c][584]
>   Exit:[SQL_SUCCESS]
> [ODBC][2535][SQLColAttributes.c][267]
>   Entry:            
>    Statement = 0x8024bed0            
>    Column Number = 2            
>    Field Identifier = SQL_DESC_DISPLAY_SIZE            
>    Character Attr = (nil)            
>    Buffer Length = 0            
>    String Length = (nil)            
>    Numeric Attribute = 0xbfc64704
> [ODBC][2535][SQLColAttributes.c][584]
>   Exit:[SQL_SUCCESS]
> [ODBC][2535][SQLBindCol.c][165]
>   Entry:            
>    Statement = 0x8024bed0            
>    Column Number = 2            
>    Target Type = 1 SQL_CHAR            
>    Target Value = 0x80205b98            
>    Buffer Length = 11            
>    StrLen Or Ind = 0x8025a7e8
> [ODBC][2535][SQLBindCol.c][251]
>   Exit:[SQL_SUCCESS]
>  
> ******************************
> ***SNIP*** for repetitive rows of info (per table column)
> ******************************
>  
> [ODBC][2535][SQLExtendedFetch.c][159]
>   Entry:            
>    Statement = 0x8024bed0            
>    Fetch Type = 1            
>    Row = 1            
>    PcRow = 0xbfc6473c            
>    Row Status = 0xbfc6474a
> [ODBC][2535][SQLExtendedFetch.c][316]
>   Exit:[SQL_ERROR]
>   DIAG [42000] [FreeTDS][SQL Server]sp_cursorfetch: The value 
> of parameter 'nrows' is invalid.
>  

I don't undestand why unixODBC says [ODBC] and not [unixODBC]...
Probably it's a problem with client, which platform are you using? 32 or
64 bit ??

> [ODBC][2535][SQLFreeStmt.c][140]
>   Entry:            
>    Statement = 0x8024bed0            
>    Option = 1
> [ODBC][2535][SQLFreeHandle.c][365]
>   Entry:
>    Handle Type = 3
>    Input Handle = 0x8024bed0
> [ODBC][2535][SQLFreeHandle.c][462]
>   Exit:[SQL_SUCCESS]
> [ODBC][2535][SQLDisconnect.c][204]
>   Entry:            
>    Connection = 0x80205d70
> [ODBC][2535][SQLDisconnect.c][341]
>   Exit:[SQL_SUCCESS]
> [ODBC][2535][SQLFreeHandle.c][268]
>   Entry:
>    Handle Type = 2
>    Input Handle = 0x80205d70
> [ODBC][2535][SQLFreeHandle.c][317]
>   Exit:[SQL_SUCCESS]
> [ODBC][2535][SQLFreeHandle.c][203]
>   Entry:
>    Handle Type = 1
>    Input Handle = 0x80208fc8
> 

freddy77



More information about the FreeTDS mailing list