Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DTP » creating an IConnectionProfile using ConnectionProfileFactory.createConnection(How to get the constants for the createConnection API)
creating an IConnectionProfile using ConnectionProfileFactory.createConnection [message #544994] Tue, 06 July 2010 06:15 Go to next message
shikhar is currently offline shikhar
Messages: 4
Registered: July 2010
Junior Member
Hello Developers,

I was wondering if I could get some help regarding the createConnection function in the ConnectionProfileFactory class.
An example of a Hard Coded call to this function would be
IConnectionProfile connectionProfile = connectionProfileFactory.createConnection(name, "org.eclipse.datatools.enablement.oracle.driverCategory", "org.eclipse.datatools.enablement.oracle.10.driverCategory", "org.eclipse.datatools.enablement.oracle.10.driverTemplate", properties);

Now I don't want this to be hard coded. What if I have some information say DB2 version 9 passed to it. Can I find the values of constants org.eclipse.datatools.enablement... for this database for all the parameters?
If yes, how can I do so?

please do reply if the context is not clear. I will elaborate more.


thanks and regards
Shikhar


Re: creating an IConnectionProfile using ConnectionProfileFactory.createConnection [message #545457 is a reply to message #544994] Wed, 07 July 2010 16:36 Go to previous messageGo to next message
Brian Fitzpatrick is currently offline Brian Fitzpatrick
Messages: 495
Registered: July 2009
Senior Member
Hi Shikhar...

I need a little more information. :)

So are you trying to get from the "vendor" and "version" strings to a
connection profile factory? Or to a connection profile instance?

And what do you expect your vendor and version strings to look like?

--Fitz

shikhar wrote:
> Hello Developers,
> I was wondering if I could get some help regarding the createConnection
> function in the ConnectionProfileFactory class. An example of a Hard
> Coded call to this function would be IConnectionProfile
> connectionProfile = connectionProfileFactory.createConnection(name,
> "org.eclipse.datatools.enablement.oracle.driverCategory",
> "org.eclipse.datatools.enablement.oracle.10.driverCategory",
> "org.eclipse.datatools.enablement.oracle.10.driverTemplate", properties);
>
> Now I don't want this to be hard coded. What if I have some information
> say DB2 version 9 passed to it. Can I find the values of constants
> org.eclipse.datatools.enablement... for this database for all the
> parameters? If yes, how can I do so?
>
> please do reply if the context is not clear. I will elaborate more.
>
> thanks and regards Shikhar
>
>
>
Re: creating an IConnectionProfile using ConnectionProfileFactory.createConnection [message #545489 is a reply to message #545457] Wed, 07 July 2010 23:30 Go to previous messageGo to next message
shikhar is currently offline shikhar
Messages: 4
Registered: July 2010
Junior Member
Hi Brian,

Thanks for your reply
The function definition looks like

IConnectionProfile createConnection(String profileName, String vendorId, String versionId, String templateId, Properties properties)

The ultimate goal is the connection profile instance but for that I need the vendor, version strings(to call this function).
For example the Oracle vendorId string would be
org.eclipse.datatools.enablement.oracle.driverCategory
versionId would be (for the 10th edition) org.eclipse.datatools.enablement.oracle.10.driverCategory

Now this is a hard coded call. Lets assume that what I have in hand is oracle and its version lets say V10. So how do I get these strings - org.eclipse.datatools.enablement.oracle.driverCategory, etc.
Same with DB2. lets say I have the string DB2 its version string as V9. How do I covert them to org.eclipse.datatools.enablement.db2.somethingSoemthing so that I am able to pass it to the function call.

The guess the answer will lie in the enablement plugins.
thanks and hoping to hear from you soon.
Shikhar


Re: creating an IConnectionProfile using ConnectionProfileFactory.createConnection [message #546714 is a reply to message #545489] Tue, 13 July 2010 18:01 Go to previous message
Brian Fitzpatrick is currently offline Brian Fitzpatrick
Messages: 495
Registered: July 2009
Senior Member
Hi Shikhar...

Sorry for the delay...

If you look for org.eclipse.datatools.connectivity.sqm.core.SQMServices,
you'll see that it has a method that provides a
ProviderIDMappingRegistry instance. From that, using the vendor/version
combination, you can use getProviderIDforVendorVersion (vendor, version)
to return the provider ID for the connection profile, and use
getCategoryIDforProviderID (providerID) to get to the driver template
category.

Once you have the driver template category, you can use
org.eclipse.datatools.connectivity.drivers.models.CategoryDe scriptor to
get the driver category instance, which will return a list of the driver
templates for the category.

It's the long way around, but it should work...

The trick for DB2 is knowing whether it's DB2 UDB, DB2 UDB zSeries, DB2
UDB iSeries, etc. and knowing what the version is the driver template is
registered against.

By using CategoryDescriptor and TemplateDescriptor, you may be able to
ferret those values out via API. And the JDBC driver you're using may be
able to provide the vendor and version strings. It's just a matter of
figuring out what you have available.

Hope that helps a little and doesn't just muddy the water.

--Fitz



shikhar wrote:
> Hi Brian,
>
> Thanks for your reply The function definition looks like
> IConnectionProfile createConnection(String profileName, String vendorId,
> String versionId, String templateId, Properties properties)
> The ultimate goal is the connection profile instance but for that I need
> the vendor, version strings(to call this function). For example the
> Oracle vendorId string would be
> org.eclipse.datatools.enablement.oracle.driverCategory
> versionId would be (for the 10th edition)
> org.eclipse.datatools.enablement.oracle.10.driverCategory
>
> Now this is a hard coded call. Lets assume that what I have in hand is
> oracle and its version lets say V10. So how do I get these strings -
> org.eclipse.datatools.enablement.oracle.driverCategory, etc. Same with
> DB2. lets say I have the string DB2 its version string as V9. How do I
> covert them to org.eclipse.datatools.enablement.db2.somethingSoemthing
> so that I am able to pass it to the function call.
> The guess the answer will lie in the enablement plugins. thanks and
> hoping to hear from you soon. Shikhar
>
>
>
Re: creating an IConnectionProfile using ConnectionProfileFactory.createConnection [message #597615 is a reply to message #545457] Wed, 07 July 2010 23:30 Go to previous message
shikhar is currently offline shikhar
Messages: 4
Registered: July 2010
Junior Member
Hi Brian,

Thanks for your reply
The function definition looks like

IConnectionProfile createConnection(String profileName, String vendorId, String versionId, String templateId, Properties properties)

The ultimate goal is the connection profile instance but for that I need the vendor, version strings(to call this function).
For example the Oracle vendorId string would be
org.eclipse.datatools.enablement.oracle.driverCategory
versionId would be (for the 10th edition) org.eclipse.datatools.enablement.oracle.10.driverCategory

Now this is a hard coded call. Lets assume that what I have in hand is oracle and its version lets say V10. So how do I get these strings - org.eclipse.datatools.enablement.oracle.driverCategory, etc.
Same with DB2. lets say I have the string DB2 its version string as V9. How do I covert them to org.eclipse.datatools.enablement.db2.somethingSoemthing so that I am able to pass it to the function call.

The guess the answer will lie in the enablement plugins.
thanks and hoping to hear from you soon.
Shikhar
Re: creating an IConnectionProfile using ConnectionProfileFactory.createConnection [message #597624 is a reply to message #597615] Tue, 13 July 2010 18:01 Go to previous message
Brian Fitzpatrick is currently offline Brian Fitzpatrick
Messages: 495
Registered: July 2009
Senior Member
Hi Shikhar...

Sorry for the delay...

If you look for org.eclipse.datatools.connectivity.sqm.core.SQMServices,
you'll see that it has a method that provides a
ProviderIDMappingRegistry instance. From that, using the vendor/version
combination, you can use getProviderIDforVendorVersion (vendor, version)
to return the provider ID for the connection profile, and use
getCategoryIDforProviderID (providerID) to get to the driver template
category.

Once you have the driver template category, you can use
org.eclipse.datatools.connectivity.drivers.models.CategoryDe scriptor to
get the driver category instance, which will return a list of the driver
templates for the category.

It's the long way around, but it should work...

The trick for DB2 is knowing whether it's DB2 UDB, DB2 UDB zSeries, DB2
UDB iSeries, etc. and knowing what the version is the driver template is
registered against.

By using CategoryDescriptor and TemplateDescriptor, you may be able to
ferret those values out via API. And the JDBC driver you're using may be
able to provide the vendor and version strings. It's just a matter of
figuring out what you have available.

Hope that helps a little and doesn't just muddy the water.

--Fitz



shikhar wrote:
> Hi Brian,
>
> Thanks for your reply The function definition looks like
> IConnectionProfile createConnection(String profileName, String vendorId,
> String versionId, String templateId, Properties properties)
> The ultimate goal is the connection profile instance but for that I need
> the vendor, version strings(to call this function). For example the
> Oracle vendorId string would be
> org.eclipse.datatools.enablement.oracle.driverCategory
> versionId would be (for the 10th edition)
> org.eclipse.datatools.enablement.oracle.10.driverCategory
>
> Now this is a hard coded call. Lets assume that what I have in hand is
> oracle and its version lets say V10. So how do I get these strings -
> org.eclipse.datatools.enablement.oracle.driverCategory, etc. Same with
> DB2. lets say I have the string DB2 its version string as V9. How do I
> covert them to org.eclipse.datatools.enablement.db2.somethingSoemthing
> so that I am able to pass it to the function call.
> The guess the answer will lie in the enablement plugins. thanks and
> hoping to hear from you soon. Shikhar
>
>
>
Previous Topic:connection with sql server 2000 using DTP
Next Topic:connection with sql server 2000 using DTP
Goto Forum:
  


Current Time: Sat Aug 23 03:31:38 EDT 2014

Powered by FUDForum. Page generated in 0.05428 seconds