<?xml version="1.0" encoding="windows-1252"?>
<node id="178615" title="connecting Perl with MS SQL Server on NT using ODBC" created="2002-07-01 13:32:41" updated="2005-06-22 22:04:28">
<type id="115">
perlquestion</type>
<author id="178114">
peacemaker1820</author>
<data>
<field name="doctext">
Hello Monks.
&lt;p&gt;This is the code I have

&lt;code&gt;print "HTTP/1.0 200 OK\n";
print "Content-Type: text/html\n\n";
print "&lt;HTML&gt;&lt;HEAD&gt;&lt;TITLE&gt;&lt;/TITLE&gt;&lt;/HEAD&gt;\n";
print "&lt;BODY&gt;\n";

use DBI;
use CGI;

my $DSN = 'driver={SQL Server};Server=SRV01;Database=SDPSI;UID=my_id;PWD=my_pswd';

#Connect the database handle.
$dbh = DBI-&gt;connect("DBI:ODBC:$DSN") or die "$DBI::errstr\n";

#If connected, print...
print("It's in.");

#Close connection when finished:
$dbh-&gt;disconnect;
print "hello there";
print "&lt;/BODY&gt;\n";
print "&lt;/HTML&gt;\n";
&lt;/code&gt;
&lt;br&gt;When I compile this code on my machine it gives me the following error:
&lt;br&gt;
&lt;br&gt;DBI-&gt;connect(driver={SQL Server};Server=SRV01;Database=SDPSI;uid=u_id;pwd=u_pswd ) failed: [Microsoft][ODBC Driver Manager] 
Invalid string or buffer length (SQL-S1090)(DBD: db_login/SQLConnect err=-1) at database.pl line 12
[Microsoft][ODBC Driver Manager] Invalid string or buffer length (SQL-S1090)(DBD : db_login/SQLConnect err=-1)
&lt;p&gt;&lt;H3&gt;Does ANYONE know what to do???&lt;/h3&gt;
&lt;p&gt;
&lt;small&gt;Edit by [dws] to add code tags&lt;/small&gt;
</field>
</data>
</node>
