Skip to Content.
Sympa Menu

freetds - Re: [freetds] Newbie select question

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Paul Key <pkey AT sghms.ac.uk>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Newbie select question
  • Date: Wed, 23 Feb 2005 13:25:02 +0000

Answer:

$dbh->do("use test");

Thanks...rtfm!!!

Paul Key wrote:

Hi

I have built freetds and dbd:sybase on solaris and can access my database server using: the following.

Fine - but how can I retrieve data from one of these tables? I can't find the code anywhere and the archives for this list are not searchable as claimed.

Thanks

paul

use DBI;

BEGIN {
$ENV{SYBASE} = '/usr/local/freetds';
$ENV{TDSVER} = '42';
}

$data_source = "DBI:Sybase:ntws";
$database = "test";
$username = "xx";
$password = "xxxxxx";

$dbh = DBI->connect($data_source, $username, $password) || die;
$sql_statement = "SELECT table_name " .
"FROM $database.information_schema.tables";
$sth = $dbh->prepare($sql_statement) || die;
$sth->execute || die;
while (($table) = $sth->fetchrow_array)
{
print "Database $database contains table $table\n";
}
$sth->finish;
$dbh->disconnect;




--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.





Archive powered by MHonArc 2.6.24.

Top of Page