Wednesday, November 19, 2008

NetBeans Database Explorer API

It's probably not well known that NetBeans 6.5 comes with a new API called the Database Explorer API. This API allows you to work with and manage the connections that you see in the NetBeans Database Explorer:

database-explorer.jpg

Some of the use cases include:
  • Get a connection from the explorer and using it to automate some kind of database functionality, such as generating code based on a database schema
  • Add drivers or connections to the explorer either through a layer file or programmatically
  • Dragging and dropping a table, view or column onto a UI component and then getting metadata for that element. This is used, for example, to bind a database element to a field in Matisse or the visual web toolkit.
There is lots more, take a look at the overview in the javadoc. Geertjan is working on a tutorial showing how to use this API, here's his first blog entry about it with some example code I wrote up for him. More to come.

In the next release, we are making it possible for you to add nodes to the Database Explorer tree and to add actions to a specific node. This is very nice when you want to integrate a database-specific addon plugin to NetBeans.

We also plan to add a metadata API that will allow you to easily inspect database metadata for a given connection without having to dive into the complexities of the JDBC DatabaseMetadata API.

No comments: