To my brothers and sisters in the Monestary, whom I love; may you have peace, and may your code be free of errors.
I seek your wisdom on the matter of MS-SQL access in Perl. I have been using DBI with DBD::ODBC with success; however, ODBC is somewhat slow, and I do not require the portability it offers as my applications will only ever connect to MS-SQL (it is a corporate standard).
I seek a faster way to work with MS-SQL server resources, preferrably still using a DBI interface. Or, perhaps, some wise Monk can point out a resource that will help me optimize DBD::ODBC for MS-SQL Servers, especially over a slow WAN link (think ISDN).
Lest I be lax in providing the details required, I am using:
As an example of my current methodology, I do this:
use warnings; use strict; use Statements; # Internal Module use DBI; require DBD::ODBC; my $dbh = DBI->connect('DBI:ODBC:goober') or die "Unable to connect to Goober"; #Use NT Auth $dbh->{PrintError} = 0; $dbh->{AutoCommit} = 0; $dbh->{RaiseError} = 1; # We don't pass these to connect, because SQL Server seems to # randomly ignore them unless we do as above. my $sth; eval { $sth = $dbh->prepare( $QUERY{auth} ) }; if ($@) { die "Could not prepare $QUERY{auth}: $DBI::errstr ($@)"; } while (my $row = $sth->fetchrow_hashref) { #do things... }
Most of my code requires that I open a connection and then perform several SELECT, INSERT and/or DELETE statements; so, any optimization must have gains for all of those. Update: I do already realize savings by opening only one connection, then using it for all my statements.:Update
I humbly thank the Monestary for its wisdom.
In reply to Improving on MS-SQL over DBI and DBD::ODBC by radiantmatrix
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |