This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 129503 - DatabaseConnection should expose methods to retrieve database metadata
Summary: DatabaseConnection should expose methods to retrieve database metadata
Status: RESOLVED DUPLICATE of bug 133989
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: David Vancouvering
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-07 07:36 UTC by Vadiraj Deshpande
Modified: 2008-04-29 20:38 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vadiraj Deshpande 2008-03-07 07:36:55 UTC
DatabaseConnection should have methods to get database metadata such as tables, views and procedures. This will be
useful for other modules that do not want to use DatabaseConnection for display purpose. (like in Hibernate module). The
new methods can be in the same line as of getSchema() that exists today.
Comment 1 David Vancouvering 2008-03-07 17:05:15 UTC
Can't you just use getJDBCConnection() to get the JDBC connection and then call connection.getMetaData()?

See http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Connection.html#getMetaData()

and

http://java.sun.com/j2se/1.5.0/docs/api/java/sql/DatabaseMetaData.html

Comment 2 Vadiraj Deshpande 2008-03-08 13:41:43 UTC
Yes, I can. But I was expecting that Database Explorer providing that data, since it already has that capability in
creating Database Node (under Services window) and it wraps the database connection creation. Why can't we just extend
this and make Database Explorer API powerful ?
Comment 3 Andrei Badea 2008-03-08 17:50:22 UTC
Such methods do not belong on DatabaseConnection. But it is true we desperately need support in the IDE to extract
database metadata:

- module writers don't want to deal with DatabaseMetaData themselves,
- module writers shouldn't need to devise a way to cache the metadata,
- we don't want multiple modules to extract the metadata, as that impacts performance.

Actually, there is already an issue for introducing a database model, so perhaps this issue should be closed as a duplicate.
Comment 4 David Vancouvering 2008-03-10 17:13:53 UTC
Hi, Andrei.  For my edification, can you provide some data behind "desperately need?"  Who needs it, and in order to
support what features, and do you have a sense of how important those features are?

If I'm to do this kind of work as well as the kind of stuff I need to do to improve MySQL support, then I may
desparately need some help :)  
Comment 5 Andrei Badea 2008-03-11 11:13:24 UTC
I can think of at least the following places in NetBeans that needs to retrieve database metadata:

- DB Explorer
- visual web editor
- JPA Entity Classes from Database wizard
- Hibernate support

Currently these components use their own way of retrieving and caching the database metadata. This impacts performance,
since metadata are retrieved multiple times (and for network connections, they may be not cheap to retrieve) and they
are kept in memory multiple times. 

In the future, we might also need retrieving metadata for

- code completion of database metadata in JPA annotations
- SQL editor code completion
Comment 6 David Vancouvering 2008-04-29 20:38:09 UTC
We're going to start working on this, marking it as a duplicate of the one Andrei is using to track this.

*** This issue has been marked as a duplicate of 133989 ***