Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DTP » Any way to map from ConnectionProfile to DatabaseDefinition?
Any way to map from ConnectionProfile to DatabaseDefinition? [message #50253] Fri, 26 September 2008 23:40 Go to next message
Philipp Simon is currently offline Philipp Simon
Messages: 26
Registered: July 2009
Junior Member
Hi guys,

i am looking for a way to look up a DatabaseDefinition starting from a
ConnectionProfile. After trying quite some ways it looks to me like there
is no "official" way to link them. Is this correct or do i miss something
essential?

Thanks in advance,
Philipp
Re: Any way to map from ConnectionProfile to DatabaseDefinition? [message #50314 is a reply to message #50253] Mon, 29 September 2008 14:58 Go to previous message
Eclipse User
Originally posted by: brianf.sybase.com

Hi Philipp!

You bet. You can do something similar to what I described in a blog post a
couple of months ago.

public Database getDatabaseForProfile (IConnectionProfile profile) {
IManagedConnection managedConnection = ((IConnectionProfile)profile).
getManagedConnection
(" org.eclipse.datatools.connectivity.sqm.core.connection.Conne ctionInfo ");
if (managedConnection != null) {
try {
ConnectionInfo connectionInfo = (ConnectionInfo)
managedConnection.
getConnection().getRawConnection();
if (connectionInfo != null) {
return connectionInfo.getSharedDatabase();
}
} catch (Exception e) {
e.printStackTrace();
}
}
return null;
}

This example gets you most of the way there. The ConnectionInfo class has a
"getDatabaseDefinition()" method that will get you what you're looking for.

Hope that helps!
--Fitz

"Philipp Simon" <philipp_simon@web.de> wrote in message
news:d05c401b826404aa8d461b40dc240863$1@www.eclipse.org...
> Hi guys,
>
> i am looking for a way to look up a DatabaseDefinition starting from a
> ConnectionProfile. After trying quite some ways it looks to me like there
> is no "official" way to link them. Is this correct or do i miss something
> essential?
>
> Thanks in advance,
> Philipp
>
Re: Any way to map from ConnectionProfile to DatabaseDefinition? [message #593251 is a reply to message #50253] Mon, 29 September 2008 14:58 Go to previous message
Brian Fitzpatrick is currently offline Brian Fitzpatrick
Messages: 495
Registered: July 2009
Senior Member
Hi Philipp!

You bet. You can do something similar to what I described in a blog post a
couple of months ago.

public Database getDatabaseForProfile (IConnectionProfile profile) {
IManagedConnection managedConnection = ((IConnectionProfile)profile).
getManagedConnection
(" org.eclipse.datatools.connectivity.sqm.core.connection.Conne ctionInfo ");
if (managedConnection != null) {
try {
ConnectionInfo connectionInfo = (ConnectionInfo)
managedConnection.
getConnection().getRawConnection();
if (connectionInfo != null) {
return connectionInfo.getSharedDatabase();
}
} catch (Exception e) {
e.printStackTrace();
}
}
return null;
}

This example gets you most of the way there. The ConnectionInfo class has a
"getDatabaseDefinition()" method that will get you what you're looking for.

Hope that helps!
--Fitz

"Philipp Simon" <philipp_simon@web.de> wrote in message
news:d05c401b826404aa8d461b40dc240863$1@www.eclipse.org...
> Hi guys,
>
> i am looking for a way to look up a DatabaseDefinition starting from a
> ConnectionProfile. After trying quite some ways it looks to me like there
> is no "official" way to link them. Is this correct or do i miss something
> essential?
>
> Thanks in advance,
> Philipp
>
Previous Topic:Sources for DTP 1.6.1 SDK cannot be loaded?
Next Topic:Sources for DTP 1.6.1 SDK cannot be loaded?
Goto Forum:
  


Current Time: Wed Sep 17 03:35:47 GMT 2014

Powered by FUDForum. Page generated in 0.01934 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software