RE: Connect to a remote MS SQL database



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@xxxxxxxxx]
Sent: Wednesday, January 24, 2007 2:55 PM
To: dbi-users@xxxxxxxx
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
.



Relevant Pages

  • Re: Sql Server 2005 Dev. Ed. on Windows Server 2003
    ... Check out this KB which is about transferring Logins: http://support.microsoft.com/kb/246133 ... Also, since this is running on a newly installed Windows Server 2003, is ... them from your older SQL Server instance to the newer one. ...
    (microsoft.public.sqlserver.setup)
  • Re: New Windows Infrastructure
    ... vendor's application runs on windows with an SQL database and I will also need a web server for a separate module which will allow our customers to access account data online. ... I would think that if the app runs on windows, I do not need the citrix server. ... It makes sense to have separate DCs though, because let's say you want to upgrade your Active Directory in two weeks time, with separate DCs it's easy, but if you've got a bunch of apps installed it could be a nightmare. ...
    (microsoft.public.win2000.setup_deployment)
  • How can I avoid using SQL Authentication with the Office Web Parts?
    ... We have a machine running Windows 2003 Server, IIS 6, and Windows SharePoint ... We are using Office Web Parts on several Web ... Part pages to display data retrieved from a SQL Server (SQL 2000 SP3 running ...
    (microsoft.public.sharepoint.portalserver.development)
  • How can I avoid using SQL Authentication with the Office Web Parts?
    ... We have a machine running Windows 2003 Server, IIS 6, and Windows SharePoint ... We are using Office Web Parts on several Web ... Part pages to display data retrieved from a SQL Server (SQL 2000 SP3 running ...
    (microsoft.public.office.developer.web.components)
  • How can I avoid using SQL Authentication with the Office Web Parts?
    ... We have a machine running Windows 2003 Server, IIS 6, and Windows SharePoint ... We are using Office Web Parts on several Web ... Part pages to display data retrieved from a SQL Server (SQL 2000 SP3 running ...
    (microsoft.public.inetserver.iis)