I don't use Class::DBI::Loaderso I could be out in left field here, but I normally just do something like the stuff hidden behind this <readmore>tag. It's for SQLite, so you'll need to adjust the connection string for MS SQL Server, MySQL, PostGreSQL, and Oracle.

#!/usr/bin/perl use strict; use warnings; use DBI; use Data::Dumper; ###################################################################### +########## # SQLite v3+ ###################################################################### +########## my $db_parameters = { AutoCommit => 0, PrintError => 1, }; my $db_name = 'test.db'; my @sql_statements = ( 'create table TST (RECNUM integer primary key, USRNAM character(30 +) );', 'insert into TST values (1, \'burnsg\');', 'insert into TST values (2, \'adamss\');', 'select * from TST order by USRNAM;', ); # Connect my $db_connection_string = "dbi:SQLite:dbname=$db_name"; my $db_handle = DBI->connect($db_connection_string,"","",$db_parameter +s); if ($db_handle->err()) { print "ERROR: $DBI::errstr"; } # Submit SQL statements foreach my $sql_statement (@sql_statements) { my $sql_handle; if ($sql_statement =~ /^\s*SELECT\s+/i) { # SELECT statement: $sql_handle = $db_handle->prepare($sql_statement); if ($db_handle->err()) { print "ERROR: $DBI::errstr"; } else { my $qryres = $sql_handle->execute; if ($db_handle->err()) { print "ERROR: $DBI::errstr"; } else { my @dbrref = @{ $sql_handle->fetchall_arrayref({}) }; print Dumper \@dbrref; } } } else { # Non-SELECT statement $sql_handle = $db_handle->do("$sql_statement"); if ($db_handle->err()) { print "ERROR: $DBI::errstr"; } } } # Commit and disconnect { $db_handle->commit(); if ($db_handle->err()) { print "ERROR: $DBI::errstr"; } $db_handle->disconnect(); if ($db_handle->err()) { print "ERROR: $DBI::errstr"; } } exit;

In reply to Re: DBI for SQL Server issue - can't locate object method "set_sql" via package "Class::DBI::MSSQL by marinersk
in thread DBI for SQL Server issue - can't locate object method "set_sql" via package "Class::DBI::MSSQL by newbieperlperson

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.