freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] I dunno whether this is FreeTDS or PyODBC or elsewhere...
- From: "James K. Lowden" <jklowden AT freetds.org>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] I dunno whether this is FreeTDS or PyODBC or elsewhere...
- Date: Fri, 25 May 2007 07:59:17 -0400
Luke Benstead wrote:
> Hi all,
>
> I'm trying to run a select query from an apache/mod_python program using
> PyODBC. The trouble is, no matter what I try only the first letter of
> the query is being sent so I end up with errors like this;
>
> ProgrammingError: ('42000', "[42000] [FreeTDS][SQL Server]Could not find
> stored procedure 'S'. (2812)")
>
> Loads of other queries work, and this one works from the interpreter but
> not from the program itself. I know that the full query is being passed
> into PyODBC, but I don't know where the rest is getting lost. Could
> someone let me know if this is a problem in FreeTDS?
It's pretty clear the request to FreeTDS is to send one UCS-2 character:
> util.c:119:Changing query state from IDLE to QUERYING
> mem.c:519:tds_free_all_results()
> write.c:134:tds_put_string converting 1 bytes of "S"
> write.c:162:tds_put_string wrote 2 bytes
^^^^^^^^^^^^^ nvarchar/ntext data, OK
which it sends:
> util.c:119:Changing query state from QUERYING to PENDING
> net.c:673:Sending packet
> 0000 01 01 00 0a 00 00 01 00-53 00 |........ S.|
>
> util.c:119:Changing query state from PENDING to READING
and of which the server complains:
> net.c:446:Received header
> 0000 04 01 00 78 00 40 01 00- |...x.@..|
>
> net.c:542:Received packet
> 0000 aa 64 00 fc 0a 00 00 3e-10 24 00 43 00 6f 00 75 |.d.....> .$.C.o.u|
> 0010 00 6c 00 64 00 20 00 6e-00 6f 00 74 00 20 00 66 |.l.d. .n .o.t. .f|
> 0020 00 69 00 6e 00 64 00 20-00 73 00 74 00 6f 00 72 |.i.n.d. .s.t.o.r|
> 0030 00 65 00 64 00 20 00 70-00 72 00 6f 00 63 00 65 |.e.d. .p .r.o.c.e|
> 0040 00 64 00 75 00 72 00 65-00 20 00 27 00 53 00 27 |.d.u.r.e . .'.S.'|
> 0050 00 2e 00 08 45 00 4d 00-4d 00 41 00 4e 00 55 00 |....E.M. M.A.N.U.|
> 0060 45 00 4c 00 00 01 00 fd-02 00 e0 00 00 00 00 00 |E.L..... ........|
>
> token.c:526:processing result tokens. marker is aa(ERROR)
> token.c:105:tds_process_default_tokens() marker is aa(ERROR)
You might try turning on the ODBC trace.
My guess -- you did want my guess, no? -- is it's one of two things.
Either 1) your API wants a length parameter and you're giving it a one by
mistake, or 2) the string is null terminated and you're giving it UCS-2
where it's expecting single-byte encoding, and it stops when it hits the
high byte (0x00) of the first character.
Even though you've checked, I'm placing my bet on an application error.
House rules, you know. ;-)
--jkl
-
[freetds] I dunno whether this is FreeTDS or PyODBC or elsewhere...,
Luke Benstead, 05/25/2007
- Re: [freetds] I dunno whether this is FreeTDS or PyODBC or elsewhere..., James K. Lowden, 05/25/2007
Archive powered by MHonArc 2.6.24.