[SGVLUG] Meta-querying - maybe try java jdbc - othogonal topic

Robert Leyva mrflash818 at geophile.net
Tue Jul 8 11:16:51 PDT 2008


Greets Tom,

If you can use a java jdbc connection, usually you can get meta
information on columns and such. Not too sure if you could query the table
names, but maybe that could be done manually as a one-time list that you
iterate through?


Me

> If I'm reading this correctly (though mostly I'm inferring this from the
> function name), it appears this lists all of the columns [fields] of the
> dataset [table] "people" -- that isn't what I want, I'm after all the
> tables that contain the column "first_name".  In addition, (and this is
> the harder part), I'd like to know where the DBA chose to name the field
> "FirstName", "fName", or simply "name"... [and, to a lesser extent, are
> these all of compatible forms, i.e., "varchar(n)" where "n" is
> consistent among instances...]
>
> -----Original Message-----Of Matt Campbell
>
> You can do this easily in mySQL if you have privs to open the database.
> I don't know how to do it in DB2 though.
>
>
>
>
>
> P.S.  The following is off the top of my head from some time ago so it
> probably needs double checking.
>
> The basic function should work with any DB Perl has drivers for.
>
>
>
>  [...] listTableColums($db, 'people');
>
>
>
> sub listTableColumns {
>
>                 my ($db, $table) = @_;
>
>
>
>  [...]
>
>                 my $sth = $dbh->column_info(undef, undef, $table,
> undef);
>
>
>
>
>
>
> From: sgvlug-bounces at sgvlug.net [mailto:sgvlug-bounces at sgvlug.net] On
> Behalf Of Emerson, Tom (*IC)
> Sent: Monday, July 07, 2008 12:04 PM
> To: SGVLUG Discussion List.
> Subject: [SGVLUG] Meta-querying (perhaps OT...)
>
>
>
> This is more for the database guru's out there -- specifically, for DB2:
> is there a way to perform a "meta" query on a database?  In particular,
> I'd like to find out what tables contain a particular field (by name, or
> possibly by structure as it's possible that the "name" of the field
> isn't consistent across datasets)
>
> [...]
>
>


-- 
"Knowledge is Power" -- Francis Bacon

Robert Leyva
mrflash818 at geophile.net



More information about the SGVLUG mailing list