My team uses Perl (v 5.8.9, ActiveState) with DBD::ODBC to query various SQL Server databases. We mostly use the "dbi:ODBC:$DSN" form of connection string, since we have the ability to create system DSNs as needed.

This setup has been working fine under Windows Server 2003, but now we are trying to migrate to Windows Server 2008, and my database connections are failing.

Here's the error: DBI connect('OurDatabase','',...) failed: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (SQL-IM002)

Should I be focusing on specifying a default driver (if so, what and how?), or should I be focusing on the way I set up the OurDatabase data source name?

Update

Thanks to both of you for suggesting DSNless connections. I have gone and verified that I can connect without a DSN by saying

my $connection = 'dbi:ODBC:driver={SQL Server};' . 'Server=OurServer;' . 'Database=OurDatabase;' . 'Trusted_Connection=Yes' ; my $dbh = DBI->connect( $connection, undef, undef, { RaiseError => 1 } );

so this may be my solution. It means changing existing code (did we think we could migrate without any changes?), but it also means I can defer having to figure out the new security model that seems to be hiding my new system DSNs from my legacy code.


In reply to [answered] DBD::ODBC in Windows Server 2008 by Narveson

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.