Where possible, I use DSN-less connections to avoid the administrative overhead of setting up and maintaining the DSNs. If you use DSN-less connections, make sure your connection strings can easily be updated (i.e. don't hard code them in many places throughout your code).

Where DSNs are necessary, I generally use system DSNs but if the application and system are administered by different teams, coordinating changes can be problematic, depending on how well the teams work together.

I have used Win32::OLE to instantiate an "ADODB.Connection" object with "Provider=sqloledb" in the past. This doesn't require a DSN. If I wanted to use DBI, I would probably investigate DBD::ADO, but I haven't used it thus far. I don't often connect Perl applications to SQL Server.

You can find and set all the system and user DSNs in the registry. I don't know if there are other interfaces, but I have found direct manipulation of the registry easy enough for SQL Server connections that I have never bothered to find any other way of setting them up programmatically. To find user DSNs for users other than the currently logged on user you will have to search through the HKEY_USERS hive.


In reply to Re: user and system DSN by ig
in thread user and system DSN by mhoang

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.