db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Satheesh Bandaram <banda...@gmail.com>
Subject Re: Returning DatabaseMetaData for Derby Synonyms
Date Thu, 27 Jul 2006 00:23:46 GMT
Trent Rosenbaum wrote:

> .......   
> // Filter the metadata to only return results relating to Synonyms.
> String[] types = {"SYNONYM"};
> // Return the current metadata and use the table name to narrow the
> table patten.
> DatabaseMetaData metaData = DatabaseManager.getConnection().getMetaData();
> tablesResults = metaData.getTables(null, metaData.getUserName(),
> tableName, types);
> // If there is a result then the table name represented a synonym.
> while (tablesResults.next()) {
> result = true;
> ........
> }
> ........
> I have been able to use this code against an Oracle database to
> identify if a table name represents a synonym. 
> I did a search and saw that support for synonyms was put into Derby
> August 2005.  Has anyone else tried to return
> a DatabaseMetaData instance from Derby?
> Does anyone have thoughts on this subject or suggestions?

Hi Trent,

I implemented synonyms for Derby during 10.1 timeframe. At that time, my
interest was to support SYNONYMs in SQL layer, so I did not implement
JDBC side changes needed to expose SYNONYMs. I would suggest filing a
JIRA request to ask for JDBC support for SYNONYMs. If you have
sufficient interest, you could implement this your self. I suspect most
of the work would be in modifying a few database metadata SQL queries.

Otherwise, you can workaround this situation by directly querying Derby
system tables in your application, if you need to know whether an
instance is a real table or a SYNONYM. I can help you with SQL query, if
you need.


View raw message