Hi

I am able to connect to my remote sql server through SQL express Managment
console.

I have configured my sqlserver to allow remote connections.

Thanks,
siva


On 4/16/09, Jayesh Thakrar <j_thak...@yahoo.com> wrote:
>
>
> From what I understand, the Express Edition of MS SQL Server does not
> support connections from remote machines/hosts out-of-the-box.
>
> Look up the Microsoft KB article and turn-on support for remote connections
> and then try.
>
> http://support.microsoft.com/kb/914277
>
> -- Jayesh
>
>
>
>
> ----- Original Message ----
> From: perl pra <perl...@gmail.com>
> To: Beginners List <beginners@perl.org>
> Sent: Thursday, April 16, 2009 4:27:14 AM
> Subject: perl script errors while connecting to sql server
>
> Hi Gurus,
>
> I need to connect to MSSQL SERVER (express edition on remote system)
> through
> a perl script. But I get the following error with the code below can any
> body help me in that.
>
> ############ ERROR
>
> Use of uninitialized value $Win32::ODBC::ErrConn in concatenation (.) or
> string
> at C:/Perl/lib/Win32/ODBC.pm line 785.
> Unable to connect to DSN Databasesysadm:[17] [] "[Microsoft][ODBC SQL
> Server
> Dri
> ver][TCP/IP Sockets]SQL Server does not exist or access denied."
>
> ############ ERROR
>
> ################## CODE SNIP
>
> my $user="sqlserver";
> my $pw="servertest";
> my $dsn="Databasesysadm"; # name of the DSN we will be using
> my $SERVER="remotemachine";
> my $DB="projDB";
> my %dsnavail;
> my @cols;
> my @dbs;
> my $table;
> my @tables;
>
>
>
> die "Unable to query available DSN's".Win32::ODBC::Error(  )."\n"   unless
> (%dsnavail = Win32::ODBC::DataSources(  ));
>
> foreach my $key (keys %dsnavail)
> {
> print "$key=$dsnavail{$key}\n";
> }
>
> if (!defined $dsnavail{$dsn})
> {
>    die "unable to create DSN:".Win32::ODBC::Error(  )."\n"
>      unless (Win32::ODBC::ConfigDSN(ODBC_ADD_DSN,  "SQL Server",
> ("DSN=$dsn",  "DESCRIPTION=DSN for PerlSysAdm",  "SERVER=remotemachine",
> "DATABASE=$DB", "NETWORK=DBMSSOCN",)));
> }
>
>
> my $dbh = new Win32::ODBC("DSN=$dsn;UID=$user;PWD=$pw;");
>
> die "Unable to connect to DSN $dsn:".Win32::ODBC::Error(  )."\n"  unless
> (defined $dbh);
>
> # find the databases on the server
> if (defined $dbh->Sql(q{SELECT name from sysdatabases}))
> {
>    die "Unable to query databases:".Win32::ODBC::Error(  )."\n";
> }
>
>
> $dbh->Close(  );
>
> die "Unable to delete DSN:".Win32::ODBC::Error(  )."\n"    unless
> (Win32::ODBC::ConfigDSN(ODBC_ REMOVE_DSN, "SQL Server","DSN=$dsn"));
>
> ################## CODE SNIP
>
> Thanks,
>
> PP
>
>
>
>
>
>

Reply via email to