Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • It took me awhile to figure out, but whenever I need to connect to several different databases of the same type through DBD::ODBC, I create a file dsn for the first one, then copy and paste the contents of the file (from c:\Program Files\Common Files\ODBC) into the program to use as a template. E.g., for SQL server (on my local machine) it was:
    my $dsn=<<EOT;
    DRIVER=SQL Server
    APP=Microsoft Open Database Connectivity

    $dsn =~ tr/\n/;/;
    my $dbh = DBI->connect("dbi:ODBC:$dsn", 'sa', '', {RaiseError=>1});
    (as you can see I have very secure login and passwords :-)
    • I should also mention that you can create a system dsn and just use that name directly in the "dbi:ODBC:$dsn" string, but that gets to be a hassle when there are alot of databases, or if you need to port the code to another machine(s) where the dsn's are not set up.