Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: connecting Perl with MS SQL Server on NT using ODBC

by screamingeagle (Curate)
on Jul 01, 2002 at 22:37 UTC ( #178716=note: print w/ replies, xml ) Need Help??


in reply to connecting Perl with MS SQL Server on NT using ODBC

if you're running the script on unix and trying to connect to an NT-based SQL Server, you could try and use the FreeTDS library...
a) in the FreeTDS "interfaces" file, configure the connection to the SQL Server like this :

myserver query tcp tds4.2 10.0.2.1 1433
b) in your Perl script, include code which goes something like this :
$ENV{'SYBASE'} = "/freetds" unless $ENV{'SYBASE'}; my $dbh; $dbh = DBI->connect("dbi:Sybase:server=myserver",userid,password);

hth


Comment on Re: connecting Perl with MS SQL Server on NT using ODBC
Select or Download Code
Replies are listed 'Best First'.
Re^2: connecting Perl with MS SQL Server on NT using ODBC
by Secalles (Initiate) on Dec 29, 2011 at 16:30 UTC
    Hellow monks

    i'm getting a similar problem with SQL Server ( I'm on windows )

    use DBI; my $user = "rodrigo"; my $pass = "123456"; my $server = "localhost\\WHATSUP:3477"; my $database_name = "equip"; my $DSN = "driver={SQL Server};server=$server;database=$database_name; +uid=$user;pwd=$pass"; my $DBH = DBI->connect("DBI:ODBC:$DSN") or die "Couldn't open database +: $DBI::errstr\n";
    But i'm getting the following error:
    DBI connect('driver={SQL Server};server=localhost\WHATSUP:3477;databas +e=equip;uid=rodrigo;pwd=123456','',...) failed: [Microsoft][ODBC SQL +Server Driver][DBNETLIB]Invalid connection. (SQL-08001) [st ate was 08001 now 01000] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (ParseConn +ectParams()). (SQL-01000) at C :\fsecali\connectDB.pl line 9 Couldn't open database: [Microsoft][ODBC SQL Server Driver][DBNETLIB]I +nvalid connection. (SQL-08001) [state was 08001 now 01000] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (ParseConn +ectParams()). (SQL-01000)
    I have no idea what should i do. Thanks in advanced
      try
      my $server = "localhost\\WHATSUP;tcpip=3477";
      poj
        I still get an error
        DBI connect('driver={SQL Server};server=localhost\WHATSUP;tcpip=3477;d +atabase=equip;uid=rodrigo;pwd= 123456','',...) failed: [Microsoft][ODBC SQL Server Driver][DBNETLIB]S +QL Server does not exist or access denied. (SQL-08001) [state was 08001 now 01000] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect() +). (SQL-01000) [state was 0100 0 now 01S00] [Microsoft][ODBC SQL Server Driver]Invalid connection string attribute + (SQL-01S00) at C:\fsecali\con nectDB.pl line 9 Couldn't open database: [Microsoft][ODBC SQL Server Driver][DBNETLIB]S +QL Server does not exist or ac cess denied. (SQL-08001) [state was 08001 now 01000] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect() +). (SQL-01000) [state was 0100 0 now 01S00] [Microsoft][ODBC SQL Server Driver]Invalid connection string attribute + (SQL-01S00)
        Thanks

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://178716]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (17)
As of 2015-07-31 14:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (278 votes), past polls