Re: FreeTDS and MSSQL

Venkat Lak <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
Hi
   
  Thanks for the quick reply.
   
  I think the server is not rejecting it, as the same query works
  fine in MS Query Analyzer. Also the log does not have an
  'ERROR' marker - the last marker is:
   
  06:50:21.015 3312 (token.c:536):processing result tokens.  marker is  fd(DONE)
   
  And soon after the query is sent, it returns with failure:
   
  06:50:21.015 3312 (util.c:157):Changed query state from QUERYING to PENDING
06:50:21.015 3312 (net.c:743):Sending packet
0000 01 01 00 7a 00 00 00 00-73 65 6c 65 63 74 20 74 |...z.... select t|
0010 72 61 6e 73 61 63 74 69-6f 6e 5f 69 64 20 66 72 |ransacti on_id fr|
0020 6f 6d 20 56 54 41 5f 54-52 41 4e 53 41 43 54 49 |om VTA_T RANSACTI|
0030 4f 4e 44 45 54 41 49 4c-53 20 77 68 65 72 65 20 |ONDETAIL S where |
0040 74 72 61 6e 73 61 63 74-69 6f 6e 5f 69 64 20 3d |transact ion_id =|
0050 27 31 35 39 36 33 63 38-35 2d 30 39 66 63 2d 34 |'15963c8 5-09fc-4|
0060 63 34 66 2d 39 33 61 62-2d 61 31 32 34 32 61 63 |c4f-93ab -a1242ac|
0070 35 65 61 63 34 2d 31 30-27 20                   |5eac4-10 ' |
  06:50:21.015 3312 (dblib.c:4297):dbsqlok(010B7BC0)
06:50:22.015 3312 (net.c:363):error: select(2) returned 0x2726, "Unknown error"
06:50:22.015 3312 (util.c:328):tdserror(010B7A08, 010B8340, 20004, 10022)
06:50:22.015 3312 (dblib.c:7583):dbperror(010B7BC0, 20004, 0)
06:50:22.015 3312 (dblib.c:7646):"Read from the server failed", client returns 2 (INT_CANCEL)
06:50:22.015 3312 (util.c:364):tdserror: client library returned TDS_INT_CANCEL(2)
06:50:22.015 3312 (util.c:385):tdserror: returning TDS_INT_CANCEL(2)
06:50:22.015 3312 (util.c:157):Changed query state from PENDING to DEAD
   
  And, I am using FreeTDS within a PHP application. My client is 
  a Windows XP machine and so I am using this windows
  implmentation of FreeTDS:
   
  http://kromann.info/php5_1-Release_TS/php_dblib.dll
   
  and the version I mentioned was from the log file:
   
  06:50:20.671 3312 (log.c:190):Starting log file for FreeTDS 0.63
 on 2008-04-21 06:50:20 with debug flags 0xffff.
   
  Is there a different implementation ? If so please let me
  know.
   
  Thanks again,
  Venkat
  

"James K. Lowden" <[email protected]> wrote:
  Venkat Lak wrote:
> I use FreeTDS 0.63 to access a MSSQL server 2000 (version 
> 8.00.2039). It connects fine and my queries work except for
> one - when I use a GUID string (a varchar column) in the
> where clause it fails:
> 
> select * from table where
> tid='bb8c5fe8-5e25-4181-8c3f-9ed12b6f9eb7-ed';
> 
> However, when I do:
> 
> select * from table where
> tid>='bb8c5fe8-5e25-4181-8c3f-9ed12b6f9eb7-ed';
> 
> it works ! It also works for '>','<','<=' and '<>' comparison
> operators - just that '=' fails. In the tds dump I get:
> 
> dblib.c:4297:dbsqlok(010B7BC0)
> net.c:363:error: select(2) returned 0x2726, "Unknown error"
> util.c:328:tdserror(010B7A08, 010B8340, 20004, 10022)
> dblib.c:7583:dbperror(010B7BC0, 20004, 0)

Um, no. tdserror() was introduced in January 2007, long after 0.63 was
released. 

FreeTDS doesn't interpret SQL. The server is rejecting it, and it's very
likely that it returns a message before it closes the connection. Look
for an error token in the TDSDUMP log:

$ grep marker dump | grep ERROR
token.c:525:processing result tokens. marker is aa(ERROR)
token.c:105:tds_process_default_tokens() marker is aa(ERROR)

The message text will be nearby. 

HTH. 

--jkl
_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds


       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.