develooper Front page | perl.dbi.users | Postings from January 2007

Connect to a remote MS SQL database

Thread Next
From:
Jordan Mueller
Date:
January 24, 2007 13:55
Subject:
Connect to a remote MS SQL database
Message ID:
64a3d0b70701241355i1cb2a565qc165d52b11e0f292@mail.gmail.com
Hello,

** First time posting, please excuse possible novice mistakes **

SETUP:
web server: win 32 Apache running on a windows 2003 server machine,
activePerl
database: MS SQL hosted on a separate windows server at my organization.

PROBLEM:
I cannot get my $dbh -> connect() line to work.

I have spent all day reading different documentation for DBI and DBD::ODBC,
as well as
different websites, and I can't make a connection.

Does anyone have experience with these Microsoft beasts?

Here is the sample code that I have hobbled together from different docs:

++++++++++++++++++++++++++++++++++++++++++++++++++++
use DBI;
use strict;
use diagnostics;

my $data_source = 'driver={SQL Server};Server=<server_name>;
                   database=<database_name>;uid=<username>;
                   pwd=<passwrd>;';

my $dbh = DBI->connect("dbi:ODBC:$data_source") or die "$DBI::errstr";
++++++++++++++++++++++++++++++++++++++++++++++++++++

I do not have the errors, because I do not have read access to the error
logs right now, and
CGI::carp is not working correctly.

Also, I checked and ODBC is listed as an available driver for DBI.


I would appreciate if anyone has some light to shed on the problem.


Thank you,

Jordan Mueller
Data Manager
Brigham and Women's Hospital

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About