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

RE: Connect to a remote MS SQL database

Thread Previous | Thread Next
From:
CAMPBELL, BRIAN D
Date:
January 30, 2007 13:07
Subject:
RE: Connect to a remote MS SQL database
Message ID:
A2066D3A76185142903B298874762B702DB6FB@ILEXC2U03.ndc.lucent.com
FYI, This works for me.  

my $dbh = DBI->connect('DBI:ODBC:Driver={SQL
Server};server={SVR12};database={Review};');

Perl 5.8.7
DBI 1.53
DBD-ODBC 1.13
Perl is running on Windows XP, and connecting to a SQL server.

Our captilizations differ, but that's not an issue. I tried your
capitalizations and they worked too.  I tried your embedded newlines and
that worked too.

I'm not sure if this is the right terminology: the server recognizes the
login domain, and so I'm automatically authenticated.  I don't need a
userid and password.  Indeed I need to leave them off.  If I add a
userid and password the server returns a login failure.  I don't know if
this would apply in your environment.

-----Original Message-----
From: Jordan Mueller [mailto:jordanmueller@gmail.com] 
Sent: Wednesday, January 24, 2007 2:55 PM
To: dbi-users@perl.org
Subject: Connect to a remote MS SQL database

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 Previous | 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