I have separate scripts that tap into both Access databases and an MS SQL server. I imagine that it would be easy enough to combine both calls into one script, get the data you need and do what you want.

I use Win32::ODBC for my connection to the MS SQL Server. I like the syntax that it uses to call stored procedures. A sample connection into the database would be something like:

my $db = new Win32::ODBC( "DSN=INFO;UID=id;PWD=password" ); if( ! $db ) { die "Error connecting: " . Win32::ODBC::Error() . "\n"; }

For my Access database connections I use dbi::ODBC and the call looks like:

my $dbh = DBI->connect("dbi:ODBC:INFO","username","password") or die "Unable to connect: " . $DBI::errstr . "\n";

Note the differences in the way the username and passwords are called in each case. You can either hard code the username and password into the call, or you can place them in a file out of the document root and refer to the file in your call. The "INFO" in each call points to the DSN that is set up through the Windows Admin tools on the server to connect to the database. I'm assuming if you have a DBA background, then you know how to do that.

Most of the information that I needed to understand how to use DBI and Win32::ODBC came from the documentation for the modules and from web searches. Dave Roth has helpful information on Win32::ODBC.

Hope this helps.


In reply to Re: Accessing Access DB with DBI by WhiteBird
in thread Accessing Access DB with DBI by skyler

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.