Skip to Content.
Sympa Menu

freetds - [freetds] RPC/Packet Type 3 Format

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: <lists-tds AT mymailfilter.net>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] RPC/Packet Type 3 Format
  • Date: Thu, 17 Jul 2003 12:29:16 -0500 (CDT)

Is the format of the RPC packet known or available somewhere? I'm looking
for the byte break-down of the TDS packet type 3. I have a sample packet,
and I'm having some trouble decoding the thing...

------------------------||TDS Packet starts w/byte 7 (03)

0030 f7 48 ca 56 00 00 03 01 00 fa 00 00 01 00 ff ff .H.V............
0040 0b 00 00 00 00 01 26 04 04 ff ff ff ff 00 00 63 ......&........c
0050 00 00 00 00 09 04 00 01 32 ff ff ff ff 00 00 63 ........2......c
0060 ba 00 00 00 09 04 00 01 32 ba 00 00 00 64 00 65 ........2....d.e
0070 00 63 00 6c 00 61 00 72 00 65 00 20 00 40 00 70 .c.l.a.r.e. .@.p
0080 00 34 00 20 00 69 00 6e 00 74 00 65 00 67 00 65 .4. .i.n.t.e.g.e
0090 00 72 00 0d 00 0a 00 65 00 78 00 65 00 63 00 20 .r.....e.x.e.c.
00a0 00 6a 00 64 00 5f 00 74 00 65 00 73 00 74 00 5f .j.d._.t.e.s.t._
00b0 00 30 00 30 00 31 00 20 00 40 00 70 00 31 00 3d .0.0.1. .@.p.1.=
00c0 00 33 00 2c 00 20 00 40 00 70 00 32 00 3d 00 27 .3.,. .@.p.2.=.'
00d0 00 74 00 65 00 73 00 74 00 27 00 2c 00 20 00 40 .t.e.s.t.'.,. .@
00e0 00 70 00 33 00 3d 00 20 00 27 00 30 00 37 00 2f .p.3.=. .'.0.7./
00f0 00 31 00 37 00 2f 00 32 00 30 00 30 00 33 00 27 .1.7./.2.0.0.3.'
0100 00 2c 00 20 00 40 00 40 00 70 00 34 00 3d 00 40 .,. .@.@.p.4.=.@
0110 00 70 00 34 00 20 00 6f 00 75 00 74 00 70 00 75 .p.4. .o.u.t.p.u
0120 00 74 00 0d 00 0a 00 00 00 26 04 04 01 00 00 00 .t.......&......

The actual SQL code is:

declare @p4 integer
exec jd_test_001 @p1=3, @p2='test', @p3= '07/17/2003', @@p4=@p4 output

I'm confused about what appears to be some flags and info preceding the
actual SQL code.

0030 ff ff .H.V............
0040 0b 00 00 00 00 01 26 04 04 ff ff ff ff 00 00 63 ......&........c
0050 00 00 00 00 09 04 00 01 32 ff ff ff ff 00 00 63 ........2......c
0060 ba 00 00 00 09 04 00 01 32 ba 00 00 00 64 00 65 ........2....d.e

Starting with the first byte after the TDS [8-byte] header, and extending
to the last byte before the start of the SQL -- what is the meaning of the
bytes and/or how are they interpretted or constructed. This data does not
appear to be "fixed" as some procedures have it, and others do not (seem
to start with the actual code). Is this related to the OUPUT parameter?

Also, there are sometimes characters inserted within the SQL code (in
between parameters and such (N' 2 & etc). Are the rules surrounding this
known?

And finally, there is a bit of a "trailer" on the end of each packet. Can
someone explain what the trailer is made up of.

0120 00 74 00 0d 00 0a 00 00 00 26 04 04 01 00 00 00 .t.......&......
---------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The actualy SQL code ends with byte 3 above, what data is in the remaining
bytes?

Any insight will be greatly appreciated.

Thank you.





Archive powered by MHonArc 2.6.24.

Top of Page