[freetds] Newbie select question
Paul Key
pkey at sghms.ac.uk
Wed Feb 23 08:25:02 EST 2005
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.
More information about the FreeTDS
mailing list