[GLLUG] [OT]MS SQL Server
Matt Graham
danceswithcrows@usa.net
Thu, 27 Jun 2002 10:21:51 -0400
On Thursday 27 June 2002 09:45, after a long battle with technology,
Mike Szumlinski wrote:
> Anyone know how to get remote access to a MS SQL Server? MySQL is
> beautiful because you can just telnet/ssh into the machine and run
> the program. Is there a similar way to access MS SQL? Is there an X
> app out there that might do it? Our server at work is MS SQL but we
> want to move from asp to php, and I need to be able to poke around
> remotely on the thing to know what the heck tables are called and
> what not.
Don't know of any X applications that do this, but there are a couple of
Perl modules, freetds and DBD-Sybase, in combination with the standard
DBI module, that appear to work just fine for remotely accessing an
MS-SQL 6.5 server. The downside is that you have to write your queries
in a Perl script. Kind of like so:
#!/usr/bin/perl -w
$ENV{SYBASE}="/usr/local/freetds/"; # where the freetds module lives
use DBI;
use DBD::Sybase;
my $session=DBI->connect("dbi:Sybase:server=BORG","sa","PASSWORD")
or die "$DBI::errstr";
$session->do("use DATABASE");
$select="SELECT foo FROM blah WHERE baz=barf";
$cursor = $session->prepare($select);
$cursor->execute();
while($d = $cursor->fetch){
print "@$d\n";
}
$session->disconnect;
# hopefully that made sense
A slightly more interactive Perl thing could be kludged up reasonably
easily, I think, but I don't have time to try and write it out right
now. HTH,
--
We're standing there pounding a dead parrot on the counter, and the
management response is to frantically swap in new counters to see if
that fixes the problem. --Peter Gutmann, ASR 6/18/1998
There is no Darkness in Eternity/But only Light too dim for us to see