DBI MS SQL connection error

S

Saya

Hi all,

I have run into a problem with DBI connection to MS SQL server. I have
a script within which the below is executed:

my $DSN = 'driver={SQL
Server};Server=servername;database=dbname;Network=DBMSSOCN';
my $dbh = DBI->connect("DBI:ODBC:$DSN",'dbuser', 'dbpass') or die
$DBI::errstr;

my $sth = $dbh->prepare("Select categoryName, categoryID from
tblCategory Order By categoryName");

$sth->execute;

Now this script works on server1 and server2, but when I copy this
script to NewServer I get the following error:

DBI connect('driver={SQL Server};Server=servername,
1304;database=dbname;Network=
DBMSSOCN','dbname',...) failed: [Microsoft][ODBC SQL Server Driver]
[TCP/IP Sock
ets]General network error. Check your network documentation.
(SQL-08001)
[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]ConnectionOpen
(Connect()). (
SQL-01000)(DBD: db_login/SQLConnect err=-1) at E:\custom\perl
\Category.ipl line 16
Can't call method "prepare" on an undefined value at E:\custom\perl
\Category.ipl line 18.

I can ping servername (the sql server) from the NewServer. The DBI
version on all the servers is the same (1.38). Also the perl version
is the same (v5.8.2 built for MSWin32-x86-multi).

Does anyone have any hints/clues as what might be going wrong here.

Any help will be greatly appreciated.

regards
Saya
 
S

Saya

Sorry for the mishap but $DSN actuallu looks like the below line. I
was just experimenting when I removed 1304 from the servername.
my $DSN = 'driver={SQL Server};Server=servername,
1304;database=dbname;Network=DBMSSOCN';
 
T

Thrill5

You are using ODBC to connect to the database, did you create the DSN on the
new server?

Scott
Saya said:
Sorry for the mishap but $DSN actuallu looks like the below line. I
was just experimenting when I removed 1304 from the servername.
my $DSN = 'driver={SQL Server};Server=servername,
1304;database=dbname;Network=DBMSSOCN';

Hi all,

I have run into a problem with DBI connection to MS SQL server. I have
a script within which the below is executed:

my $DSN = 'driver={SQL
Server};Server=servername;database=dbname;Network=DBMSSOCN';
my $dbh = DBI->connect("DBI:ODBC:$DSN",'dbuser', 'dbpass') or die
$DBI::errstr;

my $sth = $dbh->prepare("Select categoryName, categoryID from
tblCategory Order By categoryName");

$sth->execute;

Now this script works on server1 and server2, but when I copy this
script to NewServer I get the following error:

DBI connect('driver={SQL Server};Server=servername,
1304;database=dbname;Network=
DBMSSOCN','dbname',...) failed: [Microsoft][ODBC SQL Server Driver]
[TCP/IP Sock
ets]General network error. Check your network documentation.
(SQL-08001)
[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]ConnectionOpen
(Connect()). (
SQL-01000)(DBD: db_login/SQLConnect err=-1) at E:\custom\perl
\Category.ipl line 16
Can't call method "prepare" on an undefined value at E:\custom\perl
\Category.ipl line 18.

I can ping servername (the sql server) from the NewServer. The DBI
version on all the servers is the same (1.38). Also the perl version
is the same (v5.8.2 built for MSWin32-x86-multi).

Does anyone have any hints/clues as what might be going wrong here.

Any help will be greatly appreciated.

regards
Saya
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top