Skip Menu |

This queue is for tickets about the DBD-ODBC CPAN distribution.

Report information
The Basics
Id: 48304
Status: resolved
Priority: 0/
Queue: DBD-ODBC

People
Owner: Nobody in particular
Requestors: mockodin [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.22_3



Subject: DBD::ODBC - [Microsoft][SQL Server Native Client 10.0][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect.
Date: Wed, 29 Jul 2009 10:45:59 -0700
To: bug-DBD-ODBC [...] rt.cpan.org
From: Michael Thomas <mockodin [...] gmail.com>
Bug: DBD::ODBC::db do failed: [Microsoft][SQL Server Native Client 10.0][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 7 (""): Data type 0xE7 has an invalid data length or metadata length. (SQL-42000) [for Statement "INSERT INTO longdescs (bug_id,who,bug_when,thetext,isprivate) VALUES (?,?,?,?,?)"] at Bugzilla/DB/Mssql.pm line 626 Bugzilla::DB::Mssql::do(undef, 'INSERT INTO longdescs (bug_id,who,bug_when,thetext,isprivate)...', undef, 9, 1, '2009-07-28 17:45:59.353', 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 0) called at Bugzilla/Bug.pm line 540 Bugzilla::Bug::create('Bugzilla::Bug', 'HASH(0x408a098)') called at D:\WebRoot\Bugzilla\post_bug.cgi line 175 It appears that when inserting to a NVARCHAR(MAX) field in a MSSQL 2008 database, that the precision is being incorrectly calculated. NVARCHAR(MAX) behaves more inline with a text field in relation to how much data it will hold, I believe that no precision needs to be sent. Using Management Studio for mssql 2008 I have tested inserting up to 500k characters in to a nvarchar(max) field with no issues. http://msdn.microsoft.com/en-us/library/ms186939.aspx* nvarchar* [ ( n | *max* ) ] Variable-length Unicode character data. *n** *can be a value from 1 through 4,000. *max indicates that the maximum storage size is 2^31-1 bytes*. The storage size, in bytes, is two times the number of characters entered + 2 bytes. The data entered can be 0 characters in length. Environment: Windows 2008 SP2 64 Bit IIS7 ActiveState Perl version: 5.10 DBD::ODBC version: 2.22
On Wed Jul 29 13:51:35 2009, mockodin wrote: Show quoted text
> Bug: > DBD::ODBC::db do failed: [Microsoft][SQL Server Native Client > 10.0][SQL Server]The incoming tabular data stream (TDS) remote > procedure call (RPC) protocol stream is incorrect. Parameter 7 (""): > Data type 0xE7 has an invalid data length or metadata length. > (SQL-42000) [for Statement "INSERT INTO longdescs > (bug_id,who,bug_when,thetext,isprivate) > VALUES (?,?,?,?,?)"] at Bugzilla/DB/Mssql.pm line > 626 > Bugzilla::DB::Mssql::do(undef, 'INSERT INTO longdescs > (bug_id,who,bug_when,thetext,isprivate)...', undef, 9, 1, '2009-07-28 > 17:45:59.353', > 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', > 0) called at Bugzilla/Bug.pm line 540 > Bugzilla::Bug::create('Bugzilla::Bug', 'HASH(0x408a098)') called at > D:\WebRoot\Bugzilla\post_bug.cgi line 175 >
<snipped> Don't quite get this as there are only 5 parameter not 7. Anyway, any chance you could provide a small self contained working example I can use to reproduce and can be later used as a test. Something like, "create table xxx(a type)", "insert into xxx(?)". It would also be useful to know the native client driver version as there are a number around with some horrendous bugs in which DBD::ODBC attempts to workaround. Martin -- Martin J. Evans Wetherby, UK
Subject: Re: [rt.cpan.org #48304] DBD::ODBC - [Microsoft][SQL Server Native Client 10.0][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect.
Date: Wed, 29 Jul 2009 17:09:33 -0700
To: bug-DBD-ODBC [...] rt.cpan.org
From: Michael Thomas <mockodin [...] gmail.com>

Message body is not shown because sender requested not to inline it.

While building the script I found it is odder than I though: values longer than 2000 characters die UNLESS they are longer than 16383 at which point they work again I used a ranges of 0-20k in length for my test. I did test separately inserting lengths in the 64k range which worked fine. Attached a perl script file for testing. On Wed, Jul 29, 2009 at 12:00 PM, Martin J Evans via RT < bug-DBD-ODBC@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=48304 > > > On Wed Jul 29 13:51:35 2009, mockodin wrote:
> > Bug: > > DBD::ODBC::db do failed: [Microsoft][SQL Server Native Client > > 10.0][SQL Server]The incoming tabular data stream (TDS) remote > > procedure call (RPC) protocol stream is incorrect. Parameter 7 (""): > > Data type 0xE7 has an invalid data length or metadata length. > > (SQL-42000) [for Statement "INSERT INTO longdescs > > (bug_id,who,bug_when,thetext,isprivate) > > VALUES (?,?,?,?,?)"] at Bugzilla/DB/Mssql.pm line > > 626 > > Bugzilla::DB::Mssql::do(undef, 'INSERT INTO longdescs > > (bug_id,who,bug_when,thetext,isprivate)...', undef, 9, 1, '2009-07-28 > > 17:45:59.353', > > 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', > > 0) called at Bugzilla/Bug.pm line 540 > > Bugzilla::Bug::create('Bugzilla::Bug', 'HASH(0x408a098)') called at > > D:\WebRoot\Bugzilla\post_bug.cgi line 175 > >
> <snipped> > > Don't quite get this as there are only 5 parameter not 7. Anyway, any > chance you could provide a small self contained working example I can > use to reproduce and can be later used as a test. Something like, > "create table xxx(a type)", "insert into xxx(?)". > > It would also be useful to know the native client driver version as > there are a number around with some horrendous bugs in which DBD::ODBC > attempts to workaround. > > Martin > -- > Martin J. Evans > Wetherby, UK >
It's in the previous attachment but the driver version is for those not wanting to download to find out: SQL Server Native Client 10.0
Driver: SQL Server v 6.00.6002.18005 (MDAC) OK, but has other limitations with SQL 2008 Driver: SQL Native Client v 2005.90.3042.00 (Mssql 2005) Fail Driver: SQL Server Native Client 10.0 v 2007.100.2531.00 (Mssql 2008) Fail Both of the "Native" drivers fail at the same points when accessed from DBD::ODBC
Are you capable of build DBD::ODBC yourself if I was to propose a change to it? Martin -- Martin J. Evans Wetherby, UK
Subject: Re: [rt.cpan.org #48304] DBD::ODBC - [Microsoft][SQL Server Native Client 10.0][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect.
Date: Thu, 30 Jul 2009 09:37:16 -0700
To: bug-DBD-ODBC [...] rt.cpan.org
From: Michael Thomas <mockodin [...] gmail.com>
Not something I'm overly familiar with. Best bet is the ActiveState guys but I don't know how responsive they are. On Thu, Jul 30, 2009 at 1:05 AM, Martin J Evans via RT < bug-DBD-ODBC@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=48304 > > > Are you capable of build DBD::ODBC yourself if I was to propose a change > to it? > > Martin > -- > Martin J. Evans > Wetherby, UK >
On Thu Jul 30 12:37:35 2009, mockodin wrote: Show quoted text
> Not something I'm overly familiar with. Best bet is the ActiveState
guys but Show quoted text
> I don't know how responsive they are.
My problem is that I may have a fix but I cannot know if it fixes it for you and I can only the driver you are using at different versions. If you install MinGW from activestate you can build DBD::ODBC yourself. It is not hard. Are you prepared to/ have time to have a go? Martin -- Martin J. Evans Wetherby, UK
Might as well, give it a shot. Pulling down MinGW now.
On Thu Jul 30 12:54:58 2009, mockodin wrote: Show quoted text
> Might as well, give it a shot. Pulling down MinGW now.
ok - here goes. Install MinGW the download latest DBD::ODBC from CPAN which is 1.22. Unpack it into a dir and open cmd prompt in that dir. Edit dbdimp.c and search for the following code: /* * Yet another workaround for SQL Server native client. * If you have a varbinary(max) or varchar(max) you have to pass 0 * for the column_size or you get HY104 "Invalid precision value". * See rt_38977.t which causes this. * The versions of native client I've seen this with are: * 2007.100.1600.22 sqlncli10.dll driver version = ? * 2005.90.1399.00 SQLNCLI.DLL driver version = 09.00.1399 */ if ((imp_dbh->driver_type == DT_SQL_SERVER_NATIVE_CLIENT) && (phs->strlen_or_ind < 0) && (phs->param_size == 0)) { column_size = 0; } delete the line "(phs->strlen_or_ind < 0) &&". set DBI_DSN=dbi:ODBC:your_dsn_name set DBI_USER=your_database_user set DBI_PASS=your_database_password The rest depends on perl and cpan from ActiveState being on your path (which they should be). Run cpan and you should get a prompt you can enter at. If you have never used cpan before you may have to answer some questions first. at the cpan prompt do test . It should configure and build DBD::ODBC in the current dir and run the tests. If they work you can do: install . Hopefully, the issue you reported is then fixed :-) If you have problems it may be quicker to email me at mjevans at cpan dot org. Martin -- Martin J. Evans Wetherby, UK
Currently fighting with the compiler, it appears that when running make through cpan cpan[1]> make . Going to read 'D:\WebRoot\Perl\cpan\Metadata' Database was generated on Wed, 29 Jul 2009 09:27:12 GMT Running make for D:/WebRoot/Perl/cpan/build/DBD-ODBC-1.22/. CPAN.pm: Going to build D:/WebRoot/Perl/cpan/build/DBD-ODBC-1.22/. Set up gcc environment - 3.4.5 (mingw-vista special r3) Useless use of private variable in void context at Makefile.PL line 677. You are using a Perl configured with threading enabled. Please read the warnings in DBI about this. Press return to continue... Show quoted text
>>> Remember to actually *READ* the README file!
And re-read it if you have any problems. Checking if your kit is complete... Looks good Multiple copies of Driver.xst found in: D:/WebRoot/Perl/site/lib/auto/DBI/ D:/WebRoot/Perl/lib/auto/DBI/ at Makefile.PL line 114 Using DBI 1.609 (for perl 5.010000 on MSWin32-x64-multi-thread) installed in D:/WebRoot/Perl/site/lib/auto/DBI/ Note (probably harmless): No library found for ODBC32.LIB Note (probably harmless): No library found for -lkernel32 Note (probably harmless): No library found for -luser32 Note (probably harmless): No library found for -lgdi32 Note (probably harmless): No library found for -lwinspool Note (probably harmless): No library found for -lcomdlg32 Note (probably harmless): No library found for -ladvapi32 Note (probably harmless): No library found for -lshell32 Note (probably harmless): No library found for -lole32 Note (probably harmless): No library found for -loleaut32 Note (probably harmless): No library found for -lnetapi32 Note (probably harmless): No library found for -luuid Note (probably harmless): No library found for -lws2_32 Note (probably harmless): No library found for -lmpr Note (probably harmless): No library found for -lwinmm Note (probably harmless): No library found for -lversion Note (probably harmless): No library found for -lodbc32 Note (probably harmless): No library found for -lodbccp32 Note (probably harmless): No library found for -lbufferoverflowU Note (probably harmless): No library found for -lmsvcrt Multiple copies of Driver.xst found in: D:/WebRoot/Perl/site/lib/auto/DBI/ D:/WebRoot/Perl/lib/auto/DBI/ at Makefile.PL line 688 Using DBI 1.609 (for perl 5.010000 on MSWin32-x64-multi-thread) installed in D:/WebRoot/Perl/site/lib/auto/DBI/ Writing Makefile for DBD::ODBC The DBD::ODBC tests will use these values for the database connection: DBI_DSN=dbi:ODBC:BUGZILLA e.g. dbi:ODBC:demo DBI_USER=bugus DBI_PASS=bugs D:\WebRoot\Perl\bin\perl.exe -MExtUtils::Command -e "cp" -- Changes blib\lib\DBD\ODBC\Changes.pm D:\WebRoot\Perl\bin\perl.exe -MExtUtils::Command -e "cp" -- FAQ blib\lib\DBD\ODBC\FAQ.pm syntax error at -e line 1, next char ) Missing right curly or square bracket at -e line 1, at end of line Execution of -e aborted due to compilation errors. mingw32-make.exe: *** [pm_to_blib] Error 255 D:/WebRoot/Perl/cpan/build/DBD-ODBC-1.22/. mingw32-make.exe -- NOT OK Directory 'D:/WebRoot/Perl/cpan/build/DBD-ODBC-1.22/.' not below D:\WebRoot\Perl\cpan\build, will not store persistent state Failed during this command: D:/WebRoot/Perl/cpan/build/DBD-ODBC-1.22/. : make NO Apparent Code in Question (Makefile): pm_to_blib : $(TO_INST_PM) $(NOECHO) $(ABSPERLRUN) -MExtUtils::Install -e "pm_to_blib({{@ARGV}, '$(INST_LIB)\auto', q[$(PM_FILTER)], '$(PERM_DIR)')" -- \ ODBC.pm $(INST_LIB)\DBD\ODBC.pm $(NOECHO) $(TOUCH) pm_to_bli The Makefile is being generated but is doubling up most instances of { (left curly) Running Makefile.PL results in a properly formatted file. What I don't know is how to force cpan to use the existing Makefile without regenerating it.. Back to google I go.
Sounds as though it is generating a makefile for the wrong make. Once at the cpan prompt what does o conf show. The make command shown should match the make you are using which should be on your path and probably supplied by MinGW. You may need to change the make cpan is using or set MAKE=dmake or something like that. Martin -- Martin J. Evans Wetherby, UK
Subject: Re: [rt.cpan.org #48304] DBD::ODBC - [Microsoft][SQL Server Native Client 10.0][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect.
Date: Fri, 31 Jul 2009 13:34:15 -0700
To: bug-DBD-ODBC [...] rt.cpan.org
From: Michael Thomas <mockodin [...] gmail.com>
Can't find string terminator "@" anywhere before EOF at -e line 1. dmake: Error code 255, while making 'ODBC.bs' Progress... of sorts.
On Fri Jul 31 16:34:33 2009, mockodin wrote: Show quoted text
> Can't find string terminator "@" anywhere before EOF at -e line 1. > dmake: Error code 255, while making 'ODBC.bs' > > Progress... of sorts.
Let me know what version of activestate and windows you have and I'll find someone with a Windows box here to work through this. Martin -- Martin J. Evans Wetherby, UK
Subject: Re: [rt.cpan.org #48304] DBD::ODBC - [Microsoft][SQL Server Native Client 10.0][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect.
Date: Mon, 3 Aug 2009 09:29:56 -0700
To: bug-DBD-ODBC [...] rt.cpan.org
From: Michael Thomas <mockodin [...] gmail.com>
Windows 2008 Std SP2 ActivePerl-5.10.0.1005-MSWin32-x64-290470 I'm also working on rebuilding a fresh environment, if I get it up and running and have better results I'll update.
On Mon Aug 03 12:30:20 2009, mockodin wrote: Show quoted text
> Windows 2008 Std SP2 > ActivePerl-5.10.0.1005-MSWin32-x64-290470 > > I'm also working on rebuilding a fresh environment, if I get it up and > running and have better results I'll update.
I've tried with ActivePerl 1005 for x86/32 bit but with MS Developer studio installed (instead of MinGW) and it built fine with "test .". Interestingly, o conf in cpan shows make set to nothing but a dmake file is output - I've no idea why (all this is so much more simple on UNIX :-( ) I need to get hold of a machine without MS developer studio (which I am really loathe to uninstall on my test machine as it works) and perhaps a 64bit machine to be even closer to your setup. I'll try to find a machine tomorrow which I can do this on. Thanks for your efforts and patience. To be honest, the Windows world and in particular all the different versions of the SQL Server Driver for Windows are the bane of my life. Every time I make even the smallest change I live in fear of it breaking something which I cannot test as it is virtually impossible for me to have all the possible windows scenarios and drivers. Let me know if you get anywhere and I'll do likewise. Martin -- Martin J. Evans Wetherby, UK
On Mon Aug 03 12:30:20 2009, mockodin wrote: Show quoted text
> Windows 2008 Std SP2 > ActivePerl-5.10.0.1005-MSWin32-x64-290470 > > I'm also working on rebuilding a fresh environment, if I get it up and > running and have better results I'll update.
What version of ExtUtils::MakeMaker are you running? H:\temp\DBD-ODBC-1.22>perl -MExtUtils::MakeMaker -le "print $ExtUtils::MakeMaker ::VERSION;" 6.42_01 It may be an issue in ExtUtils::MakeMaker - stab in the dark. Martin -- Martin J. Evans Wetherby, UK
Subject: Re: [rt.cpan.org #48304] DBD::ODBC - [Microsoft][SQL Server Native Client 10.0][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect.
Date: Mon, 3 Aug 2009 15:28:01 -0700
To: bug-DBD-ODBC [...] rt.cpan.org
From: Michael Thomas <mockodin [...] gmail.com>
Microsoft Windows [Version 6.0.6002] Copyright (c) 2006 Microsoft Corporation. All rights reserved. Show quoted text
>perl -MExtUtils::MakeMaker -le "print $ExtUtils::MakeMaker::VERSION;"
6.42_01
On Mon Aug 03 18:28:20 2009, mockodin wrote: Show quoted text
> Microsoft Windows [Version 6.0.6002] > Copyright (c) 2006 Microsoft Corporation. All rights reserved. >
> >perl -MExtUtils::MakeMaker -le "print $ExtUtils::MakeMaker::VERSION;"
> 6.42_01
I've located a 64bit windows machine now. Where did you get a ppm of MinGW for 64bit activestate from? ppm install MinGW does not find anything. I found a separate download of MinGW but it does not include dmake. Martin -- Martin J. Evans Wetherby, UK
Subject: Re: [rt.cpan.org #48304] DBD::ODBC - [Microsoft][SQL Server Native Client 10.0][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect.
Date: Tue, 4 Aug 2009 11:13:08 -0700
To: bug-DBD-ODBC [...] rt.cpan.org
From: Michael Thomas <mockodin [...] gmail.com>
I manually installed them. That said I was able to get things working. The issue occurred under 32Bit as well. Part of my initial setup issue were that I have Visual Studio 2008 installed and CPAN detected it and tried to use it. Which was actually the right choice as everything compiled on the first try once I used CPAN with VS2008. I updated the version number to 1.23 in my test build so that I would know which version I was running :-) F:\>perl testODBC.pl Testing DBD::ODBC Version: 1.23 Connecting to [xxxxx].[test] as bugs ...Connected Successfully Previous tests proved the break points were from 2001 through 16383 because we know the range needing to be corrected Test 1 is limited to 0-20k lengths Test 1: Attempting to add 20K rows of data, starting at a length of 1, each row will increase in length by 1 till we finish or die Test Successful! No Insert Errors Found Exiting Test - Status PASS F:\>ppm install -f DBD::ODBC Downloading DBD-ODBC-1.22...done Unpacking DBD-ODBC-1.22...done Generating HTML for DBD-ODBC-1.22...done Updating files in site area...done 10 files updated F:\>perl testODBC.pl Testing DBD::ODBC Version: 1.22 Connecting to [xxx].[test] as bugs ...Connected Successfully Previous tests proved the break points were from 2001 through 16383 because we know the range needing to be corrected Test 1 is limited to 0-20k lengths Test 1: Attempting to add 20K rows of data, starting at a length of 1, each row will increase in length by 1 till we finish or die Failed at length of 2001 Test 2: Attempting to add 20K rows of data, starting at a length of 20k, each row will decrease in length by 1 till we finish or die Failed at length of 16383 Exiting Test - Status FAIL
On Tue Aug 04 14:13:29 2009, mockodin wrote: Show quoted text
> I manually installed them. > > That said I was able to get things working. The issue occurred under 32Bit > as well. > Part of my initial setup issue were that I have Visual Studio 2008
installed Show quoted text
> and CPAN detected it and tried to use it. Which was actually the right > choice as everything compiled on the first try once I used CPAN with
VS2008. Show quoted text
>
Argh - I did not realise you already had MS devstudio - that explains some of it. What I meant about MinGW was a ppm install MinGW did not work for me - it was not found in the ppm repository that the out of the box activestate 5.10 x64 came with. <snipped output> Forgive me Michael but I've slightly lost sight of the problem now. Is your output showing with a changed DBD::ODBC (as I susggested) it is now working but with the stock 1.22 it fails. If that is the case I'll make this change permanent and do a new release soon. Thanks again for you patience and persistence. Martin -- Martin J. Evans Wetherby, UK
Subject: Re: [rt.cpan.org #48304] DBD::ODBC - [Microsoft][SQL Server Native Client 10.0][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect.
Date: Tue, 4 Aug 2009 15:44:59 -0700
To: bug-DBD-ODBC [...] rt.cpan.org
From: Michael Thomas <mockodin [...] gmail.com>
Show quoted text
> > Is your output showing with a changed DBD::ODBC (as I suggested) it is now > working but with the stock 1.22 it fails. If that is the case I'll make > this change permanent and do a new release soon. > > Correct, the first half was with modified code per your instructions, the
2nd part was with release version (1.22). I included the retest under 1.22 only to verify the issue occured under 32Bit as well as under the originally reported 64Bit, in case anyone question it later. So yes the change you recommended did appear to solve the issue.
On Tue Aug 04 18:45:19 2009, mockodin wrote: Show quoted text
> > Correct, the first half was with modified code per your
instructions, the Show quoted text
> 2nd part was with release version (1.22). I included the retest under 1.22 > only to verify the issue occured under 32Bit as well as under the
originally Show quoted text
> reported 64Bit, in case anyone question it later. So yes the change you > recommended did appear to solve the issue.
OK, I'll commit this change and prepare a new release. I'll probably do a development release first just in case it causes any problems. Martin -- Martin J. Evans Wetherby, UK