table_info not working, am I doing something wrong?



Hey all,

I'm trying to write a simple Perl program to read and display the
schema of a database. I have a DBI->connect call that looks like
this:

my $dbh = DBI->connect("DBI:Oracle:".$dbservice, $dbuser, $dbpass) or
die "Cannot connect: ". DBI->errstr;

It works great, and I can run selects, inserts, and so on to my
heart's content. But my call to table_info is rather hosed up, and I
don't know if I'm doing something wrong or if it's a problem with my
Perl installation. The documentation of table_info is here:
http://search.cpan.org/~timb/DBI/DBI.pm#table_info

This code, for the most part, works:

my $sth = $dbh->table_info() or die "Could not fetch tables: " . DBI-
errstr;

I can iterate using fetchrow_array and get a list of my tables. But
let's say that I just want a list of views. According to the
documentation, something like this should do the trick:

my $sth = $dbh->table_info('%', '%', '%', 'VIEW') or die "Could not
fetch views: " . DBI->errstr;

But if I run that, nothing is returned. If I feed anything to it to
try to narrow down the table list, I get back bupkiss. For example, I
know there's a table in it called FOO. If I run this, the table
information isn't fetched:

my $sth = $dbh->table_info('%', '%', 'FOO', 'TABLE') or die "Could not
fetch views: " . DBI->errstr;

I found out that I can specify anything as the database catalog.
Here's the Oracle-specific documentation:
http://search.cpan.org/~pythian/DBD-Oracle-1.19/Oracle.pm#table_info()

But if I specify anything, or even nothing at all, for any of the
other parameters, I get back nothing.

Am I doing something wrong, or should I be investigating my Perl
installation? Or is there a better standard way to get database
schema information? Any help would be appreciated!

.



Relevant Pages

  • Re: Oracle on Windows
    ... Uri Dimant wrote: ... You were pointed to the documentation, ... Explains the difference about a database ... why a schema can exist without a user, ...
    (comp.databases.oracle.server)
  • Re: Description of SQL tables.
    ... >>> Dose anybody know any documentation, which describe structure of SMS ... it is possible to understand the sms db schema. ... By the problem is not in query it database. ...
    (microsoft.public.sms.admin)
  • Re: Java is becoming the new Cobol
    ... In the Unisys 2200 environment using their Network Database Server, you get a schema work area depending on how you invoke the schema. ... However, it not only copies the schema area into the program, but the "DMCA" (Database Management Communication Area - basically, the block of information that holds your connection state) is copied in too. ... So, you're left with working-storage, which makes it visible to your program only, or common-storage, which makes it visible to programs linked in. ...
    (comp.lang.cobol)
  • Split messages
    ... This is based off the northwind database. ... Create document schema: ... Select the SQL entry, make sure that we are pointing to the SQL ... For the item select a receive pipeline and name it EmpSplitPipe.btp. ...
    (microsoft.public.biztalk.general)
  • Re: Decouple SQL queries from class in OOP design
    ... > Of course there are existing applications that uses many different ... > architectures and still provides measurable business value. ... > should access every database directly. ... by the database, but the schema changes. ...
    (comp.object)