##
#!/usr/bin/perl -w
use strict;
use DBI;
print "Content-type: text/html\n\n";
# Set up variables for the connection
my $server_name = 'domain\server';
my $server_ip = '1.2.3.4:port';
my $database_name = 'Tim';
my $database_user = 'Taylor';
my $database_pass = 'toolman';
my $DSN = 'driver={SQL Server};server=$server_name;tcpip=$server_ip;database=$database_name;uid=$database_user;pwd=$database_pass;';
my $dbh = DBI->connect("dbi:ODBC:$DSN") || die "Couldn't open database: $DBI::errstr\n";
# Prepare the SQL query for execution
my $SQL1 = $dbh->prepare(<';
print '';
# Execute the query
$SQL1->execute() || die "Couldn't execute statement: $DBI::errstr\n";
# Fetch each row and print it
while ( my ($field1,$field2,$field3,$field4,$field5) = $SQL1->fetchrow_array() )
{
print "$field1 $field2 $field3 $field4 $field5 ";
}
print "
";
# Disconnect from the database
$dbh->disconnect();
##
##
#!/usr/bin/perl -w
use strict;