"just fine" is a little too vague, posting a sample command line session would be better.

If the tsql you're using is this one: http://linux.die.net/man/1/tsql , then the problem is that it enters an interactive shell that you have to exit from, that's why it's hanging there (it's waiting for input). A quick Googling suggests that http://linux.die.net/man/1/bsqlodbc or http://linux.die.net/man/1/bsqldb might be better suited for your use case.

If you're going to be running multiple queries on the database in one session, then yes, DBI is the way to go. However, for a single SELECT query run once every few minutes that just spits out a value, backticks are often an acceptable solution. A little better might be the capture function from IPC::System::Simple (that has better error handling), and IPC::Run even lets you set timeouts on external commands.


In reply to Re^3: Trying to connect to MSSQL and return result. Script hangs indefinitely. by Anonymous Monk
in thread Trying to connect to MSSQL and return result. Script hangs indefinitely. by Logic_Bomb421

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.