Tuesday, July 22, 2008

Ever wonder how to get a Database from a Connection Profile?

Hi all!

Have you ever wondered how to get a DTP SQL Model Database object from a connected connection profile? I seem to run into this problem infrequently, but always have to go through many gyrations to find the answer.

Larry from IBM, another member of the Connectivity team, was kind enough to provide the answer. It resulted in this chunk of code:

public Database getDatabaseForProfile (IConnectionProfile profile) {
IManagedConnection managedConnection = ((IConnectionProfile)profile).
getManagedConnection("org.eclipse.datatools.connectivity.sqm.core.connection.ConnectionInfo");

if (managedConnection != null) {
try {
ConnectionInfo connectionInfo = (ConnectionInfo) managedConnection.
getConnection().getRawConnection();
if (connectionInfo != null) {
return connectionInfo.getSharedDatabase();
}
} catch (Exception e) {
e.printStackTrace();
}
}
return null;
}

(Sorry the code's not pretty. I haven't found a great way of including code in Blogger blog posts yet.)

Basically under the covers there is a ConnectionInfo connection adapter that is used to map between the java.sql.Connection object we get from JDBC and the SQL model that's populated via the catalog loaders.

So there you have it! Not that many people have a need for such a thing, but it's handy just in case!

--Fitz

Thursday, July 17, 2008

How are YOU using DTP?


Hi all!

Now that the Ganymede release has gone out the door, DTP 1.6 has been released into the wild.

We in the DTP project would like to know how you are using DTP -- either as an end user, an adopter, or an extender. Are you using it to help with day to day database development tasks? Are you integrating with it from different projects in Eclipse such as BIRT, WTP, or JPA?

Though we're working on our first maintenance release for September, we're also starting to plan our next major release due in June 2009 along with the rest of the Eclipse Release Train. So we want to know what you would like to see in the next major release.

What do you like? What don't you like? We're here to help our community grow and develop. But to help us do that, we need guidance from the very folks who are using our stuff or looking at using it.

Let us know! Either by leaving a comment on this blog entry or by posting a message to the DTP newsgroup or mailing list!

Thanks!
--Fitz