Revered monks,

I come to you in a time of great need. I've inherited a web application running on Apache on a Windows server. It uses DBD::ODBC to connect to a Microsoft SQL Server.

I'm now working on transitioning the thing over to a Linux machine using FreeTDS through DBD::ODBC.

The problem I'm facing is that there seems to be a difference in implementation which boils down to this:

#!/usr/bin/perl use strict; use warnings; use DBI; our $db = DBI->connect('dbi:ODBC:DATABASE', 'USER', 'PASSWORD', { RaiseError => 1, AutoCommit => 1 } ); my $test=$db->prepare("select getdate()") or die($!); $test->execute(); print $test->fetchrow_array(); my $test2=$db->prepare("select getdate()") or die($!); $test2->execute(); print $test2->fetchrow_array();

On the Windows system I get the expected output (the date twice). On the Linux machine I get:

DBD::ODBC::st execute failed: unixODBCFreeTDSSQL ServerInvalid cursor state (SQL-24000) at testpm.cgi line 17.

twice. Line 17 is the second execute line. I get the output from the first statement but the script dies when reaching the second execute.

Now, for me this boils down to two questions:

  1. Is it a bad idea not to use a loop to fetch all data from a handle even if you know beyond reasonable doubt that there isn't any more? Meaning: Should I start rewriting the places where this occurs?
  2. Might this be a bug in FreeTDS that's worth reporting?

Thanks for your time.

Dennis


In reply to FreeTDS (Linux) vs. SQLSRV32.dll (Windows) via ODBC by pvbcharon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.