db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jørgen Løland <Jorgen.Lol...@Sun.COM>
Subject Re: Finding object type
Date Mon, 21 Jan 2008 07:37:50 GMT
> Is there a function in the derby source code to find the type of an object..
> i.e. if the XXX is a table , it should return 'TABLE' ..
> if YYY is a view, it should return 'VIEW'..
> or anything like that??
> please tell where to look for it..
> please help asap...

Hi Jazarine,

Would it be possible to use JDBC in your case? If so, you could e.g. 
have a look at DatabaseMetaData.getTables (check out the Java API). If 
that is not an option, you may write a query like the one below to get 
all non-system tables and views.

select tablename, tabletype from sys.systables where tabletype not like 'S';

A tabletype of "T" is a normal table, while "V" means view.

These methods should work if you want to find the table type from an 
application using Derby. If you want to find the tabletype *inside 
Derby* (because you modify the source code), I would start looking at 
org.apache.derby.client.am.DatabaseMetaData#getTables and find out what 
happens there.

Hope this helps
Jørgen Løland

View raw message