Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DTP » Still can't create a connection
Still can't create a connection [message #53986] Thu, 02 April 2009 21:38 Go to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
I've been trying for three weeks, and I can't figure out to
programmatically access a JDBC connection with DTP. My objective is to
provide a plugin that wraps a JDBC connection, so that other plugins can
create DB connections without having to know the physical location of the
jar file, the driver class, etc.

The approach I'm currently working on is to declare a driverExtension
extension, which uses a driverOverride element to override the URL and
dtabase name properties for the MySQL driver template included in the
enablement plugin. Then I call ProfileManager.createProfile(), giving it
an arbitrary name, description, and provider ID, as well as a Properties
object that has the username, password and driver template ID (the ID of
the driver template that I overrode).

I can call methods on the profile created in this way, and when I call
aerPropertiesComplete() it returns true. However, when I try to call
createConnection() on the profile, I get a Null Pointer Exception. Looking
in the DTP source code, there's only a single line in that method, and it
is

return mProvider.getConnectionFactory(factoryId).createConnection(t his);

I suspect it's the mProvider object that is null, because I provided an
arbitrary name for the provider parameter when I called
ConnectionProfileManager.createConnection(). I didn't think that was
right, but I couldn't find anything that tells how to specify the
provider, or if that's supposed to connect to the profile somehow.

Maybe the provider is the missing link, or maybe I got something else
wrong. Can someone please tell me what I have wrong and how I can access a
connection?

-Mark
Re: Still can't create a connection [message #54057 is a reply to message #53986] Thu, 02 April 2009 23:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

What provider ID are you providing the create call?
--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:7f2bf17f632058c4e75fad7f54d0035f$1@www.eclipse.org...
> I've been trying for three weeks, and I can't figure out to
> programmatically access a JDBC connection with DTP. My objective is to
> provide a plugin that wraps a JDBC connection, so that other plugins can
> create DB connections without having to know the physical location of the
> jar file, the driver class, etc.
>
> The approach I'm currently working on is to declare a driverExtension
> extension, which uses a driverOverride element to override the URL and
> dtabase name properties for the MySQL driver template included in the
> enablement plugin. Then I call ProfileManager.createProfile(), giving it
> an arbitrary name, description, and provider ID, as well as a Properties
> object that has the username, password and driver template ID (the ID of
> the driver template that I overrode).
>
> I can call methods on the profile created in this way, and when I call
> aerPropertiesComplete() it returns true. However, when I try to call
> createConnection() on the profile, I get a Null Pointer Exception. Looking
> in the DTP source code, there's only a single line in that method, and it
> is
>
> return mProvider.getConnectionFactory(factoryId).createConnection(t his);
>
> I suspect it's the mProvider object that is null, because I provided an
> arbitrary name for the provider parameter when I called
> ConnectionProfileManager.createConnection(). I didn't think that was
> right, but I couldn't find anything that tells how to specify the
> provider, or if that's supposed to connect to the profile somehow.
>
> Maybe the provider is the missing link, or maybe I got something else
> wrong. Can someone please tell me what I have wrong and how I can access a
> connection?
>
> -Mark
>
Re: Still can't create a connection [message #54108 is a reply to message #54057] Fri, 03 April 2009 03:16 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Brian Fitzpatrick wrote:
> What provider ID are you providing the create call?
> --Fitz
>

I tried a couple things. First I tried arbitrary text, maybe the name of
my project or something like that, I'm not sure. Then I tried

org.eclipse.datatools.enablement.mysql.connectionProfile

Which is the ID of the Connection Profile from the enablement plugin's
plugin.xml. I was desperate for something to use fo provider because I
guess I'm missing wherever it is in the documentation that it explains
what a provider is and how to use it.

I've pasted below the relevant portion of my plugin.xml and the code I
use to create the profile.

Plugin.xml:

(This attempts to override some driver properties of the driver template
declared in the enablement plug-in's plugin.xml. I also tried repeating
the enablement plug-in's driverTemplate element in my plugin.xml, since
createDefault is set to false.)

<extension point="org.eclipse.datatools.connectivity.driverExtension">
<category
id="org.eclipse.datatools.connectivity.db.driverCategory"
name="Database"/>

<driverTemplateOverride
jarList="mysql-connector-java-5.1.7-bin.jar"
name="Override for Generic JDBC Driver"
targetId="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate ">

<propertyOverrides>

<propertyOverride
targetId="org.eclipse.datatools.connectivity.db.databaseName "
name="Database Name"
value="test"
required="true"
visible="true"/>
<propertyOverride
targetId="org.eclipse.datatools.connectivity.db.URL"
name="Driver Connection URL"
value="jdbc:mysql://localhost:3306/test"
required="true"
visible="true"/>
</propertyOverrides>

</driverTemplateOverride>
</extension>

And here's the code that attempts to create the profile. Debug output is
added to resList and returned as an array because I call the method from
a list view's content provider.

public class ProfileWrapper {

private List<String> resList = null;
private String driverID = "";
private String userName = "";
private String password = "";

public ProfileWrapper(String driverID, String userName, String
password, List<String> resList){
this.driverID = driverID;
this.userName = userName;
this.password = password;
this.resList = resList;
}

public IConnectionProfile getProfile(){
IConnectionProfile profile = null;
ProfileManager pfm = ProfileManager.getInstance();
if (pfm == null){
resList.add("No ProfileManager");
}
else{

try {
pfm.deleteProfile(pfm.getProfileByName("MySQL"));
} catch (ConnectionProfileException e2) {
resList.add("Delete Profile: ConnectionProfileException:" +
e2.getMessage());
e2.printStackTrace();
}

Properties props = new Properties();

props.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEF INITION_ID,
driverID);
props.setProperty(ConnectionProfileConstants.PROP_PWD, password);
props.setProperty(ConnectionProfileConstants.PROP_UID, userName);

try {
pfm.createProfile("MySQL", "MySQL JDBC Driver",
"org.eclipse.datatools.enablement.mysql.connectionProfile", props);
} catch (ConnectionProfileException e1) {
resList.add("Create Profile: ConnectionProfileException:"
+ e1.getMessage());
e1.printStackTrace();
}
profile = pfm.getProfileByName("MySQL");

resList.add("Provider ID: " + profile.getProviderId());
resList.add("Profile path: " + pfm.getProfilePath(profile));


if (profile.arePropertiesComplete()){
resList.add("Properties are complete");
} else {
resList.add("Properties are NOT complete");
}
}
return profile;
}
}
Re: Still can't create a connection [message #54134 is a reply to message #54108] Fri, 03 April 2009 04:16 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
I just realized I didn't include the code that calls the ProfileWrapper
class, so you can see the parameters I pass. here it is.

String driverID =
"org.eclipse.datatools.enablement.mysql.5_1.driverTemplate";
String userName = "root";
String password = "*********";
ProfileWrapper pw = new ProfileWrapper(
driverID,
userName,
password,
resList);
IConnectionProfile profile = pw.getProfile();
try {
profile.connect();//NPE occurs here.
....
Re: Still can't create a connection [message #54160 is a reply to message #54134] Fri, 03 April 2009 15:44 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
I've made further progress, but still getting an exception. I found I was
missing some of the dependencies of the enablement plug-in, so I added
them to the target. Now I seem to be engaging the enablement code, and I
get farther along.

I no longer get an exception when I call connect() on the
IConnectionProfile instance. But then I execute

org.eclipse.datatools.connectivity.IConnection connection =
connectionProfile.createConnection("java.sql.Connection");
java.sql.Connection rawConn = (Connection)connection.getRawConnection();
Statement s = rawConn.createStatement();//NPE thrown here

And I get an NPE for the last statement, as shown.

I also get an exception thrown from the DTP code, which appears to be the
root cause of the NPE. That exception is

java.lang.Exception: Driver definition could not be found.

and it is thrown by

org.eclipse.datatools.connectivity.DriverConnectionBase.getD riverDefinition
at line 139.

Looking at the source code, it appears that my driver definition ID is
being passed to the profile instance, but the definition is not valid.
Here's a snippet from getDriverDefinition() that shows where the above
exception is being thrown. Previous to this snippet, a null check on the
property PROP_DRIVER_DEFINITION_ID showed it was not null.

mDriver = DriverManager.getInstance().getDriverInstanceByID(
driverID);
if (mDriver == null) {
throw new Exception(...)); //$NON-NLS-1$
}

I should also mention that I'm now getting an indication that all the
properties on the profile are NOT complete. I'm setting
PROP_DRIVER_DEFINITION_ID, PROP_PWD, and PROP_UID. Is there somewhere
identified which properties need to be set?
Re: Still can't create a connection [message #54186 is a reply to message #54160] Fri, 03 April 2009 16:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

Well that's great!

The driver template alone isn't enough. You have to create a driver
definition...

String profileGenericJDBCDriverTemplateID =
" org.eclipse.datatools.connectivity.db.generic.genericDriverT emplate ";

String driverName = "MyDriver";

String driverID = "MyDriverID";

String driverClass = "org.apache.derby.jdbc.EmbeddedDriver"; //$NON-NLS-1$

String driverURL = "jdbc:derby:" + dbPath + ";create=true"; //$NON-NLS-1$
//$NON-NLS-2$

String jarList = "C:\\Derby10.1.3.1\\db-derby-10.1.3.1-bin\\lib\\derby.jar";
//$NON-NLS-1$

IPropertySet propSet = new PropertySetImpl(driverName, driverID);

Properties driverProperties = new Properties();

driverProperties.setProperty(IJDBCConnectionProfileConstants .DRIVER_CLASS_PROP_ID,

driverClass);

driverProperties.setProperty(IDriverMgmtConstants.PROP_DEFN_ JARLIST,

jarList);

driverProperties.setProperty(IDriverMgmtConstants.PROP_DEFN_ TYPE,

profileGenericJDBCDriverTemplateID);

propSet.setBaseProperties(driverProperties);

DriverManager.getInstance().addDriverInstance(propSet);


Then you can use the driver definition ID for your connection profile
properties...

baseProperties.setProperty(ConnectionProfileConstants.PROP_D RIVER_DEFINITION_ID,

driverID);


See if that gets you any further...
--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:939a8c3a79541b3417b62f76966a3796$1@www.eclipse.org...
> I've made further progress, but still getting an exception. I found I was
> missing some of the dependencies of the enablement plug-in, so I added
> them to the target. Now I seem to be engaging the enablement code, and I
> get farther along.
>
> I no longer get an exception when I call connect() on the
> IConnectionProfile instance. But then I execute
>
> org.eclipse.datatools.connectivity.IConnection connection =
> connectionProfile.createConnection("java.sql.Connection");
> java.sql.Connection rawConn = (Connection)connection.getRawConnection();
> Statement s = rawConn.createStatement();//NPE thrown here
>
> And I get an NPE for the last statement, as shown.
>
> I also get an exception thrown from the DTP code, which appears to be the
> root cause of the NPE. That exception is
>
> java.lang.Exception: Driver definition could not be found.
>
> and it is thrown by
> org.eclipse.datatools.connectivity.DriverConnectionBase.getD riverDefinition
> at line 139.
>
> Looking at the source code, it appears that my driver definition ID is
> being passed to the profile instance, but the definition is not valid.
> Here's a snippet from getDriverDefinition() that shows where the above
> exception is being thrown. Previous to this snippet, a null check on the
> property PROP_DRIVER_DEFINITION_ID showed it was not null.
>
> mDriver = DriverManager.getInstance().getDriverInstanceByID(
> driverID);
> if (mDriver == null) {
> throw new Exception(...)); //$NON-NLS-1$
> }
>
> I should also mention that I'm now getting an indication that all the
> properties on the profile are NOT complete. I'm setting
> PROP_DRIVER_DEFINITION_ID, PROP_PWD, and PROP_UID. Is there somewhere
> identified which properties need to be set?
>
>
>
>
>
Re: Still can't create a connection [message #54212 is a reply to message #54186] Fri, 03 April 2009 20:07 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Thanks!

That worked for me. At least I can make queries on the connection and get
the results back. I'm getting some exceptions however, with the root cause
apparently that I don't have an entry in the database definition registry.

I couldn't find any properties to set on the driver or connection profile
that seem to pertain to this.

Here's the stack trace


java.lang.NullPointerException
at java.util.TreeMap.getEntry(TreeMap.java:324)
at java.util.TreeMap.get(TreeMap.java:255)
at
org.eclipse.datatools.connectivity.sqm.internal.core.definit ion.DatabaseDefinitionRegistryImpl.getDefinition(DatabaseDef initionRegistryImpl.java:71)
at
org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionInfoImpl. <init>(ConnectionInfoImpl.java:629)
at
org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionInfoImpl. <init>(ConnectionInfoImpl.java:640)
at
org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionFactory.createConnection(ConnectionFactory.jav a:38)
at
org.eclipse.datatools.connectivity.sqm.core.SQMConnectionFac tory.createConnection(SQMConnectionFactory.java:45)
at
org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionFactory.createConnection(ConnectionFactory.jav a:59)
at
org.eclipse.datatools.connectivity.internal.ConnectionFactor yAdapterProvider.createConnection(ConnectionFactoryAdapterPr ovider.java:114)
at
org.eclipse.datatools.connectivity.internal.ManagedConnectio n.createConnection(ManagedConnection.java:163)
at
org.eclipse.datatools.connectivity.internal.CreateConnection Job.run(CreateConnectionJob.java:56)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Re: Still can't create a connection [message #54238 is a reply to message #54212] Fri, 03 April 2009 21:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

Cool. Glad we're getting closer. :)

I'm guessing it's because you're missing the Vendor and Version properties
in your connection profile properties...

After you get your driver definition, try adding these properties to your
connection profile properties...

baseProperties.setProperty(IJDBCDriverDefinitionConstants.DA TABASE_VENDOR_PROP_ID,

DriverManager.getInstance().getDriverInstanceByID(driverID). getNamedPropertyByID(IJDBCDriverDefinitionConstants.DATABASE _VENDOR_PROP_ID));

baseProperties.setProperty(IJDBCDriverDefinitionConstants.DA TABASE_VERSION_PROP_ID,

DriverManager.getInstance().getDriverInstanceByID(driverID). getNamedPropertyByID(IJDBCDriverDefinitionConstants.DATABASE _VERSION_PROP_ID));

The Database definition is retrieved by the vendor/version combo...

HTH
--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:734aa0a1e3abfd50d699e087b0851b79$1@www.eclipse.org...
> Thanks!
>
> That worked for me. At least I can make queries on the connection and get
> the results back. I'm getting some exceptions however, with the root cause
> apparently that I don't have an entry in the database definition registry.
>
> I couldn't find any properties to set on the driver or connection profile
> that seem to pertain to this.
>
> Here's the stack trace
>
>
> java.lang.NullPointerException
> at java.util.TreeMap.getEntry(TreeMap.java:324)
> at java.util.TreeMap.get(TreeMap.java:255)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.definit ion.DatabaseDefinitionRegistryImpl.getDefinition(DatabaseDef initionRegistryImpl.java:71)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionInfoImpl. <init>(ConnectionInfoImpl.java:629)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionInfoImpl. <init>(ConnectionInfoImpl.java:640)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionFactory.createConnection(ConnectionFactory.jav a:38)
> at
> org.eclipse.datatools.connectivity.sqm.core.SQMConnectionFac tory.createConnection(SQMConnectionFactory.java:45)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionFactory.createConnection(ConnectionFactory.jav a:59)
> at
> org.eclipse.datatools.connectivity.internal.ConnectionFactor yAdapterProvider.createConnection(ConnectionFactoryAdapterPr ovider.java:114)
> at
> org.eclipse.datatools.connectivity.internal.ManagedConnectio n.createConnection(ManagedConnection.java:163)
> at
> org.eclipse.datatools.connectivity.internal.CreateConnection Job.run(CreateConnectionJob.java:56)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
>
>
Re: Still can't create a connection [message #54264 is a reply to message #54238] Fri, 03 April 2009 21:54 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Yes, closer indeed, but still not at the finish line. Now it's complaining
about the catalog. Here's the stack trace.

-Mark


java.lang.NullPointerException
at
org.eclipse.datatools.connectivity.sqm.internal.core.util.Da tabaseProviderHelper.getCatalogDatabase(DatabaseProviderHelp er.java:37)
at
org.eclipse.datatools.connectivity.sqm.internal.core.util.Da tabaseProviderHelper.setDatabase(DatabaseProviderHelper.java :47)
at
org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionInfoImpl.initializeJDBCConnection(ConnectionIn foImpl.java:672)
at
org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionInfoImpl. <init>(ConnectionInfoImpl.java:644)
at
org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionFactory.createConnection(ConnectionFactory.jav a:38)
at
org.eclipse.datatools.connectivity.sqm.core.SQMConnectionFac tory.createConnection(SQMConnectionFactory.java:45)
at
org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionFactory.createConnection(ConnectionFactory.jav a:59)
at
org.eclipse.datatools.connectivity.internal.ConnectionFactor yAdapterProvider.createConnection(ConnectionFactoryAdapterPr ovider.java:114)
at
org.eclipse.datatools.connectivity.internal.ManagedConnectio n.createConnection(ManagedConnection.java:163)
at
org.eclipse.datatools.connectivity.internal.CreateConnection Job.run(CreateConnectionJob.java:56)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Re: Still can't create a connection [message #54290 is a reply to message #54264] Fri, 03 April 2009 22:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

Wow I really need to document this stuff on the Wiki...

That's an interesting bug. Basically the underlying code is looking for a
"org.eclipse.datatools.connectivity.sqm.core.catalog" extension with the
5.1.7 version I think you're providing as the version # for the profile.

The org.eclipse.datatools.enablement.mysql plug-in defines a catalog
element:

<extension
point="org.eclipse.datatools.connectivity.sqm.core.catalog" >
<catalog
product="MySql"
provider=" org.eclipse.datatools.enablement.mysql.catalog.MySqlCatalogP rovider "
version="5.1">
</catalog>
</extension>

If you're changing the driver/profile version from 5.1 to 5.1.7, you're
going to have to copy and change a couple of extensions... And I'm not sure
you can actually do it for the dbdefinition plug-in simply because it's
looking for the dbdefinition IN that plug-in, which will make it difficult
to override outside.

I'm guessing that if you change your version back to 5.1 you won't run into
an issue.

Can you let me know?
--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:7570df0c4625a511d2831067c0810323$1@www.eclipse.org...
> Yes, closer indeed, but still not at the finish line. Now it's complaining
> about the catalog. Here's the stack trace.
>
> -Mark
>
>
> java.lang.NullPointerException
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.util.Da tabaseProviderHelper.getCatalogDatabase(DatabaseProviderHelp er.java:37)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.util.Da tabaseProviderHelper.setDatabase(DatabaseProviderHelper.java :47)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionInfoImpl.initializeJDBCConnection(ConnectionIn foImpl.java:672)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionInfoImpl. <init>(ConnectionInfoImpl.java:644)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionFactory.createConnection(ConnectionFactory.jav a:38)
> at
> org.eclipse.datatools.connectivity.sqm.core.SQMConnectionFac tory.createConnection(SQMConnectionFactory.java:45)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionFactory.createConnection(ConnectionFactory.jav a:59)
> at
> org.eclipse.datatools.connectivity.internal.ConnectionFactor yAdapterProvider.createConnection(ConnectionFactoryAdapterPr ovider.java:114)
> at
> org.eclipse.datatools.connectivity.internal.ManagedConnectio n.createConnection(ManagedConnection.java:163)
> at
> org.eclipse.datatools.connectivity.internal.CreateConnection Job.run(CreateConnectionJob.java:56)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
>
Re: Still can't create a connection [message #54317 is a reply to message #54290] Fri, 03 April 2009 22:18 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
yes I understand what you're saying, except I don't know where I would be
setting the version to 5.1.7. It's true that the jar file name ends in
5.1.7, but I can't see anywhere else I'm setting the version number one
way or the other.

I did try setting the following properties on the driver before you told
me how to set the same ones on the profile, by getting them form the
driver instance in the profile.

driverProperties.setProperty(IJDBCConnectionProfileConstants .DATABASE_VENDOR_PROP_ID,
"MySQL");
driverProperties.setProperty(IJDBCDriverDefinitionConstants. DATABASE_VENDOR_PROP_ID,
"MySQL");
driverProperties.setProperty(IJDBCConnectionProfileConstants .DATABASE_VERSION_PROP_ID,
"5.1");
driverProperties.setProperty(IJDBCDriverDefinitionConstants. DATABASE_VERSION_PROP_ID,
"5.1");

I set them with two different constants classes because I wasn't sure
which one to use.

Here's the statement for creating my profile, in case that relates.

pfm.createProfile("MySQL", "MySQL JDBC Driver",
providerID, props);

providerID is set to

"org.eclipse.datatools.enablement.mysql.connectionProfile"

which is the only value I found to work, and it's the profile ID from the
enablement plug-in's plugin.xml.

-Mark
Re: Still can't create a connection [message #54343 is a reply to message #54317] Fri, 03 April 2009 22:20 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Just to clarify, I set those properties for vendor name and version again
after I added the statements for setting them on the profile properties,
and i still get the exception about the catalog.
Re: Still can't create a connection [message #54370 is a reply to message #54343] Fri, 03 April 2009 22:45 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Oops. silly error on my end. As yo may have noticed in my previous post,
when I set the vendor name property in the driver, I used MySQL instead of
MySql, which is how the extension point is defined in plugin.xml.

So now it's working and there are no exceptions. I appreciate your help
very much. I've been working on this off and on for a few weeks, and it's
great to have it working going into the weekend.

I do have one more question, however. I originally wanted to do this by
declaring the properties for the driver in my plugin.xml. That way I can
contribute one plug-in that would make the profile available to other
plug-ins without running the Java code that sets the properties.

It seemed straightforward how to do that using the driverTemplateOverride
extension point. I was providing overriden values for jarList, URL, and
database name, since the other driver properties were the same as that in
the template i was overriding. Then I provided username and password as
connection profile props. But I was getting the same NPE I was getting
before you showed me how to set those properties in Java.

I have a feeling the problem is with the jarList attribute for the
driverTemplateOverride element. Is there a way to specify in teh XML a
path relative to a plugin? For example, my plugin is called
com.mysql.jdbc, and I'd like to specify a jarList path that's relative to
that plug-in.

The example uses

[PLUGIN]\mydriver\driver.jar

I thought I could therefore use

com.mysql.jdbc\<relative path to the jar file>

Is that correct? If so, I can look elsewhere for the problem. Thanks again.

-Mark
Re: Still can't create a connection [message #54397 is a reply to message #54343] Fri, 03 April 2009 22:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

Can you trace into that
org.eclipse.datatools.connectivity.sqm.internal.core.util.Da tabaseProviderHelper.getCatalogDatabase(DatabaseProviderHelp er.java:37)
call?

I'm just wondering why it's not finding it based on the vendor/version.

Sorry I can't be more help today, I have to head off to soccer for my
youngest. I'll try to help more on Monday.

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:d35cb22fa146a1a829a16437cdc4b3f8$1@www.eclipse.org...
> Just to clarify, I set those properties for vendor name and version again
> after I added the statements for setting them on the profile properties,
> and i still get the exception about the catalog.
>
Re: Still can't create a connection [message #54451 is a reply to message #54397] Mon, 06 April 2009 12:57 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Brian Fitzpatrick wrote:
> Can you trace into that
> org.eclipse.datatools.connectivity.sqm.internal.core.util.Da tabaseProviderHelper.getCatalogDatabase(DatabaseProviderHelp er.java:37)
> call?
>
Fitz,

Looks like we posted at the same time. I managed to mis-spell MySQL,
i.e. I had the wrong capitalization vis a vis that used in the
enablement plug-in's XML file.

Thanks again for all your help Friday. I do have one additional question
in my previous post, regarding how I can make this work via plug-in XML
declarations exclusively vice Java code that runs via early startup.

-Mark
Re: Still can't create a connection [message #54478 is a reply to message #54370] Mon, 06 April 2009 13:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

Hey Mark!

That's great news. You don't know how often I get killed by typos. :)

As for specifying a plug-in wrapped driver jar, you can definitely do that
using the [PLUGIN ID]/relative path method...

So if your plug-in ID is "my.plugin.id", your jar path would look something
like "my.plugin.id/libs/myjar.jar". If you have issues with that particular
path, you can try flipping the slashes.

The other option is to provide a "Driver Values Provider class" like I do
with the SQLite and Derby drivers. This allows you to hunt in the
plug-in/bundle registry for your driver plug-in wrapper and find the jar
that way. You can find examples in
o.e.d.enablement.sqlite.driver.SQLiteDriverValuesProvider and
org.eclipse.datatools.connectivity.apache.internal.derby.dri ver.DerbyDriverValuesProvider101.

Glad you're getting all of this working. I hope to have time to document all
this stuff soon on the Wiki so it's much easier to find the next time
someone goes looking. :)

Thanks for your patience and like I said, don't hesitate to ask more
questions. We'll be here. :)

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:99fadedf8fd2c0129883bd127f5a3531$1@www.eclipse.org...
> Oops. silly error on my end. As yo may have noticed in my previous post,
> when I set the vendor name property in the driver, I used MySQL instead of
> MySql, which is how the extension point is defined in plugin.xml.
>
> So now it's working and there are no exceptions. I appreciate your help
> very much. I've been working on this off and on for a few weeks, and it's
> great to have it working going into the weekend.
>
> I do have one more question, however. I originally wanted to do this by
> declaring the properties for the driver in my plugin.xml. That way I can
> contribute one plug-in that would make the profile available to other
> plug-ins without running the Java code that sets the properties.
>
> It seemed straightforward how to do that using the driverTemplateOverride
> extension point. I was providing overriden values for jarList, URL, and
> database name, since the other driver properties were the same as that in
> the template i was overriding. Then I provided username and password as
> connection profile props. But I was getting the same NPE I was getting
> before you showed me how to set those properties in Java.
>
> I have a feeling the problem is with the jarList attribute for the
> driverTemplateOverride element. Is there a way to specify in teh XML a
> path relative to a plugin? For example, my plugin is called
> com.mysql.jdbc, and I'd like to specify a jarList path that's relative to
> that plug-in.
> The example uses
>
> [PLUGIN]\mydriver\driver.jar
>
> I thought I could therefore use
>
> com.mysql.jdbc\<relative path to the jar file>
>
> Is that correct? If so, I can look elsewhere for the problem. Thanks
> again.
>
> -Mark
>
>
Re: Still can't create a connection [message #54505 is a reply to message #54478] Mon, 06 April 2009 20:38 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Fitz,

Thanks for the additional instructions. I just completed a plug-in that
creates a profile bound to the MySQL driver, and with the desired profile
properties set. This runs via early startup, which is problematic because
there's no guarantee when execution will complete. For that reason I'm
looking for a way to declare entirely via XML in plugin.xml the desired
profile and driver characteristics, so other plug-ins can gab the profile
from the Profile Manager and establish connections with it.

I see the Profile definition in the enablement plug-in, and I'm able to
grab that profile via the Profile Manager. But there's no driver
associated with it, so if I call connect() on it, I get an NPE as I was
doing originally. So now I understand how to declare override properties
for the driver templates defined by the enablement plug-in, which I can
use to point to my driver. But I don't understand how I can associate the
driver that I override with the profile that is declared.

Is there a way I can make this association purely in XML, so that when I
grab the declared profile by name from the Profile Manager, I can call
connect() on the profile and the connection will be established via the
driver whose properties I overrode in plug-in.xml?

-Mark
Re: Still can't create a connection [message #54533 is a reply to message #54505] Mon, 06 April 2009 20:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

There is a way to do this, but I've not tried it...

You can use the
org.eclipse.datatools.connectivity.ProfileManagerInitializat ionProvider
extension point to, when the connectivity plug-in fires up, create a profile
with your specifications.

I believe BIRT uses this extension point to create their Derby sample
database at startup, but like I said, I haven't tried it.

See if that does what you're looking for though. If you need more help, I
can ask one of the other Connectivity folks who works on ODA & BIRT to help
out.

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:a58e4586cba49f1af7dfbf43347a9dc3$1@www.eclipse.org...
> Fitz,
>
> Thanks for the additional instructions. I just completed a plug-in that
> creates a profile bound to the MySQL driver, and with the desired profile
> properties set. This runs via early startup, which is problematic because
> there's no guarantee when execution will complete. For that reason I'm
> looking for a way to declare entirely via XML in plugin.xml the desired
> profile and driver characteristics, so other plug-ins can gab the profile
> from the Profile Manager and establish connections with it.
>
> I see the Profile definition in the enablement plug-in, and I'm able to
> grab that profile via the Profile Manager. But there's no driver
> associated with it, so if I call connect() on it, I get an NPE as I was
> doing originally. So now I understand how to declare override properties
> for the driver templates defined by the enablement plug-in, which I can
> use to point to my driver. But I don't understand how I can associate the
> driver that I override with the profile that is declared.
>
> Is there a way I can make this association purely in XML, so that when I
> grab the declared profile by name from the Profile Manager, I can call
> connect() on the profile and the connection will be established via the
> driver whose properties I overrode in plug-in.xml?
>
> -Mark
>
Re: Still can't create a connection [message #54569 is a reply to message #54533] Tue, 07 April 2009 14:34 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
That's helpful info, Fitz. Thanks for all your efforts.

The schema for ProfileManagerInitializationProvider is pretty
straightforward, and I created a plug-in providing an implementation of
that extension. I get an NPE when I grab the profile, which traces into
the DTP source code indicating that the template is null when retrieved by
ID.

I pasted my plugin.xml below. The driver template ID I used is the one
that appears in the enablement plugin.xml, and I made my plug-in dependent
on the enablement plug-in.

One question I have is how to implement the IExecutableExtension instance
referenced by the connectionInitializer attribute. I see during runtime
that the method on this class receives a Java representation of the
elements and attributes I declared for the
ProfileManagerInitializationProvider extension. I don't do anything with
these in the method implementation, because I'm assuming that DTP is
handling the task of creating the profile and driver definitions based on
my declarations. Indeed it seems the profile gets created, but not the
driver. Or maybe I need to do some initialization in the
ExecutableExtension, although I'm hoping that won't be necessary. I'm
trying to find the BIRT implementation you mentioned, and hopefully that
will shed some light.

Unless you happen to know the answer to my questions above, if you can
point someone else on the Connectivity team to my post as you offered, I'd
very much appreciate it.

-Mark

My plugin.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension

id=" com.tasc.swb.datatools.connctivity.mysql.profileManagerIniti alization "
name="XML Generated MySQL Connection Profile"

point=" org.eclipse.datatools.connectivity.ProfileManagerInitializat ionProvider ">
<connection

connectionInitializer=" com.tasc.swb.datatools.connectivity.mysql.declaredprofile.My SQLConnectionInitializer "

connectionProfileID=" com.tasc.swb.datatools.connectivity.mysql.declaredProfile.co nnection1 "

connectionProfileName=" com.tasc.swb.datatools.connectivity.mysql.declaredProfile.co nnection1 "

driverDefinitionName=" com.tasc.swb.datatools.connectivity.mysql.declaredProfile.co nnection1 "

driverTemplateID="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate "
jarList="com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar" >
<property
id="org.eclipse.datatools.connectivity.db.databaseName"
value="prophet_test_db">
</property>
<property
id="org.eclipse.datatools.connectivity.db.URL"
value="jdbc:mysql://localhost:3306/prophet_test_db">
</property>
<property
id="org.eclipse.datatools.connectivity.db.username"
value="root">
</property>
<property
id="org.eclipse.datatools.connectivity.db.password"
value="squerdiddle1!">
</property>
</connection>
</extension>
</plugin>
Re: Still can't create a connection [message #54650 is a reply to message #54569] Tue, 07 April 2009 22:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

In your driver template override, can you set createDefault = true and see
if that fixes the problem?

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:02778f8973f54e6b78dda8c187a0804c$1@www.eclipse.org...
> That's helpful info, Fitz. Thanks for all your efforts.
>
> The schema for ProfileManagerInitializationProvider is pretty
> straightforward, and I created a plug-in providing an implementation of
> that extension. I get an NPE when I grab the profile, which traces into
> the DTP source code indicating that the template is null when retrieved by
> ID.
>
> I pasted my plugin.xml below. The driver template ID I used is the one
> that appears in the enablement plugin.xml, and I made my plug-in dependent
> on the enablement plug-in.
>
> One question I have is how to implement the IExecutableExtension instance
> referenced by the connectionInitializer attribute. I see during runtime
> that the method on this class receives a Java representation of the
> elements and attributes I declared for the
> ProfileManagerInitializationProvider extension. I don't do anything with
> these in the method implementation, because I'm assuming that DTP is
> handling the task of creating the profile and driver definitions based on
> my declarations. Indeed it seems the profile gets created, but not the
> driver. Or maybe I need to do some initialization in the
> ExecutableExtension, although I'm hoping that won't be necessary. I'm
> trying to find the BIRT implementation you mentioned, and hopefully that
> will shed some light.
>
> Unless you happen to know the answer to my questions above, if you can
> point someone else on the Connectivity team to my post as you offered, I'd
> very much appreciate it.
>
> -Mark
>
> My plugin.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <?eclipse version="3.4"?>
> <plugin>
> <extension
>
> id=" com.tasc.swb.datatools.connctivity.mysql.profileManagerIniti alization "
> name="XML Generated MySQL Connection Profile"
>
> point=" org.eclipse.datatools.connectivity.ProfileManagerInitializat ionProvider ">
> <connection
>
> connectionInitializer=" com.tasc.swb.datatools.connectivity.mysql.declaredprofile.My SQLConnectionInitializer "
>
> connectionProfileID=" com.tasc.swb.datatools.connectivity.mysql.declaredProfile.co nnection1 "
>
> connectionProfileName=" com.tasc.swb.datatools.connectivity.mysql.declaredProfile.co nnection1 "
>
> driverDefinitionName=" com.tasc.swb.datatools.connectivity.mysql.declaredProfile.co nnection1 "
>
> driverTemplateID="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate "
> jarList="com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar" >
> <property
> id="org.eclipse.datatools.connectivity.db.databaseName"
> value="prophet_test_db">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.URL"
> value="jdbc:mysql://localhost:3306/prophet_test_db">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.username"
> value="root">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.password"
> value="squerdiddle1!">
> </property>
> </connection>
> </extension>
> </plugin>
>
>
Re: Still can't create a connection [message #54702 is a reply to message #54650] Wed, 08 April 2009 15:12 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Fitz,

I thought about the createDefault attribute, but I didn't see how to
override it. Since the ProfileManagerInitializationProvider extension has
property members in its Connection element which are defined as property
overrides for the driverTemplate, I assumed I didn't need a
driverExtension extension with a driverTemplateOverride.

But you seem to be saying I should be using a driverTemplateOverride, at
least to override the createDefault attribute. So I tried that, and it's
still not working, but maybe I'm not overriding properly. I tried it two
different ways, overriding the generic driver template and overriding a
template declared with a driverExtension in my plugin.xml (copied and
adapted from the enablement plug-in). In each case I used the ID of the
base template (the one being overriden) for the value of the
driverTemplateID attribute of the Connection element in the
ProfileManagerInitializationProvider extension. I assume this is correct
since the ID for the driverTemplateOverride element is an optional
attribute.

I've pasted below two versions of plugin.xml, showing both approaches
described above. In each case an NPE is thrown because the driver template
is null when retrieved by templateID. I also pasted the stack trace below
(the first lines of it, down to invocation by the Workbench.

plugin.xml overriding the generic template:

<plugin>
<extension

id=" com.tasc.swb.datatools.connctivity.mysql.profileManagerIniti alization "
name="XML Generated MySQL Connection Profile"

point=" org.eclipse.datatools.connectivity.ProfileManagerInitializat ionProvider ">
<connection

connectionInitializer=" com.tasc.swb.datatools.connectivity.mysql.declaredprofile.My SQLConnectionInitializer "
connectionProfileID="some.id"
connectionProfileName="MySQL2"
driverDefinitionName="MySQL JDBC Driver"

driverTemplateID="org.eclipse.datatools.connectivity.db.genericDriverTemplate "
jarList="com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar" >
<property
id="org.eclipse.datatools.connectivity.db.databaseName"
value="prophet_test_db">
</property>
<property
id="org.eclipse.datatools.connectivity.db.URL"
value="jdbc:mysql://localhost:3306/prophet_test_db">
</property>
<property
id="org.eclipse.datatools.connectivity.db.username"
value="root">
</property>
<property
id="org.eclipse.datatools.connectivity.db.password"
value="squerdiddle1!">
</property>
<property
id="org.eclipse.datatools.connectivity.drivers.defnType"

value=" org.eclipse.datatools.connectivity.db.generic.genericDriverT emplate ">
</property>
<property
id="org.eclipse.datatools.connectivity.db.driverClass"
value="com.mysql.jdbc.Driver">
</property>
<property
id="org.eclipse.datatools.connectivity.db.vendor"
value="MySql">
</property>
<property
id="org.eclipse.datatools.connectivity.db.version"
value="5.1">
</property>
</connection>
</extension>

<extension
point="org.eclipse.datatools.connectivity.driverExtension">

<driverTemplateOverride
createDefault="true"
jarList="com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar"
name="Override for Generic JDBC Driver"

targetId="org.eclipse.datatools.connectivity.db.genericDriverTemplate ">
<propertyOverrides>
<propertyOverride
value="prophet_test_db"

targetId="org.eclipse.datatools.connectivity.db.databaseName "/>
<propertyOverride
value="com.mysql.jdbc.Driver"

targetId="org.eclipse.datatools.connectivity.db.driverClass "/>
propertyOverride
value="jdbc:mysql://localhost:3306/prophet_test_db"
targetId="org.eclipse.datatools.connectivity.db.URL"/>
</propertyOverrides>
</driverTemplateOverride>
</extension>

</plugin>

plugin.xml overriding a declared template:

<plugin>
<extension

id=" com.tasc.swb.datatools.connctivity.mysql.profileManagerIniti alization "
name="XML Generated MySQL Connection Profile"

point=" org.eclipse.datatools.connectivity.ProfileManagerInitializat ionProvider ">
<connection

connectionInitializer=" com.tasc.swb.datatools.connectivity.mysql.declaredprofile.My SQLConnectionInitializer "
connectionProfileID="some.id"
connectionProfileName="MySQL2"
driverDefinitionName="MySQL JDBC Driver"

driverTemplateID="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate2 "
jarList="com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar" >
<property
id="org.eclipse.datatools.connectivity.db.databaseName"
value="prophet_test_db">
</property>
<property
id="org.eclipse.datatools.connectivity.db.URL"
value="jdbc:mysql://localhost:3306/prophet_test_db">
</property>
<property
id="org.eclipse.datatools.connectivity.db.username"
value="root">
</property>
<property
id="org.eclipse.datatools.connectivity.db.password"
value="squerdiddle1!">
</property>
<property
id="org.eclipse.datatools.connectivity.drivers.defnType"

value=" org.eclipse.datatools.connectivity.db.generic.genericDriverT emplate ">
</property>
<property
id="org.eclipse.datatools.connectivity.db.driverClass"
value="com.mysql.jdbc.Driver">
</property>
<property
id="org.eclipse.datatools.connectivity.db.vendor"
value="MySql">
</property>
<property
id="org.eclipse.datatools.connectivity.db.version"
value="5.1">
</property>
</connection>
</extension>

<extension
point="org.eclipse.datatools.connectivity.driverExtension">

<driverTemplate
createDefault="true"
emptyJarListIsOK="false"
id="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate2 "
jarList="com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar"
name="MySQL JDBC Driver Template"

parentCategory="org.eclipse.datatools.enablement.mysql.5_1.driverCategory ">
<properties>
<property
generated="false"
id="org.eclipse.datatools.connectivity.db.driverClass"
value="com.mysql.jdbc.Driver"
name="Driver Class"
required="true"
visible="true"/>
<property
generated="false"
id="org.eclipse.datatools.connectivity.db.vendor"
name="Vendor"
value="MySql"
required="true"
visible="false"/>
<property
generated="false"
id="org.eclipse.datatools.connectivity.db.version"
name="Version"
value="5.1"
required="true"
visible="false"/>
<property
generated="false"
id="org.eclipse.datatools.connectivity.db.databaseName"
name="Database Name"
value="prophet_test_db"
required="true"
visible="true"/>
<property
generated="false"
id="org.eclipse.datatools.connectivity.db.URL"
name="Connection URL"
value="jdbc:mysql://localhost:3306/prophet_test_db"
required="true"
visible="true"/>
<property
generated="false"
id="org.eclipse.datatools.connectivity.db.username"
name="User ID"
value="root"
required="false"
visible="true"/>
<property
generated="false"
id="org.eclipse.datatools.connectivity.db.password"
name="Password"
value="squerdiddle1!"
required="false"
visible="true"/>
</properties>
</driverTemplate>
</extension>

</plugin>

Stack trace:


java.lang.NullPointerException
at
org.eclipse.datatools.connectivity.drivers.DriverManager.get DriverInstancesFromMapForTemplateID(DriverManager.java:150)
at
org.eclipse.datatools.connectivity.drivers.DriverManager.get DriverInstancesByTemplate(DriverManager.java:189)
at
org.eclipse.datatools.connectivity.internal.InternalProfileM anager.getDriverInstance(InternalProfileManager.java:1328)
at
org.eclipse.datatools.connectivity.internal.InternalProfileM anager.enableLocalDatabase(InternalProfileManager.java:1252)
at
org.eclipse.datatools.connectivity.internal.InternalProfileM anager.loadLocalRegisteredDatabases(InternalProfileManager.j ava:1211)
at
org.eclipse.datatools.connectivity.internal.InternalProfileM anager.loadProfiles(InternalProfileManager.java:929)
at
org.eclipse.datatools.connectivity.internal.InternalProfileM anager.getProfiles(InternalProfileManager.java:140)
at
org.eclipse.datatools.connectivity.internal.InternalProfileM anager.getProfileByName(InternalProfileManager.java:215)
at
org.eclipse.datatools.connectivity.ProfileManager.getProfile ByName(ProfileManager.java:96)
at
com.tasc.swb.datatools.connectivity.testclient.views.TestCli entView.testJDBCConnection(TestClientView.java:96)
at
com.tasc.swb.datatools.connectivity.testclient.views.TestCli entView.access$0(TestClientView.java:86)
at
com.tasc.swb.datatools.connectivity.testclient.views.TestCli entView$ViewContentProvider.getElements(TestClientView.java: 43)
at
org.eclipse.jface.viewers.StructuredViewer.getRawChildren(St ructuredViewer.java:937)
at
org.eclipse.jface.viewers.ColumnViewer.getRawChildren(Column Viewer.java:703)
at
org.eclipse.jface.viewers.AbstractTableViewer.getRawChildren (AbstractTableViewer.java:1071)
at
org.eclipse.jface.viewers.StructuredViewer.getFilteredChildr en(StructuredViewer.java:871)
at
org.eclipse.jface.viewers.StructuredViewer.getSortedChildren (StructuredViewer.java:994)
at
org.eclipse.jface.viewers.AbstractTableViewer.internalRefres hAll(AbstractTableViewer.java:685)
at
org.eclipse.jface.viewers.AbstractTableViewer.internalRefres h(AbstractTableViewer.java:633)
at
org.eclipse.jface.viewers.AbstractTableViewer.internalRefres h(AbstractTableViewer.java:620)
at
org.eclipse.jface.viewers.AbstractTableViewer$2.run(Abstract TableViewer.java:576)
at
org.eclipse.jface.viewers.StructuredViewer.preservingSelecti on(StructuredViewer.java:1365)
at
org.eclipse.jface.viewers.StructuredViewer.preservingSelecti on(StructuredViewer.java:1328)
at
org.eclipse.jface.viewers.AbstractTableViewer.inputChanged(A bstractTableViewer.java:574)
at
org.eclipse.jface.viewers.ContentViewer.setInput(ContentView er.java:251)
at
org.eclipse.jface.viewers.StructuredViewer.setInput(Structur edViewer.java:1603)
at
com.tasc.swb.datatools.connectivity.testclient.views.TestCli entView.createPartControl(TestClientView.java:79)
at
org.eclipse.ui.internal.ViewReference.createPartHelper(ViewR eference.java:371)
at
org.eclipse.ui.internal.ViewReference.createPart(ViewReferen ce.java:230)
at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:594)
at org.eclipse.ui.internal.Perspective.showView(Perspective.jav a:2127)
at
org.eclipse.ui.internal.WorkbenchPage.busyShowView(Workbench Page.java:1062)
at org.eclipse.ui.internal.WorkbenchPage$19.run(WorkbenchPage.j ava:3773)

...
Re: Still can't create a connection [message #54729 is a reply to message #54702] Wed, 08 April 2009 17:12 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
I found the problem with the driver template. Stepping though with teh
debugger I saw that the NPE was actually occurring when DTP tried to load
a template using a key for a template that I defined previously for the
earlyStartup version of the plug-in. A co-worker then told me about the
need to clear my workspace in my run configuration, which I wasn't clued
into. Sorry about that, as I'm pretty new to eclipse plug-in development.
So I'm going to say this was a hardware error: a loose nut on the keyboard.

I also found that I need to have profile id and name to match an existing
declared profile (I used the one defined in the enablement plug-in),
otherwise the catyegory is unknown and it blows up when trying to
establish a connection. I pasted my plugin.xml below.

However... I still have a problem. I'm getting a ClassNotFoundException of
rhte driver class, com.mysql.jdbc.Driver. I added a dependency to a
plug-in that wraps the COnnector/J jar file and exports package
com.mysql.jdbc. But I think that's not what it's using to resolve the
classpath, right? I believe that's what the jarList attribute is for.

I'm using com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar because
com.mysql.jdbc is the name of the plug-in, and the jar file is in the root
directory of the plug-in. I also tried a backslash instead of the forward
slash. Any other ideas for specifying the jarList attribute?

Do you agree this is probably where my problem is?

My current plugin.xml

<plugin>
<extension

id=" com.tasc.swb.datatools.connctivity.mysql.profileManagerIniti alization "
name="XML Generated MySQL Connection Profile"

point=" org.eclipse.datatools.connectivity.ProfileManagerInitializat ionProvider ">
<connection

connectionInitializer=" com.tasc.swb.datatools.connectivity.mysql.declaredprofile.My SQLConnectionInitializer "

connectionProfileID="org.eclipse.datatools.enablement.mysql.connectionProfile "
connectionProfileName="MySQL"
driverDefinitionName="MySQL JDBC Driver"

driverTemplateID="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate "
jarList="com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar" >
<property
id="org.eclipse.datatools.connectivity.db.databaseName"
value="prophet_test_db">
</property>
<property
id="org.eclipse.datatools.connectivity.db.URL"
value="jdbc:mysql://localhost:3306/prophet_test_db">
</property>
<property
id="org.eclipse.datatools.connectivity.db.username"
value="root">
</property>
<property
id="org.eclipse.datatools.connectivity.db.password"
value="squerdiddle1!">
</property>
<property
id="org.eclipse.datatools.connectivity.drivers.defnType"

value=" org.eclipse.datatools.connectivity.db.generic.genericDriverT emplate ">
</property>
<property
id="org.eclipse.datatools.connectivity.db.driverClass"
value="com.mysql.jdbc.Driver">
</property>
<property
id="org.eclipse.datatools.connectivity.db.vendor"
value="MySql">
</property>
<property
id="org.eclipse.datatools.connectivity.db.version"
value="5.1">
</property>
</connection>
</extension>

</plugin>
Re: Still can't create a connection [message #54756 is a reply to message #54729] Wed, 08 April 2009 21:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

Hey Mark...

I think to be a programmer you have to be a little nuts anyway. :) So no
worries there.

As for the other bit, I'm going to take a look at this tomorrow to see if I
can figure out what's going on by recreating some of what you're doing here.
There has to be a reason that the createDefault isn't triggering a creation
of the driver when it ought to.

Unfortunately I'm knee-deep in another issue today. So I apologize for
pushing you off another day, but I hope you'll understand.

I'll get back to this first thing tomorrow.

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:ef84239000030b68d75bb07dc86349b8$1@www.eclipse.org...
>I found the problem with the driver template. Stepping though with teh
>debugger I saw that the NPE was actually occurring when DTP tried to load a
>template using a key for a template that I defined previously for the
>earlyStartup version of the plug-in. A co-worker then told me about the
>need to clear my workspace in my run configuration, which I wasn't clued
>into. Sorry about that, as I'm pretty new to eclipse plug-in development.
>So I'm going to say this was a hardware error: a loose nut on the keyboard.
>
> I also found that I need to have profile id and name to match an existing
> declared profile (I used the one defined in the enablement plug-in),
> otherwise the catyegory is unknown and it blows up when trying to
> establish a connection. I pasted my plugin.xml below.
>
> However... I still have a problem. I'm getting a ClassNotFoundException of
> rhte driver class, com.mysql.jdbc.Driver. I added a dependency to a
> plug-in that wraps the COnnector/J jar file and exports package
> com.mysql.jdbc. But I think that's not what it's using to resolve the
> classpath, right? I believe that's what the jarList attribute is for.
>
> I'm using com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar because
> com.mysql.jdbc is the name of the plug-in, and the jar file is in the root
> directory of the plug-in. I also tried a backslash instead of the forward
> slash. Any other ideas for specifying the jarList attribute?
>
> Do you agree this is probably where my problem is?
>
> My current plugin.xml
>
> <plugin>
> <extension
>
> id=" com.tasc.swb.datatools.connctivity.mysql.profileManagerIniti alization "
> name="XML Generated MySQL Connection Profile"
>
> point=" org.eclipse.datatools.connectivity.ProfileManagerInitializat ionProvider ">
> <connection
>
> connectionInitializer=" com.tasc.swb.datatools.connectivity.mysql.declaredprofile.My SQLConnectionInitializer "
>
> connectionProfileID="org.eclipse.datatools.enablement.mysql.connectionProfile "
> connectionProfileName="MySQL"
> driverDefinitionName="MySQL JDBC Driver"
>
> driverTemplateID="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate "
> jarList="com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar" >
> <property
> id="org.eclipse.datatools.connectivity.db.databaseName"
> value="prophet_test_db">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.URL"
> value="jdbc:mysql://localhost:3306/prophet_test_db">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.username"
> value="root">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.password"
> value="squerdiddle1!">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.drivers.defnType"
>
> value=" org.eclipse.datatools.connectivity.db.generic.genericDriverT emplate ">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.driverClass"
> value="com.mysql.jdbc.Driver">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.vendor"
> value="MySql">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.version"
> value="5.1">
> </property>
> </connection>
> </extension>
>
> </plugin>
>
Re: Still can't create a connection [message #54783 is a reply to message #54729] Wed, 08 April 2009 21:34 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
I'm sorry this thread is running so long, but I think I'm almost there. My
connection is working, but there are two issues remaining.

1. I found a workaround for the classpath problem, which is not acceptable
but confirms that the problem is in the way I'm setting the jarList
attribute. I entered the absolute file path on my development system as
the value for jarList, and it worked. So the value I used originally for
jarList (com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar) doesn't
resolve to path of the jar file in plugin com.mysql.jdbc, which is what I
need. Hopefully this is a basic thing I'm missing and someone can
enlighten me.

2. For some reason the password property is not being set on the profile.
I can get around this by specifying it as part of the URL, but I'd rather
not do that. After stepping through with the debugger, it looks like DTP
is dropping the password property. I print out the values of all the
properties set in the ProfileManagerInitializationProvider extension as
passed to my implementation of the class referenced by the
connectionInitializer attribute. AT that point, all the properties are
set, including password. Then using the debugger I looked at
org.eclipse.datatools.connectivity.internal.ManagedConnectio n during
runtime.

Just before createConnection() returns (line 178), I inspect the profile
(mProfile is the variable name). By traversing the heirarchical set of
property entries inside mPropertiesMap, I find all the properties set
except for password. There is no entry for password, not an entry with a
null value. And downstream when the connection is created from the
profile, it is made with no password, resulting in a SQLException.

I'm setting the password property just the same as I set the user
property, so I'm not sure what's going on. Is there a reason the password
property would not be passed on? Or is this a bug in the DTP code?

Repeating from my previous post, here's how I set the password and user
properties in plugin.xml:


<connection

connectionInitializer=" com.tasc.swb.datatools.connectivity.mysql.declaredprofile.My SQLConnectionInitializer "

connectionProfileID="org.eclipse.datatools.enablement.mysql.connectionProfile "
connectionProfileName="MySqlJdbcConnectionProfile"
driverDefinitionName="MySQL JDBC Driver"

driverTemplateID="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate "
jarList="C:\Documents and Settings\leonema\My
Documents\Eclipse NG\com.mysql.jdbc\mysql-connector-java-5.1.7-bin.jar">
<!--
jarList="Plugin:com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar "> -->
<property
id="org.eclipse.datatools.connectivity.db.databaseName"
value="prophet_test_db">
</property>
<property
id="org.eclipse.datatools.connectivity.db.URL"
value="jdbc:mysql://localhost:3306">
</property>
<property
id="org.eclipse.datatools.connectivity.db.username"
value="root">
</property>
<property
id="org.eclipse.datatools.connectivity.db.password"
value="squerdiddle1!">
</property>

...
Re: Still can't create a connection [message #54810 is a reply to message #54756] Wed, 08 April 2009 21:40 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Fitz,

No worries at all. You've been super with all the help you've given. Once
again our messages crossed in the mail, so please look at my post just
before this one. There's no longer an issue with creating the driver, and
I have it working with two workarounds that I'd like to not have to use.
One is probably a simple matter that someone can clear up, and the other
seems to be a bit thornier, based on running through some DTP code with
the debugger. Have a great evening.

-Mark
Re: Still can't create a connection [message #54944 is a reply to message #54783] Thu, 09 April 2009 14:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

Hey Mark...

No worries. I'm just glad we're making progress. :)

For 1, can you try simply putting the plug-in id in square brackets?
[com.mysql.jdbc]. I think that's the trick there. So it would be
"[com.mysql.jdbc]/mysql-connector-java-5.1.7-bin.jar".

For 2, there is a "save password" property you would need to set on the
profile properties when you create it initially... Let me find that...
IJDBCConnectionProfileConstants.SAVE_PASSWORD_PROP_ID

Set that to true and it should persist the password for you. It's just
another property to set on the properties set for the connection profile. We
default to not saving it because of the security concerns, but the profile
store is encrypted so you should be ok.

Let me know if that helps. :)

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:7e9d71d9f5fa97902aa8f1ca6a680311$1@www.eclipse.org...
> I'm sorry this thread is running so long, but I think I'm almost there. My
> connection is working, but there are two issues remaining.
>
> 1. I found a workaround for the classpath problem, which is not acceptable
> but confirms that the problem is in the way I'm setting the jarList
> attribute. I entered the absolute file path on my development system as
> the value for jarList, and it worked. So the value I used originally for
> jarList (com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar) doesn't
> resolve to path of the jar file in plugin com.mysql.jdbc, which is what I
> need. Hopefully this is a basic thing I'm missing and someone can
> enlighten me.
>
> 2. For some reason the password property is not being set on the profile.
> I can get around this by specifying it as part of the URL, but I'd rather
> not do that. After stepping through with the debugger, it looks like DTP
> is dropping the password property. I print out the values of all the
> properties set in the ProfileManagerInitializationProvider extension as
> passed to my implementation of the class referenced by the
> connectionInitializer attribute. AT that point, all the properties are
> set, including password. Then using the debugger I looked at
> org.eclipse.datatools.connectivity.internal.ManagedConnectio n during
> runtime.
>
> Just before createConnection() returns (line 178), I inspect the profile
> (mProfile is the variable name). By traversing the heirarchical set of
> property entries inside mPropertiesMap, I find all the properties set
> except for password. There is no entry for password, not an entry with a
> null value. And downstream when the connection is created from the
> profile, it is made with no password, resulting in a SQLException.
>
> I'm setting the password property just the same as I set the user
> property, so I'm not sure what's going on. Is there a reason the password
> property would not be passed on? Or is this a bug in the DTP code?
>
> Repeating from my previous post, here's how I set the password and user
> properties in plugin.xml:
>
>
> <connection
>
> connectionInitializer=" com.tasc.swb.datatools.connectivity.mysql.declaredprofile.My SQLConnectionInitializer "
>
> connectionProfileID="org.eclipse.datatools.enablement.mysql.connectionProfile "
> connectionProfileName="MySqlJdbcConnectionProfile"
> driverDefinitionName="MySQL JDBC Driver"
>
> driverTemplateID="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate "
> jarList="C:\Documents and Settings\leonema\My Documents\Eclipse
> NG\com.mysql.jdbc\mysql-connector-java-5.1.7-bin.jar">
> <!--
> jarList="Plugin:com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar "> -->
> <property
> id="org.eclipse.datatools.connectivity.db.databaseName"
> value="prophet_test_db">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.URL"
> value="jdbc:mysql://localhost:3306">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.username"
> value="root">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.password"
> value="squerdiddle1!">
> </property>
>
> ..
>
>
Re: Still can't create a connection [message #54969 is a reply to message #54944] Thu, 09 April 2009 15:18 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Thanks, Fitz. I'll give those both a try. I have one quick question about
#2 however:

When you say to set the property

IJDBCConnectionProfileConstants.SAVE_PASSWORD_PROP_ID

It looks like that's a property I should use in the Java code. Is there an
equivalent property I can set in the XML via the
ProfileManagerInitializationProvider extension?
Re: Still can't create a connection [message #54995 is a reply to message #54944] Thu, 09 April 2009 15:28 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Fitz,

I tried

jarList="[com.mysql.jdbc]/mysql-connector-java-5.1.7-bin.jar "

and I'm still getting ClassNotFoundException for the driver class. If I
set jarList tot he absolute path of the jar file, it works fine. I also
tried a backslash after the plugin designator, with the same result. Do
you have any other ideas, or how I can investigate the class loading
problem?

FWIW here's the stack trace:


java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java :592)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at
org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnecti on.createConnection(JDBCConnection.java:88)
at
org.eclipse.datatools.connectivity.DriverConnectionBase.inte rnalCreateConnection(DriverConnectionBase.java:104)
at
org.eclipse.datatools.connectivity.DriverConnectionBase.open (DriverConnectionBase.java:53)
at
org.eclipse.datatools.enablement.internal.mysql.connection.J DBCMySQLConnectionFactory.createConnection(JDBCMySQLConnecti onFactory.java:28)
at
org.eclipse.datatools.connectivity.internal.ConnectionFactor yProvider.createConnection(ConnectionFactoryProvider.java:83 )
at
org.eclipse.datatools.connectivity.internal.ConnectionProfil e.createConnection(ConnectionProfile.java:355)
at
org.eclipse.datatools.connectivity.internal.ManagedConnectio n.createConnection(ManagedConnection.java:166)
at
org.eclipse.datatools.connectivity.internal.CreateConnection Job.run(CreateConnectionJob.java:56)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Re: Still can't create a connection [message #55022 is a reply to message #54995] Thu, 09 April 2009 19:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

Ok. I'm close to having this working locally.

Can you paste in the (I'm guessing minimal) code for your initializer class?

I'm just trying to get as close to what you're doing as I can. I was able to
create a default driver definition with this:
<extension

point="org.eclipse.datatools.connectivity.driverExtension">

<driverTemplateOverride

createDefault="true"

jarList="[com.mysql.jdbc]/mysql-connector-java-5.1.5-bin.jar "

priority="4"

targetId="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate ">

</driverTemplateOverride>

</extension>

So now I'm just trying to figure out the initialization part.

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:44a7a5cb5c0662470861917ffb79ca08$1@www.eclipse.org...
> Fitz,
>
> I tried
>
> jarList="[com.mysql.jdbc]/mysql-connector-java-5.1.7-bin.jar "
>
> and I'm still getting ClassNotFoundException for the driver class. If I
> set jarList tot he absolute path of the jar file, it works fine. I also
> tried a backslash after the plugin designator, with the same result. Do
> you have any other ideas, or how I can investigate the class loading
> problem?
>
> FWIW here's the stack trace:
>
>
> java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
> at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java :592)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
> at
> org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnecti on.createConnection(JDBCConnection.java:88)
> at
> org.eclipse.datatools.connectivity.DriverConnectionBase.inte rnalCreateConnection(DriverConnectionBase.java:104)
> at
> org.eclipse.datatools.connectivity.DriverConnectionBase.open (DriverConnectionBase.java:53)
> at
> org.eclipse.datatools.enablement.internal.mysql.connection.J DBCMySQLConnectionFactory.createConnection(JDBCMySQLConnecti onFactory.java:28)
> at
> org.eclipse.datatools.connectivity.internal.ConnectionFactor yProvider.createConnection(ConnectionFactoryProvider.java:83 )
> at
> org.eclipse.datatools.connectivity.internal.ConnectionProfil e.createConnection(ConnectionProfile.java:355)
> at
> org.eclipse.datatools.connectivity.internal.ManagedConnectio n.createConnection(ManagedConnection.java:166)
> at
> org.eclipse.datatools.connectivity.internal.CreateConnection Job.run(CreateConnectionJob.java:56)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
>
>
Re: Still can't create a connection [message #55049 is a reply to message #55022] Fri, 10 April 2009 00:50 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Fitz,

Thanks for trying on your end. Sorry I didn't get back to you earlier, as
I was doing some re-factoring that consumed me for most of the day.

I think it may be that the format you gave me for jarList works in the
drivertemplate but not in the ProfileManagerInitializationProvider. Below
is my plugin.xml. When I run it as-is, I get a ClasSNotFoundException
looking for teh driver class. When I use the jarList assignment that is
commented out, it works fine. I never tried this with DriverExtension,
only with ProfileManagerInitializationProvider.

I'm getting around this OK because of the way I've re-factored, in which
I;ve combined the XML and Java versions I did over the last several days.
Now I listen for DTP to send me the ConfigurationElement, using the class
specified as the connectionInitializer attribute. That class just calls a
configurator that grabs the driver properties out of the
ConfigurationElement and defiens a driver with them programmatically the
way you showed me last week. Then the configurator grabs profile
properties from a file where they're set by an admin user, and it creates
the profile programmatically, again with the code you gave me, and also
assigns the driver name and driver ID that came out of the
COnfigurationElement.

This way I have my driver properties hard-coded in the XML, and the
profile properties are set via a properties file. Since I'm doing it this
way, I go ahead and set the jarFile property by using Java to get the
plugin-relative location of the jar file. This works, vice the XML version
which causes a ClassNotFoundException. The Java code I use is

final File file = new
File(FileLocator.getBundleFile(Platform.getBundle("com.mysql.jdbc ")),
"mysql-connector-java-5.1.7-bin.jar");

I also set the password persistence property on the profile per your
earlier message, and now the connection works fine. It would be nice to
solve the jarList issue since it's supposed to work, but it's nto gating
me.

The last reamaining question I have is how the Data Source Explorer could
be used in conjunction with the profile I set up as described above. I see
the profile, but the only properties I can edit are name and description,
not password or user ID, etc. Also after I launch the DSE view, all my
connections fail until I restart the app. I don't have to do anything in
the DSE; just by showing the view I kill the ability to connect on the
profile I defined.

-Mark
Re: Still can't create a connection [message #55076 is a reply to message #55049] Fri, 10 April 2009 00:51 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Forgot to attach plugin.xml

plugin>
<extension

id=" com.tasc.swb.datatools.connctivity.mysql.profileManagerIniti alization "
name="XML Generated MySQL Connection Profile"

point=" org.eclipse.datatools.connectivity.ProfileManagerInitializat ionProvider ">
<connection

connectionInitializer=" com.tasc.swb.datatools.connectivity.mysql.ConfigurationEleme ntInitializer "

connectionProfileID="org.eclipse.datatools.enablement.mysql.connectionProfile "
connectionProfileName="MySqlJdbcConnectionProfile"
driverDefinitionName="Prophet MySQL JDBC Driver"

driverTemplateID="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate "
jarList="[com.mysql.jdbc]/mysql-connector-java-5.1.7-bin.jar ">
<!-- jarList="C:\Documents and Settings\leonema\My
Documents\Eclipse NG\com.mysql.jdbc\mysql-connector-java-5.1.7-bin.jar" -->
<property
id="org.eclipse.datatools.connectivity.db.driverClass"
value="com.mysql.jdbc.Driver">
</property>
<property
id="org.eclipse.datatools.connectivity.db.vendor"
value="MySql">
</property>
<property
id="org.eclipse.datatools.connectivity.db.version"
value="5.1">
</property>
</connection>
</extension>
</plugin>
Re: Still can't create a connection [message #55102 is a reply to message #55049] Fri, 10 April 2009 13:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

Very odd. I know it works on the override provider side, so I don't know
what's going on.

If you're using the profile provider ID that goes with MySQL for your
profile, you should be able to edit the profile in the DSE.

But I'm not all that familiar with what the profile manager initialization
code is doing under the covers. Let me see if one of the other DTP folks can
help you out with that part.

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:f5a999ec0feda8c269138991584f9ec2$1@www.eclipse.org...
> Fitz,
>
> Thanks for trying on your end. Sorry I didn't get back to you earlier, as
> I was doing some re-factoring that consumed me for most of the day.
>
> I think it may be that the format you gave me for jarList works in the
> drivertemplate but not in the ProfileManagerInitializationProvider. Below
> is my plugin.xml. When I run it as-is, I get a ClasSNotFoundException
> looking for teh driver class. When I use the jarList assignment that is
> commented out, it works fine. I never tried this with DriverExtension,
> only with ProfileManagerInitializationProvider.
>
> I'm getting around this OK because of the way I've re-factored, in which
> I;ve combined the XML and Java versions I did over the last several days.
> Now I listen for DTP to send me the ConfigurationElement, using the class
> specified as the connectionInitializer attribute. That class just calls a
> configurator that grabs the driver properties out of the
> ConfigurationElement and defiens a driver with them programmatically the
> way you showed me last week. Then the configurator grabs profile
> properties from a file where they're set by an admin user, and it creates
> the profile programmatically, again with the code you gave me, and also
> assigns the driver name and driver ID that came out of the
> COnfigurationElement.
>
> This way I have my driver properties hard-coded in the XML, and the
> profile properties are set via a properties file. Since I'm doing it this
> way, I go ahead and set the jarFile property by using Java to get the
> plugin-relative location of the jar file. This works, vice the XML version
> which causes a ClassNotFoundException. The Java code I use is
>
> final File file = new
> File(FileLocator.getBundleFile(Platform.getBundle("com.mysql.jdbc ")),
> "mysql-connector-java-5.1.7-bin.jar");
>
> I also set the password persistence property on the profile per your
> earlier message, and now the connection works fine. It would be nice to
> solve the jarList issue since it's supposed to work, but it's nto gating
> me.
>
> The last reamaining question I have is how the Data Source Explorer could
> be used in conjunction with the profile I set up as described above. I see
> the profile, but the only properties I can edit are name and description,
> not password or user ID, etc. Also after I launch the DSE view, all my
> connections fail until I restart the app. I don't have to do anything in
> the DSE; just by showing the view I kill the ability to connect on the
> profile I defined.
>
> -Mark
>
Re: Still can't create a connection [message #55129 is a reply to message #55102] Fri, 10 April 2009 14:45 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Fitz, thanks for passing on the question about DSE interaction.

Can you help me verify I'm using the right provider ID? The only thing I
found that enables the profile to provide a working connection is

org.eclipse.datatools.enablement.mysql.connectionProfile

I got this from the MySQL enablement plugin.xml, as the id of the declared
connectionProfle. I pass it as the providerID parameter when I call
ProfileManager.createProfile(). Can you point me to somewhere else for the
provider ID value if this isn't correct?

Thanks.

-Mark
Re: Still can't create a connection [message #55156 is a reply to message #55129] Fri, 10 April 2009 15:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

That provider ID should be correct if you got it from the connection profile
extension. So that's probably not it.

Not sure what the deal is. I've asked Linda to chime in to see if she can
figure out what's going on.

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:94ed6745c1da894f26309770a32e742c$1@www.eclipse.org...
> Fitz, thanks for passing on the question about DSE interaction.
>
> Can you help me verify I'm using the right provider ID? The only thing I
> found that enables the profile to provide a working connection is
>
> org.eclipse.datatools.enablement.mysql.connectionProfile
>
> I got this from the MySQL enablement plugin.xml, as the id of the declared
> connectionProfle. I pass it as the providerID parameter when I call
> ProfileManager.createProfile(). Can you point me to somewhere else for the
> provider ID value if this isn't correct?
>
> Thanks.
>
> -Mark
>
Re: Still can't create a connection [message #55182 is a reply to message #55156] Mon, 13 April 2009 14:23 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Fitz,

I worked on this over the weekend, and it's working well now with just two
DSE issues that seem to be unrelated to what I've coded; hopefully just a
config issue on my end.

First, a quick summary of what changed over the weekend.

1. Issue with the DSE and profile connection not working together is
fixed; it was a bug with my test client.

2. I re-factored once more. With my team's decision last week to decouple
the driver and profile properties, ProfileManagerInitializationProvider
extension is no longer needed. Now I have no extensions declared for the
plug-in that provides connectivity. I programmatically define the driver
and setup the profile, with the code you showed me earlier in the thread,
getting the profile property settings from a file in the config directory.
To get around the startup timing issue when we used earlyStartup with this
approach, I activate my connectivity plug-in from the RCP app as the
platform is coming up.

Now everything works as desired except the following with the DSE.

1. As mentioned previously, when I edit the connection properties from the
DSE entry for the profile, I only see the name and description, not the
properties I set on the profile programmatically.

2. I don't see child entries for the profile that enable me to view and
edit the tables.

This is referring to when I launch an eclipse app with my plug-ins. When I
look at the DSE in the IDE, I see an entry below the connection that
enables me to view and edit the tables, schemas, etc. I'd like to have
this same capability in the DSE when I launch my app.

I thought I might be missing a DTP plug-in in my target environment, but I
added every one that seemed even remotely applicable, and I still don't
have the missing capability. Can you think of a plug-in or plug-ins I
should check for? Or perhaps there's another property I need to set on my
profile?

Below is the code I'm using to define the driver and configure and create
the profile. The property values are not evident in the snippet, but you
can see what properties I'm setting.

public void provideConnectivity() {
final Properties profileProps = new ConnectionProfileProperties();//
defineDriver(driverId, driverName);
createProfile(driverId, profileProps);
}

private void defineDriver(final String driverId, final String driverName) {
final String profileGenericJDBCDriverTemplateID =
" org.eclipse.datatools.connectivity.db.generic.genericDriverT emplate ";
final IPropertySet propSet = new PropertySetImpl(driverName, driverId);
final Properties driverProperties = new Properties();
driverProperties.setProperty(IJDBCDriverDefinitionConstants. DRIVER_CLASS_PROP_ID,
"com.mysql.jdbc.Driver");
driverProperties.setProperty(IDriverMgmtConstants.PROP_DEFN_ JARLIST,
getJarList());
driverProperties.setProperty(IDriverMgmtConstants.PROP_DEFN_ TYPE,
profileGenericJDBCDriverTemplateID);
driverProperties.setProperty(IJDBCDriverDefinitionConstants. DATABASE_VENDOR_PROP_ID,
"MySql");
driverProperties.setProperty(IJDBCDriverDefinitionConstants. DATABASE_VERSION_PROP_ID,
"5.1");
propSet.setBaseProperties(driverProperties);
DriverManager.getInstance().addDriverInstance(propSet);
}

private void createProfile(final String driverID, final Properties
profileProps) {
final String driverURL = "jdbc:mysql://" + profileProps.getProperty(
ProphetConnectionProfileConstants.PROP_DB_HOST_NAME) + ":"
+
profileProps.getProperty(ProphetConnectionProfileConstants.P ROP_DB_PORT) +
"/testdb";

connectionProfileName =
profileProps.getProperty(ProphetConnectionProfileConstants.P ROP_PROFILE_NAME);

final Properties props = new Properties();
props.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEF INITION_ID,
driverID);
props.setProperty(IJDBCDriverDefinitionConstants.PASSWORD_PR OP_ID,
profileProps.getProperty(ProphetConnectionProfileConstants.P ROP_PASSWORD));
props.setProperty(IJDBCDriverDefinitionConstants.USERNAME_PR OP_ID,
profileProps.getProperty(ProphetConnectionProfileConstants.P ROP_USER_ID));
props.setProperty(IJDBCDriverDefinitionConstants.URL_PROP_ID , driverURL);
//DTP will not persist the password if this property is not set
props.setProperty(IJDBCConnectionProfileConstants.SAVE_PASSW ORD_PROP_ID,
"true");
props.setProperty(IJDBCConnectionProfileConstants.DATABASE_N AME_PROP_ID,
"testdb");
props.setProperty(IJDBCDriverDefinitionConstants.DATABASE_VE NDOR_PROP_ID,
DriverManager.
getInstance().getDriverInstanceByID(driverID)

getNamedPropertyByID(IJDBCDriverDefinitionConstants.DATABASE _VENDOR_PROP_ID));
props.setProperty(IJDBCDriverDefinitionConstants.DATABASE_VE RSION_PROP_ID,
DriverManager.
getInstance().getDriverInstanceByID(driverID)

getNamedPropertyByID(IJDBCDriverDefinitionConstants.DATABASE _VERSION_PROP_ID));
ProfileManager pfm = null;
try {
pfm = ProfileManager.getInstance();
} catch (final Exception e) {
DatatoolsMySqlConnectivityPlugin.logError("Unable to insantiate the
Connection Profile Manager", e);
return;
}

if (pfm.getProfileByName(this.connectionProfileName) == null) {
createNewProfile(props);
} else {
modifyProfileProperties(props);
}
}

private void createNewProfile(final Properties props) {

ProfileManager pfm = null;
try {
pfm = ProfileManager.getInstance();
} catch (final Exception e) {
DatatoolsMySqlConnectivityPlugin.logError("Unable to insantiate the
Connection Profile Manager", e);
return;
}

try {
pfm.createProfile(this.connectionProfileName,
"Default connection profile for accessing the MySQL database",
this.providerID, props);
} catch (final ConnectionProfileException e) {
DatatoolsMySqlConnectivityPlugin.logError("Unable to create the
connection profile", e);
}
}
Re: Still can't create a connection [message #55209 is a reply to message #55182] Mon, 13 April 2009 17:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

Hey Mark...

Glad you're a bit futher along...

Couple of questions... The driver template ID you're providing in the
DefineDriver routine... Instead of using
" org.eclipse.datatools.connectivity.db.generic.genericDriverT emplate ", can
you try using "org.eclipse.datatools.enablement.mysql.5_1.driverTemplate".

I also don't think you need to set these properties for the driver:

> driverProperties.setProperty(IDriverMgmtConstants.PROP_DEFN_ TYPE,
> profileGenericJDBCDriverTemplateID);
> driverProperties.setProperty(IJDBCDriverDefinitionConstants. DATABASE_VENDOR_PROP_ID,
> "MySql");
> driverProperties.setProperty(IJDBCDriverDefinitionConstants. DATABASE_VERSION_PROP_ID,
> "5.1");

When you say that you can't edit anything more than the name/description,
are you seeing a property page called something like "JDBC Connection
Properties"? There should be more than one property page associated with
your profile.

If we can get the first part resolved, the catalog loader should be
satisfied as well, which should satisify your tree population issues.

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:2b36aedb74d3a857293328f26715a1ba$1@www.eclipse.org...
> Fitz,
>
> I worked on this over the weekend, and it's working well now with just two
> DSE issues that seem to be unrelated to what I've coded; hopefully just a
> config issue on my end.
>
> First, a quick summary of what changed over the weekend.
>
> 1. Issue with the DSE and profile connection not working together is
> fixed; it was a bug with my test client.
>
> 2. I re-factored once more. With my team's decision last week to decouple
> the driver and profile properties, ProfileManagerInitializationProvider
> extension is no longer needed. Now I have no extensions declared for the
> plug-in that provides connectivity. I programmatically define the driver
> and setup the profile, with the code you showed me earlier in the thread,
> getting the profile property settings from a file in the config directory.
> To get around the startup timing issue when we used earlyStartup with this
> approach, I activate my connectivity plug-in from the RCP app as the
> platform is coming up.
>
> Now everything works as desired except the following with the DSE.
>
> 1. As mentioned previously, when I edit the connection properties from the
> DSE entry for the profile, I only see the name and description, not the
> properties I set on the profile programmatically.
>
> 2. I don't see child entries for the profile that enable me to view and
> edit the tables.
>
> This is referring to when I launch an eclipse app with my plug-ins. When I
> look at the DSE in the IDE, I see an entry below the connection that
> enables me to view and edit the tables, schemas, etc. I'd like to have
> this same capability in the DSE when I launch my app.
>
> I thought I might be missing a DTP plug-in in my target environment, but I
> added every one that seemed even remotely applicable, and I still don't
> have the missing capability. Can you think of a plug-in or plug-ins I
> should check for? Or perhaps there's another property I need to set on my
> profile?
>
> Below is the code I'm using to define the driver and configure and create
> the profile. The property values are not evident in the snippet, but you
> can see what properties I'm setting.
>
> public void provideConnectivity() {
> final Properties profileProps = new ConnectionProfileProperties();//
> defineDriver(driverId, driverName);
> createProfile(driverId, profileProps);
> }
>
> private void defineDriver(final String driverId, final String driverName)
> {
> final String profileGenericJDBCDriverTemplateID =
> " org.eclipse.datatools.connectivity.db.generic.genericDriverT emplate ";
> final IPropertySet propSet = new PropertySetImpl(driverName, driverId);
> final Properties driverProperties = new Properties();
> driverProperties.setProperty(IJDBCDriverDefinitionConstants. DRIVER_CLASS_PROP_ID,
> "com.mysql.jdbc.Driver");
> driverProperties.setProperty(IDriverMgmtConstants.PROP_DEFN_ JARLIST,
> getJarList());
> driverProperties.setProperty(IDriverMgmtConstants.PROP_DEFN_ TYPE,
> profileGenericJDBCDriverTemplateID);
> driverProperties.setProperty(IJDBCDriverDefinitionConstants. DATABASE_VENDOR_PROP_ID,
> "MySql");
> driverProperties.setProperty(IJDBCDriverDefinitionConstants. DATABASE_VERSION_PROP_ID,
> "5.1");
> propSet.setBaseProperties(driverProperties);
> DriverManager.getInstance().addDriverInstance(propSet);
> }
>
> private void createProfile(final String driverID, final Properties
> profileProps) {
> final String driverURL = "jdbc:mysql://" + profileProps.getProperty(
> ProphetConnectionProfileConstants.PROP_DB_HOST_NAME) + ":"
> +
> profileProps.getProperty(ProphetConnectionProfileConstants.P ROP_DB_PORT) +
> "/testdb";
>
> connectionProfileName =
> profileProps.getProperty(ProphetConnectionProfileConstants.P ROP_PROFILE_NAME);
>
> final Properties props = new Properties();
> props.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEF INITION_ID,
> driverID);
> props.setProperty(IJDBCDriverDefinitionConstants.PASSWORD_PR OP_ID,
> profileProps.getProperty(ProphetConnectionProfileConstants.P ROP_PASSWORD));
> props.setProperty(IJDBCDriverDefinitionConstants.USERNAME_PR OP_ID,
> profileProps.getProperty(ProphetConnectionProfileConstants.P ROP_USER_ID));
> props.setProperty(IJDBCDriverDefinitionConstants.URL_PROP_ID , driverURL);
> //DTP will not persist the password if this property is not set
> props.setProperty(IJDBCConnectionProfileConstants.SAVE_PASSW ORD_PROP_ID,
> "true");
> props.setProperty(IJDBCConnectionProfileConstants.DATABASE_N AME_PROP_ID,
> "testdb");
> props.setProperty(IJDBCDriverDefinitionConstants.DATABASE_VE NDOR_PROP_ID,
> DriverManager.
> getInstance().getDriverInstanceByID(driverID)
>
> getNamedPropertyByID(IJDBCDriverDefinitionConstants.DATABASE _VENDOR_PROP_ID));
> props.setProperty(IJDBCDriverDefinitionConstants.DATABASE_VE RSION_PROP_ID,
> DriverManager.
> getInstance().getDriverInstanceByID(driverID)
>
> getNamedPropertyByID(IJDBCDriverDefinitionConstants.DATABASE _VERSION_PROP_ID));
> ProfileManager pfm = null;
> try {
> pfm = ProfileManager.getInstance();
> } catch (final Exception e) {
> DatatoolsMySqlConnectivityPlugin.logError("Unable to insantiate the
> Connection Profile Manager", e);
> return;
> }
>
> if (pfm.getProfileByName(this.connectionProfileName) == null) {
> createNewProfile(props);
> } else {
> modifyProfileProperties(props);
> }
> }
>
> private void createNewProfile(final Properties props) {
>
> ProfileManager pfm = null;
> try {
> pfm = ProfileManager.getInstance();
> } catch (final Exception e) {
> DatatoolsMySqlConnectivityPlugin.logError("Unable to insantiate the
> Connection Profile Manager", e);
> return;
> }
>
> try {
> pfm.createProfile(this.connectionProfileName, "Default connection profile
> for accessing the MySQL database", this.providerID, props);
> } catch (final ConnectionProfileException e) {
> DatatoolsMySqlConnectivityPlugin.logError("Unable to create the connection
> profile", e);
> }
> }
>
>
Re: Still can't create a connection [message #55234 is a reply to message #55209] Mon, 13 April 2009 18:29 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Thanks Fitz.

The value of driverID was already set to
org.eclipse.datatools.enablement.mysql.5_1.driverTemplate via an instance
variable assignment I didn't include in the snippet I posted. But I
changed the value of property IDriverMgmtConstants.PROP_DEFN_TYPE to be
the same value as driverID, and I took out the lines that set the values
of the vendor and version properties. If I don't set PROP_DEFN_TYPE to
reference the MySQL enablement template, everything works OK, I think, but
when I look at the driver in the Preference page it doesn't show the
vendor and version values.

With the above changes, I still have the two problems I mentioned earlier
when I launch my eclipse application. When I open the DSE view, I see a
top level entry "Database Connections" and below that is
"MySqlJdbcConnectionProfile", the profile that I created programmatically.
If I right-click and select ping, it works. If I double-click it, it
connects. But I never see any items below it, for schema, tables, etc.

If I right-click the profile and select Properties, a window comes up that
is titled "Properties for MySqlJdbcConnectionProfile". It has a tree on
the left that has top-levle elements "Common" and "Version". If I select
Common, on the right I have text box fields I can set for Name and
Description (optional), as well as a check box "Connect every time the
workbench is started." I'm hoping to see fields for setting the username,
password, etc. I also don't see any reference to the driver in the profile
properties, which I would think would be there. I don't see any other
property pages or references to such in the window that appears.

When I display the DSE in the IDE, of course I don't see any profiles
until I create them via the DTP GUI. From the context menu in the DSE, I
select New, to launch the New Connection Profile wizard. On the second
wizard page, I specify the driver from the drop-down menu, and configure
the driver properties. Then when I complete the wizard, in the DSE under
the entry for the profile, I see an entry for the database instance, which
I can then expand to see "Schemas" and "Tables", etc.

I thought maybe the problem only occurs for profiles created
programmatically. So I tried in the DSE for my launched eclipse
application to create a driver and profile manually via the DSE GUI. That
one behaved the same as the one created programmtically. I can ping it and
connect to it, but I don't see the child elements for it.

One possible hint for the cause of the difference is that my Preferences
pages are different between the IDE and the launched application. For the
IDE, I have a perference page Data Management/Connectivity/Database
Conenction Profile. Ut has two checkboxes "Show schema" and "Show database
object owner". I don;t have this preference page on the launched
application. I have the page Data Management/Connectivity, but it's only
child page is Driver Definitions. That's what made me think I may be
missing a plug-in for the launched application.
Re: Still can't create a connection [message #55261 is a reply to message #55234] Mon, 13 April 2009 18:36 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Correction: I do see a see reference to the driver from the profile
properties page. In addition to the Common and Version pages in the tree
on the left, I also see pages for filters (schema, tables, and stored
procs) and a page for Driver Properties.
Re: Still can't create a connection [message #55288 is a reply to message #55261] Tue, 14 April 2009 13:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

And on the Driver Properties page, you can't edit the properties for the
profile?
--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:9334931d851f5832bf04c37d0974132b$1@www.eclipse.org...
> Correction: I do see a see reference to the driver from the profile
> properties page. In addition to the Common and Version pages in the tree
> on the left, I also see pages for filters (schema, tables, and stored
> procs) and a page for Driver Properties.
>
Re: Still can't create a connection [message #55314 is a reply to message #55288] Tue, 14 April 2009 15:38 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Brian Fitzpatrick wrote:

> And on the Driver Properties page, you can't edit the properties for the
> profile?
> --Fitz

Actually, I can edit the properties there. I was assuming that I'd be
modifying the properties bound to the driver rather than those bound to
the profile in that case, since the properties page is named Driver
Properties. It's my understanding that DTP intends to provide a driver
definition independent of profile definitions, so users can create
multiple profiles that potentially use the same driver, with the driver
providing a single physical connection spec and the profiles providing
different user-oriented connection properties. For our purposes, we'd like
to have one fixed driver definition (class name and jar file) and
(potentially) different connection profiles with distinct user IDs,
passwords, databases, or URLs.

Am I correct that I'd be modifying the driver properties vice the profile
properties on the Driver properties page that comes up when viewing a
profile? Either way, this is not too big of a deal. I'm more concerned
with having the ability to view and edit tables through the DSE. That
would be a very convenient development support capability.
Re: Still can't create a connection [message #55341 is a reply to message #55314] Tue, 14 April 2009 23:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

Actually even though it's labeled "Driver Properties" -- it's actually the
properties for the profile. It's very poorly labeled. If you feel so
inclined, you can create a bug in Bugzilla for it so we change the label.

But even so, you're still not able to connect and drill into the profile to
see the tables?

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:2160e030dcac13e21edfeda9bea74219$1@www.eclipse.org...
> Brian Fitzpatrick wrote:
>
>> And on the Driver Properties page, you can't edit the properties for the
>> profile?
>> --Fitz
>
> Actually, I can edit the properties there. I was assuming that I'd be
> modifying the properties bound to the driver rather than those bound to
> the profile in that case, since the properties page is named Driver
> Properties. It's my understanding that DTP intends to provide a driver
> definition independent of profile definitions, so users can create
> multiple profiles that potentially use the same driver, with the driver
> providing a single physical connection spec and the profiles providing
> different user-oriented connection properties. For our purposes, we'd like
> to have one fixed driver definition (class name and jar file) and
> (potentially) different connection profiles with distinct user IDs,
> passwords, databases, or URLs.
>
> Am I correct that I'd be modifying the driver properties vice the profile
> properties on the Driver properties page that comes up when viewing a
> profile? Either way, this is not too big of a deal. I'm more concerned
> with having the ability to view and edit tables through the DSE. That
> would be a very convenient development support capability.
>
>
Re: Still can't create a connection [message #55369 is a reply to message #55341] Wed, 15 April 2009 13:11 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Brian Fitzpatrick wrote:

> Actually even though it's labeled "Driver Properties" -- it's actually the
> properties for the profile. It's very poorly labeled. If you feel so
> inclined, you can create a bug in Bugzilla for it so we change the label.

> But even so, you're still not able to connect and drill into the profile to
> see the tables?

> --Fitz

Thanks, it's good to know those are the profile properties. I'll go ahead
and create a Bugzilla entry about changing the label.

Yes, the only remaining problem I have with my current DTP-based
implementation is the inability to drill into my profile via the DSE and
view or edit tables. I can connect to the profile in the DSE, but I just
don't see any child entries for the profile.

I can drill down in the DSE if I just launch the eclipse IDE and display
the DSE view. But when I launch an eclipse application with the plug-ins
that I and my team have created, the DSE doesn't have the ability to
drill-down to tables. That's why I'm thinking I might just be missing the
DTP plug-in that enables this capability in the DSE, though I've tried
adding various DTP plug-ins to my workspace and/or target environment.
Re: Still can't create a connection [message #55395 is a reply to message #55369] Wed, 15 April 2009 13:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

What DTP plug-ins do you have in your project so far and I can probably tell
you what's missing?
--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:7f35f0f751f03ba21095ae5b11fc27e1$1@www.eclipse.org...
> Brian Fitzpatrick wrote:
>
>> Actually even though it's labeled "Driver Properties" -- it's actually
>> the properties for the profile. It's very poorly labeled. If you feel so
>> inclined, you can create a bug in Bugzilla for it so we change the label.
>
>> But even so, you're still not able to connect and drill into the profile
>> to see the tables?
>
>> --Fitz
>
> Thanks, it's good to know those are the profile properties. I'll go ahead
> and create a Bugzilla entry about changing the label.
>
> Yes, the only remaining problem I have with my current DTP-based
> implementation is the inability to drill into my profile via the DSE and
> view or edit tables. I can connect to the profile in the DSE, but I just
> don't see any child entries for the profile.
>
> I can drill down in the DSE if I just launch the eclipse IDE and display
> the DSE view. But when I launch an eclipse application with the plug-ins
> that I and my team have created, the DSE doesn't have the ability to
> drill-down to tables. That's why I'm thinking I might just be missing the
> DTP plug-in that enables this capability in the DSE, though I've tried
> adding various DTP plug-ins to my workspace and/or target environment.
>
Re: Still can't create a connection [message #55423 is a reply to message #55395] Wed, 15 April 2009 17:06 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Brian Fitzpatrick wrote:

> What DTP plug-ins do you have in your project so far and I can probably tell
> you what's missing?
> --Fitz

These are the DTP plug-ins I have in my target:

02/17/2009 10:21 PM 25,804
org.eclipse.datatools.connectivity.console.profile_1.0.0.v20 0805231345.jar
02/17/2009 10:21 PM 27,692
org.eclipse.datatools.connectivity.db.generic.ui_1.0.1.v2008 05152355.jar
04/10/2009 04:38 PM 13,015
org.eclipse.datatools.connectivity.db.generic_1.0.1.v2008101 40922.jar
02/17/2009 10:21 PM 8,695
org.eclipse.datatools.connectivity.dbdefinition.genericJDBC_ 1.0.1.v200810300511.jar
02/17/2009 10:21 PM 324,241
org.eclipse.datatools.connectivity.sqm.core.ui_1.1.3.v200902 070558.jar
04/10/2009 04:38 PM 309,127
org.eclipse.datatools.connectivity.sqm.core_1.0.7.v200902180 551.jar
04/10/2009 04:38 PM 75,769
org.eclipse.datatools.connectivity.ui.dse_1.1.3.v20081014034 9.jar
02/17/2009 10:22 PM 70,272
org.eclipse.datatools.connectivity.ui.templates_1.0.0.v20080 5152355.jar
04/10/2009 04:38 PM 532,625
org.eclipse.datatools.connectivity.ui_1.1.3.v200901150027.ja r
04/10/2009 04:38 PM 230,243
org.eclipse.datatools.connectivity_1.1.2.v200901090028.jar
02/17/2009 10:24 PM 18,632
org.eclipse.datatools.enablement.mysql.dbdefinition_1.0.4.v2 00901090853.jar
02/17/2009 10:24 PM 11,736
org.eclipse.datatools.enablement.mysql.ui_1.0.0.v20080515235 5.jar
02/17/2009 10:24 PM 57,210
org.eclipse.datatools.enablement.mysql_1.0.2.v200810160130.j ar
04/10/2009 04:38 PM 13,677
org.eclipse.datatools.help_1.5.0.v200805152355.jar
04/10/2009 04:38 PM 161,196
org.eclipse.datatools.modelbase.dbdefinition_1.0.1.v20090109 0853.jar
02/17/2009 10:26 PM 274,569
org.eclipse.datatools.modelbase.sql.edit_1.0.0.v200805152355 .jar
02/17/2009 10:26 PM 190,244
org.eclipse.datatools.modelbase.sql.query.edit_1.0.0.v200806 070329.jar
02/17/2009 10:26 PM 554,526
org.eclipse.datatools.modelbase.sql.query_1.0.1.v20090124114 5.jar
02/17/2009 10:27 PM 256,701
org.eclipse.datatools.modelbase.sql.xml.query_1.0.0.v2008070 80500.jar
04/10/2009 04:38 PM 429,277
org.eclipse.datatools.modelbase.sql_1.0.1.v200812031125.jar
02/17/2009 10:27 PM 125,565
org.eclipse.datatools.sqltools.common.ui_1.0.0.v200812121740 .jar
02/17/2009 10:27 PM 62,994
org.eclipse.datatools.sqltools.data.core_1.0.1.v200902140515 .jar
02/17/2009 10:27 PM 109,403
org.eclipse.datatools.sqltools.data.ui_1.1.1.v200901140830.j ar
02/17/2009 10:27 PM 144,149
org.eclipse.datatools.sqltools.db.derby_1.0.0.v200805152355. jar
02/17/2009 10:27 PM 131,176
org.eclipse.datatools.sqltools.db.generic_1.0.0.v20090203160 0.jar
02/17/2009 10:27 PM 66,532
org.eclipse.datatools.sqltools.ddlgen.ui_1.0.0.v200808140615 .jar
02/17/2009 10:27 PM 116,271
org.eclipse.datatools.sqltools.debugger.core_1.0.0.v20080814 0615.jar
02/17/2009 10:27 PM 149,776
org.eclipse.datatools.sqltools.doc.user_1.6.1.v2008082813371 3.jar
02/17/2009 10:28 PM 172,920
org.eclipse.datatools.sqltools.editor.core_1.0.0.v2009020316 00.jar
02/17/2009 10:28 PM 137,865
org.eclipse.datatools.sqltools.parsers.sql.lexer_1.0.1.v2008 11081015.jar
02/17/2009 10:28 PM 299,987
org.eclipse.datatools.sqltools.parsers.sql.query_1.0.1.v2008 10291500.jar
02/17/2009 10:28 PM 274,409
org.eclipse.datatools.sqltools.parsers.sql.xml.query_1.0.0.v 200808140615.jar
02/17/2009 10:28 PM 42,531
org.eclipse.datatools.sqltools.parsers.sql_1.0.1.v2008081406 15.jar
02/17/2009 10:28 PM 123,971
org.eclipse.datatools.sqltools.plan_1.0.0.v200812121520.jar
02/17/2009 10:28 PM 374,293
org.eclipse.datatools.sqltools.result_1.0.0.v200902120900.ja r
02/17/2009 10:28 PM 185,043
org.eclipse.datatools.sqltools.routineeditor_1.0.0.v20080721 1830.jar
02/17/2009 10:28 PM 1,029,608
org.eclipse.datatools.sqltools.sqlbuilder_1.0.0.v20090128065 0.jar
02/17/2009 10:29 PM 451,600
org.eclipse.datatools.sqltools.sqleditor_1.0.0.v200901220945 .jar
02/17/2009 10:29 PM 123,355
org.eclipse.datatools.sqltools.sqlscrapbook_1.0.0.v200901151 810.jar
02/17/2009 10:28 PM 89,401
org.eclipse.datatools.sqltools.sql_1.0.0.v200902031600.jar
02/17/2009 10:29 PM 28,366
org.eclipse.datatools.sqltools.tabledataeditor_1.0.0.v200901 280500.jar
02/17/2009 10:29 PM 72,146
org.eclipse.datatools.sqltools.tablewizard_1.0.0.v2008081406 15.jar
Re: Still can't create a connection [message #55477 is a reply to message #55423] Wed, 15 April 2009 20:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

Based on that list, I don't think you're missing anything.

And you're getting absolutely nothing in the tree when you connect? No +
sign to expand or anything?

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:c9a1e5c0ee4ac2350bb0f3c21cee032d$1@www.eclipse.org...
> Brian Fitzpatrick wrote:
>
>> What DTP plug-ins do you have in your project so far and I can probably
>> tell you what's missing?
>> --Fitz
>
> These are the DTP plug-ins I have in my target:
>
> 02/17/2009 10:21 PM 25,804
> org.eclipse.datatools.connectivity.console.profile_1.0.0.v20 0805231345.jar
> 02/17/2009 10:21 PM 27,692
> org.eclipse.datatools.connectivity.db.generic.ui_1.0.1.v2008 05152355.jar
> 04/10/2009 04:38 PM 13,015
> org.eclipse.datatools.connectivity.db.generic_1.0.1.v2008101 40922.jar
> 02/17/2009 10:21 PM 8,695
> org.eclipse.datatools.connectivity.dbdefinition.genericJDBC_ 1.0.1.v200810300511.jar
> 02/17/2009 10:21 PM 324,241
> org.eclipse.datatools.connectivity.sqm.core.ui_1.1.3.v200902 070558.jar
> 04/10/2009 04:38 PM 309,127
> org.eclipse.datatools.connectivity.sqm.core_1.0.7.v200902180 551.jar
> 04/10/2009 04:38 PM 75,769
> org.eclipse.datatools.connectivity.ui.dse_1.1.3.v20081014034 9.jar
> 02/17/2009 10:22 PM 70,272
> org.eclipse.datatools.connectivity.ui.templates_1.0.0.v20080 5152355.jar
> 04/10/2009 04:38 PM 532,625
> org.eclipse.datatools.connectivity.ui_1.1.3.v200901150027.ja r
> 04/10/2009 04:38 PM 230,243
> org.eclipse.datatools.connectivity_1.1.2.v200901090028.jar
> 02/17/2009 10:24 PM 18,632
> org.eclipse.datatools.enablement.mysql.dbdefinition_1.0.4.v2 00901090853.jar
> 02/17/2009 10:24 PM 11,736
> org.eclipse.datatools.enablement.mysql.ui_1.0.0.v20080515235 5.jar
> 02/17/2009 10:24 PM 57,210
> org.eclipse.datatools.enablement.mysql_1.0.2.v200810160130.j ar
> 04/10/2009 04:38 PM 13,677
> org.eclipse.datatools.help_1.5.0.v200805152355.jar
> 04/10/2009 04:38 PM 161,196
> org.eclipse.datatools.modelbase.dbdefinition_1.0.1.v20090109 0853.jar
> 02/17/2009 10:26 PM 274,569
> org.eclipse.datatools.modelbase.sql.edit_1.0.0.v200805152355 .jar
> 02/17/2009 10:26 PM 190,244
> org.eclipse.datatools.modelbase.sql.query.edit_1.0.0.v200806 070329.jar
> 02/17/2009 10:26 PM 554,526
> org.eclipse.datatools.modelbase.sql.query_1.0.1.v20090124114 5.jar
> 02/17/2009 10:27 PM 256,701
> org.eclipse.datatools.modelbase.sql.xml.query_1.0.0.v2008070 80500.jar
> 04/10/2009 04:38 PM 429,277
> org.eclipse.datatools.modelbase.sql_1.0.1.v200812031125.jar
> 02/17/2009 10:27 PM 125,565
> org.eclipse.datatools.sqltools.common.ui_1.0.0.v200812121740 .jar
> 02/17/2009 10:27 PM 62,994
> org.eclipse.datatools.sqltools.data.core_1.0.1.v200902140515 .jar
> 02/17/2009 10:27 PM 109,403
> org.eclipse.datatools.sqltools.data.ui_1.1.1.v200901140830.j ar
> 02/17/2009 10:27 PM 144,149
> org.eclipse.datatools.sqltools.db.derby_1.0.0.v200805152355. jar
> 02/17/2009 10:27 PM 131,176
> org.eclipse.datatools.sqltools.db.generic_1.0.0.v20090203160 0.jar
> 02/17/2009 10:27 PM 66,532
> org.eclipse.datatools.sqltools.ddlgen.ui_1.0.0.v200808140615 .jar
> 02/17/2009 10:27 PM 116,271
> org.eclipse.datatools.sqltools.debugger.core_1.0.0.v20080814 0615.jar
> 02/17/2009 10:27 PM 149,776
> org.eclipse.datatools.sqltools.doc.user_1.6.1.v2008082813371 3.jar
> 02/17/2009 10:28 PM 172,920
> org.eclipse.datatools.sqltools.editor.core_1.0.0.v2009020316 00.jar
> 02/17/2009 10:28 PM 137,865
> org.eclipse.datatools.sqltools.parsers.sql.lexer_1.0.1.v2008 11081015.jar
> 02/17/2009 10:28 PM 299,987
> org.eclipse.datatools.sqltools.parsers.sql.query_1.0.1.v2008 10291500.jar
> 02/17/2009 10:28 PM 274,409
> org.eclipse.datatools.sqltools.parsers.sql.xml.query_1.0.0.v 200808140615.jar
> 02/17/2009 10:28 PM 42,531
> org.eclipse.datatools.sqltools.parsers.sql_1.0.1.v2008081406 15.jar
> 02/17/2009 10:28 PM 123,971
> org.eclipse.datatools.sqltools.plan_1.0.0.v200812121520.jar
> 02/17/2009 10:28 PM 374,293
> org.eclipse.datatools.sqltools.result_1.0.0.v200902120900.ja r
> 02/17/2009 10:28 PM 185,043
> org.eclipse.datatools.sqltools.routineeditor_1.0.0.v20080721 1830.jar
> 02/17/2009 10:28 PM 1,029,608
> org.eclipse.datatools.sqltools.sqlbuilder_1.0.0.v20090128065 0.jar
> 02/17/2009 10:29 PM 451,600
> org.eclipse.datatools.sqltools.sqleditor_1.0.0.v200901220945 .jar
> 02/17/2009 10:29 PM 123,355
> org.eclipse.datatools.sqltools.sqlscrapbook_1.0.0.v200901151 810.jar
> 02/17/2009 10:28 PM 89,401
> org.eclipse.datatools.sqltools.sql_1.0.0.v200902031600.jar
> 02/17/2009 10:29 PM 28,366
> org.eclipse.datatools.sqltools.tabledataeditor_1.0.0.v200901 280500.jar
> 02/17/2009 10:29 PM 72,146
> org.eclipse.datatools.sqltools.tablewizard_1.0.0.v2008081406 15.jar
>
Re: Still can't create a connection [message #55504 is a reply to message #55477] Wed, 15 April 2009 20:36 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Brian Fitzpatrick wrote:

> Based on that list, I don't think you're missing anything.

> And you're getting absolutely nothing in the tree when you connect? No +
> sign to expand or anything?

Yes, that's correct, absolutely nothing. Since it works in the IDE, I know
what I'm supposed to see, and it's definitely not there when running an
eclipse app. And as I mentioned previously, I tried defining a profile
manually via the DSE view menu, and that profile also didn't have any
child elements either.
Re: Still can't create a connection [message #55529 is a reply to message #55504] Wed, 15 April 2009 20:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

Can you create a different type of connection profile? Such as for a Derby
database or something?

I'm just trying to determine if it's the fact that the driver is overridden
or that something is missing...

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:af7cd8bb467a50921c10385ff9e92cd3$1@www.eclipse.org...
> Brian Fitzpatrick wrote:
>
>> Based on that list, I don't think you're missing anything.
>
>> And you're getting absolutely nothing in the tree when you connect? No +
>> sign to expand or anything?
>
> Yes, that's correct, absolutely nothing. Since it works in the IDE, I know
> what I'm supposed to see, and it's definitely not there when running an
> eclipse app. And as I mentioned previously, I tried defining a profile
> manually via the DSE view menu, and that profile also didn't have any
> child elements either.
>
Re: Still can't create a connection [message #55685 is a reply to message #55529] Thu, 16 April 2009 19:12 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Brian Fitzpatrick wrote:

> Can you create a different type of connection profile? Such as for a Derby
> database or something?

Fitz,

Success at last! The Derby suggestion was a good one. I had to add a
number of bundles to get the Derby bundles to resolve, and some of those
turned out to be the ones needed to make the MySQL profile drill-down
work. The missing bundles were:

org.eclipse.datatools.connectivity.sqm.core.ui
org.eclipse.datatools.connectivity.sqm.server.ui
org.eclipse.datatools.modelbase.sql.edit


It's interesting that the dependencies were identified when I used Derby,
but for MySQL profiles the DSE silently failed to expose the drill-down
capability. Perhaps that's something that can be addressed.

Once again, I;'m very grateful for the superb help you gave me. You hung
in there with me, and we were able to get everything that I needed working.

-Mark
Re: Still can't create a connection [message #55712 is a reply to message #55685] Fri, 17 April 2009 14:04 Go to previous message
Eclipse UserFriend
Originally posted by: brianf.sybase.com

Hooray! :)

You bet. I'm glad I could help and it was a relatively minor problem of
missing bundles in the end. I had a few more options, but they got ugly
quickly. ;)

I'm going to take this thread and try and write up some basics on using the
APIs and the various options available on the Wiki. It was a great exercise
trying to walk someone else through the process -- thanks for being patient!

Do let us know if you need anything else and if you find more bugs or
issues, give us a holler!

Have a great weekend!

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:ac29597ba240eb07094fa7c5dd29cc5a$1@www.eclipse.org...
> Brian Fitzpatrick wrote:
>
>> Can you create a different type of connection profile? Such as for a
>> Derby database or something?
>
> Fitz,
>
> Success at last! The Derby suggestion was a good one. I had to add a
> number of bundles to get the Derby bundles to resolve, and some of those
> turned out to be the ones needed to make the MySQL profile drill-down
> work. The missing bundles were:
>
> org.eclipse.datatools.connectivity.sqm.core.ui
> org.eclipse.datatools.connectivity.sqm.server.ui
> org.eclipse.datatools.modelbase.sql.edit
>
>
> It's interesting that the dependencies were identified when I used Derby,
> but for MySQL profiles the DSE silently failed to expose the drill-down
> capability. Perhaps that's something that can be addressed.
>
> Once again, I;'m very grateful for the superb help you gave me. You hung
> in there with me, and we were able to get everything that I needed
> working.
>
> -Mark
>
Re: Still can't create a connection [message #594971 is a reply to message #53986] Thu, 02 April 2009 23:06 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
What provider ID are you providing the create call?
--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:7f2bf17f632058c4e75fad7f54d0035f$1@www.eclipse.org...
> I've been trying for three weeks, and I can't figure out to
> programmatically access a JDBC connection with DTP. My objective is to
> provide a plugin that wraps a JDBC connection, so that other plugins can
> create DB connections without having to know the physical location of the
> jar file, the driver class, etc.
>
> The approach I'm currently working on is to declare a driverExtension
> extension, which uses a driverOverride element to override the URL and
> dtabase name properties for the MySQL driver template included in the
> enablement plugin. Then I call ProfileManager.createProfile(), giving it
> an arbitrary name, description, and provider ID, as well as a Properties
> object that has the username, password and driver template ID (the ID of
> the driver template that I overrode).
>
> I can call methods on the profile created in this way, and when I call
> aerPropertiesComplete() it returns true. However, when I try to call
> createConnection() on the profile, I get a Null Pointer Exception. Looking
> in the DTP source code, there's only a single line in that method, and it
> is
>
> return mProvider.getConnectionFactory(factoryId).createConnection(t his);
>
> I suspect it's the mProvider object that is null, because I provided an
> arbitrary name for the provider parameter when I called
> ConnectionProfileManager.createConnection(). I didn't think that was
> right, but I couldn't find anything that tells how to specify the
> provider, or if that's supposed to connect to the profile somehow.
>
> Maybe the provider is the missing link, or maybe I got something else
> wrong. Can someone please tell me what I have wrong and how I can access a
> connection?
>
> -Mark
>
Re: Still can't create a connection [message #594990 is a reply to message #54057] Fri, 03 April 2009 03:16 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Brian Fitzpatrick wrote:
> What provider ID are you providing the create call?
> --Fitz
>

I tried a couple things. First I tried arbitrary text, maybe the name of
my project or something like that, I'm not sure. Then I tried

org.eclipse.datatools.enablement.mysql.connectionProfile

Which is the ID of the Connection Profile from the enablement plugin's
plugin.xml. I was desperate for something to use fo provider because I
guess I'm missing wherever it is in the documentation that it explains
what a provider is and how to use it.

I've pasted below the relevant portion of my plugin.xml and the code I
use to create the profile.

Plugin.xml:

(This attempts to override some driver properties of the driver template
declared in the enablement plug-in's plugin.xml. I also tried repeating
the enablement plug-in's driverTemplate element in my plugin.xml, since
createDefault is set to false.)

<extension point="org.eclipse.datatools.connectivity.driverExtension">
<category
id="org.eclipse.datatools.connectivity.db.driverCategory"
name="Database"/>

<driverTemplateOverride
jarList="mysql-connector-java-5.1.7-bin.jar"
name="Override for Generic JDBC Driver"
targetId="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate ">

<propertyOverrides>

<propertyOverride
targetId="org.eclipse.datatools.connectivity.db.databaseName "
name="Database Name"
value="test"
required="true"
visible="true"/>
<propertyOverride
targetId="org.eclipse.datatools.connectivity.db.URL"
name="Driver Connection URL"
value="jdbc:mysql://localhost:3306/test"
required="true"
visible="true"/>
</propertyOverrides>

</driverTemplateOverride>
</extension>

And here's the code that attempts to create the profile. Debug output is
added to resList and returned as an array because I call the method from
a list view's content provider.

public class ProfileWrapper {

private List<String> resList = null;
private String driverID = "";
private String userName = "";
private String password = "";

public ProfileWrapper(String driverID, String userName, String
password, List<String> resList){
this.driverID = driverID;
this.userName = userName;
this.password = password;
this.resList = resList;
}

public IConnectionProfile getProfile(){
IConnectionProfile profile = null;
ProfileManager pfm = ProfileManager.getInstance();
if (pfm == null){
resList.add("No ProfileManager");
}
else{

try {
pfm.deleteProfile(pfm.getProfileByName("MySQL"));
} catch (ConnectionProfileException e2) {
resList.add("Delete Profile: ConnectionProfileException:" +
e2.getMessage());
e2.printStackTrace();
}

Properties props = new Properties();

props.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEF INITION_ID,
driverID);
props.setProperty(ConnectionProfileConstants.PROP_PWD, password);
props.setProperty(ConnectionProfileConstants.PROP_UID, userName);

try {
pfm.createProfile("MySQL", "MySQL JDBC Driver",
"org.eclipse.datatools.enablement.mysql.connectionProfile", props);
} catch (ConnectionProfileException e1) {
resList.add("Create Profile: ConnectionProfileException:"
+ e1.getMessage());
e1.printStackTrace();
}
profile = pfm.getProfileByName("MySQL");

resList.add("Provider ID: " + profile.getProviderId());
resList.add("Profile path: " + pfm.getProfilePath(profile));


if (profile.arePropertiesComplete()){
resList.add("Properties are complete");
} else {
resList.add("Properties are NOT complete");
}
}
return profile;
}
}
Re: Still can't create a connection [message #594999 is a reply to message #54108] Fri, 03 April 2009 04:16 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
I just realized I didn't include the code that calls the ProfileWrapper
class, so you can see the parameters I pass. here it is.

String driverID =
"org.eclipse.datatools.enablement.mysql.5_1.driverTemplate";
String userName = "root";
String password = "*********";
ProfileWrapper pw = new ProfileWrapper(
driverID,
userName,
password,
resList);
IConnectionProfile profile = pw.getProfile();
try {
profile.connect();//NPE occurs here.
....
Re: Still can't create a connection [message #595007 is a reply to message #54134] Fri, 03 April 2009 15:44 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
I've made further progress, but still getting an exception. I found I was
missing some of the dependencies of the enablement plug-in, so I added
them to the target. Now I seem to be engaging the enablement code, and I
get farther along.

I no longer get an exception when I call connect() on the
IConnectionProfile instance. But then I execute

org.eclipse.datatools.connectivity.IConnection connection =
connectionProfile.createConnection("java.sql.Connection");
java.sql.Connection rawConn = (Connection)connection.getRawConnection();
Statement s = rawConn.createStatement();//NPE thrown here

And I get an NPE for the last statement, as shown.

I also get an exception thrown from the DTP code, which appears to be the
root cause of the NPE. That exception is

java.lang.Exception: Driver definition could not be found.

and it is thrown by

org.eclipse.datatools.connectivity.DriverConnectionBase.getD riverDefinition
at line 139.

Looking at the source code, it appears that my driver definition ID is
being passed to the profile instance, but the definition is not valid.
Here's a snippet from getDriverDefinition() that shows where the above
exception is being thrown. Previous to this snippet, a null check on the
property PROP_DRIVER_DEFINITION_ID showed it was not null.

mDriver = DriverManager.getInstance().getDriverInstanceByID(
driverID);
if (mDriver == null) {
throw new Exception(...)); //$NON-NLS-1$
}

I should also mention that I'm now getting an indication that all the
properties on the profile are NOT complete. I'm setting
PROP_DRIVER_DEFINITION_ID, PROP_PWD, and PROP_UID. Is there somewhere
identified which properties need to be set?
Re: Still can't create a connection [message #595020 is a reply to message #54160] Fri, 03 April 2009 16:58 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
Well that's great!

The driver template alone isn't enough. You have to create a driver
definition...

String profileGenericJDBCDriverTemplateID =
" org.eclipse.datatools.connectivity.db.generic.genericDriverT emplate ";

String driverName = "MyDriver";

String driverID = "MyDriverID";

String driverClass = "org.apache.derby.jdbc.EmbeddedDriver"; //$NON-NLS-1$

String driverURL = "jdbc:derby:" + dbPath + ";create=true"; //$NON-NLS-1$
//$NON-NLS-2$

String jarList = "C:\\Derby10.1.3.1\\db-derby-10.1.3.1-bin\\lib\\derby.jar";
//$NON-NLS-1$

IPropertySet propSet = new PropertySetImpl(driverName, driverID);

Properties driverProperties = new Properties();

driverProperties.setProperty(IJDBCConnectionProfileConstants .DRIVER_CLASS_PROP_ID,

driverClass);

driverProperties.setProperty(IDriverMgmtConstants.PROP_DEFN_ JARLIST,

jarList);

driverProperties.setProperty(IDriverMgmtConstants.PROP_DEFN_ TYPE,

profileGenericJDBCDriverTemplateID);

propSet.setBaseProperties(driverProperties);

DriverManager.getInstance().addDriverInstance(propSet);


Then you can use the driver definition ID for your connection profile
properties...

baseProperties.setProperty(ConnectionProfileConstants.PROP_D RIVER_DEFINITION_ID,

driverID);


See if that gets you any further...
--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:939a8c3a79541b3417b62f76966a3796$1@www.eclipse.org...
> I've made further progress, but still getting an exception. I found I was
> missing some of the dependencies of the enablement plug-in, so I added
> them to the target. Now I seem to be engaging the enablement code, and I
> get farther along.
>
> I no longer get an exception when I call connect() on the
> IConnectionProfile instance. But then I execute
>
> org.eclipse.datatools.connectivity.IConnection connection =
> connectionProfile.createConnection("java.sql.Connection");
> java.sql.Connection rawConn = (Connection)connection.getRawConnection();
> Statement s = rawConn.createStatement();//NPE thrown here
>
> And I get an NPE for the last statement, as shown.
>
> I also get an exception thrown from the DTP code, which appears to be the
> root cause of the NPE. That exception is
>
> java.lang.Exception: Driver definition could not be found.
>
> and it is thrown by
> org.eclipse.datatools.connectivity.DriverConnectionBase.getD riverDefinition
> at line 139.
>
> Looking at the source code, it appears that my driver definition ID is
> being passed to the profile instance, but the definition is not valid.
> Here's a snippet from getDriverDefinition() that shows where the above
> exception is being thrown. Previous to this snippet, a null check on the
> property PROP_DRIVER_DEFINITION_ID showed it was not null.
>
> mDriver = DriverManager.getInstance().getDriverInstanceByID(
> driverID);
> if (mDriver == null) {
> throw new Exception(...)); //$NON-NLS-1$
> }
>
> I should also mention that I'm now getting an indication that all the
> properties on the profile are NOT complete. I'm setting
> PROP_DRIVER_DEFINITION_ID, PROP_PWD, and PROP_UID. Is there somewhere
> identified which properties need to be set?
>
>
>
>
>
Re: Still can't create a connection [message #595030 is a reply to message #54186] Fri, 03 April 2009 20:07 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Thanks!

That worked for me. At least I can make queries on the connection and get
the results back. I'm getting some exceptions however, with the root cause
apparently that I don't have an entry in the database definition registry.

I couldn't find any properties to set on the driver or connection profile
that seem to pertain to this.

Here's the stack trace


java.lang.NullPointerException
at java.util.TreeMap.getEntry(TreeMap.java:324)
at java.util.TreeMap.get(TreeMap.java:255)
at
org.eclipse.datatools.connectivity.sqm.internal.core.definit ion.DatabaseDefinitionRegistryImpl.getDefinition(DatabaseDef initionRegistryImpl.java:71)
at
org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionInfoImpl. <init>(ConnectionInfoImpl.java:629)
at
org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionInfoImpl. <init>(ConnectionInfoImpl.java:640)
at
org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionFactory.createConnection(ConnectionFactory.jav a:38)
at
org.eclipse.datatools.connectivity.sqm.core.SQMConnectionFac tory.createConnection(SQMConnectionFactory.java:45)
at
org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionFactory.createConnection(ConnectionFactory.jav a:59)
at
org.eclipse.datatools.connectivity.internal.ConnectionFactor yAdapterProvider.createConnection(ConnectionFactoryAdapterPr ovider.java:114)
at
org.eclipse.datatools.connectivity.internal.ManagedConnectio n.createConnection(ManagedConnection.java:163)
at
org.eclipse.datatools.connectivity.internal.CreateConnection Job.run(CreateConnectionJob.java:56)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Re: Still can't create a connection [message #595042 is a reply to message #54212] Fri, 03 April 2009 21:31 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
Cool. Glad we're getting closer. :)

I'm guessing it's because you're missing the Vendor and Version properties
in your connection profile properties...

After you get your driver definition, try adding these properties to your
connection profile properties...

baseProperties.setProperty(IJDBCDriverDefinitionConstants.DA TABASE_VENDOR_PROP_ID,

DriverManager.getInstance().getDriverInstanceByID(driverID). getNamedPropertyByID(IJDBCDriverDefinitionConstants.DATABASE _VENDOR_PROP_ID));

baseProperties.setProperty(IJDBCDriverDefinitionConstants.DA TABASE_VERSION_PROP_ID,

DriverManager.getInstance().getDriverInstanceByID(driverID). getNamedPropertyByID(IJDBCDriverDefinitionConstants.DATABASE _VERSION_PROP_ID));

The Database definition is retrieved by the vendor/version combo...

HTH
--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:734aa0a1e3abfd50d699e087b0851b79$1@www.eclipse.org...
> Thanks!
>
> That worked for me. At least I can make queries on the connection and get
> the results back. I'm getting some exceptions however, with the root cause
> apparently that I don't have an entry in the database definition registry.
>
> I couldn't find any properties to set on the driver or connection profile
> that seem to pertain to this.
>
> Here's the stack trace
>
>
> java.lang.NullPointerException
> at java.util.TreeMap.getEntry(TreeMap.java:324)
> at java.util.TreeMap.get(TreeMap.java:255)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.definit ion.DatabaseDefinitionRegistryImpl.getDefinition(DatabaseDef initionRegistryImpl.java:71)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionInfoImpl. <init>(ConnectionInfoImpl.java:629)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionInfoImpl. <init>(ConnectionInfoImpl.java:640)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionFactory.createConnection(ConnectionFactory.jav a:38)
> at
> org.eclipse.datatools.connectivity.sqm.core.SQMConnectionFac tory.createConnection(SQMConnectionFactory.java:45)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionFactory.createConnection(ConnectionFactory.jav a:59)
> at
> org.eclipse.datatools.connectivity.internal.ConnectionFactor yAdapterProvider.createConnection(ConnectionFactoryAdapterPr ovider.java:114)
> at
> org.eclipse.datatools.connectivity.internal.ManagedConnectio n.createConnection(ManagedConnection.java:163)
> at
> org.eclipse.datatools.connectivity.internal.CreateConnection Job.run(CreateConnectionJob.java:56)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
>
>
Re: Still can't create a connection [message #595049 is a reply to message #54238] Fri, 03 April 2009 21:54 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Yes, closer indeed, but still not at the finish line. Now it's complaining
about the catalog. Here's the stack trace.

-Mark


java.lang.NullPointerException
at
org.eclipse.datatools.connectivity.sqm.internal.core.util.Da tabaseProviderHelper.getCatalogDatabase(DatabaseProviderHelp er.java:37)
at
org.eclipse.datatools.connectivity.sqm.internal.core.util.Da tabaseProviderHelper.setDatabase(DatabaseProviderHelper.java :47)
at
org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionInfoImpl.initializeJDBCConnection(ConnectionIn foImpl.java:672)
at
org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionInfoImpl. <init>(ConnectionInfoImpl.java:644)
at
org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionFactory.createConnection(ConnectionFactory.jav a:38)
at
org.eclipse.datatools.connectivity.sqm.core.SQMConnectionFac tory.createConnection(SQMConnectionFactory.java:45)
at
org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionFactory.createConnection(ConnectionFactory.jav a:59)
at
org.eclipse.datatools.connectivity.internal.ConnectionFactor yAdapterProvider.createConnection(ConnectionFactoryAdapterPr ovider.java:114)
at
org.eclipse.datatools.connectivity.internal.ManagedConnectio n.createConnection(ManagedConnection.java:163)
at
org.eclipse.datatools.connectivity.internal.CreateConnection Job.run(CreateConnectionJob.java:56)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Re: Still can't create a connection [message #595056 is a reply to message #54264] Fri, 03 April 2009 22:10 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
Wow I really need to document this stuff on the Wiki...

That's an interesting bug. Basically the underlying code is looking for a
"org.eclipse.datatools.connectivity.sqm.core.catalog" extension with the
5.1.7 version I think you're providing as the version # for the profile.

The org.eclipse.datatools.enablement.mysql plug-in defines a catalog
element:

<extension
point="org.eclipse.datatools.connectivity.sqm.core.catalog" >
<catalog
product="MySql"
provider=" org.eclipse.datatools.enablement.mysql.catalog.MySqlCatalogP rovider "
version="5.1">
</catalog>
</extension>

If you're changing the driver/profile version from 5.1 to 5.1.7, you're
going to have to copy and change a couple of extensions... And I'm not sure
you can actually do it for the dbdefinition plug-in simply because it's
looking for the dbdefinition IN that plug-in, which will make it difficult
to override outside.

I'm guessing that if you change your version back to 5.1 you won't run into
an issue.

Can you let me know?
--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:7570df0c4625a511d2831067c0810323$1@www.eclipse.org...
> Yes, closer indeed, but still not at the finish line. Now it's complaining
> about the catalog. Here's the stack trace.
>
> -Mark
>
>
> java.lang.NullPointerException
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.util.Da tabaseProviderHelper.getCatalogDatabase(DatabaseProviderHelp er.java:37)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.util.Da tabaseProviderHelper.setDatabase(DatabaseProviderHelper.java :47)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionInfoImpl.initializeJDBCConnection(ConnectionIn foImpl.java:672)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionInfoImpl. <init>(ConnectionInfoImpl.java:644)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionFactory.createConnection(ConnectionFactory.jav a:38)
> at
> org.eclipse.datatools.connectivity.sqm.core.SQMConnectionFac tory.createConnection(SQMConnectionFactory.java:45)
> at
> org.eclipse.datatools.connectivity.sqm.internal.core.connect ion.ConnectionFactory.createConnection(ConnectionFactory.jav a:59)
> at
> org.eclipse.datatools.connectivity.internal.ConnectionFactor yAdapterProvider.createConnection(ConnectionFactoryAdapterPr ovider.java:114)
> at
> org.eclipse.datatools.connectivity.internal.ManagedConnectio n.createConnection(ManagedConnection.java:163)
> at
> org.eclipse.datatools.connectivity.internal.CreateConnection Job.run(CreateConnectionJob.java:56)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
>
Re: Still can't create a connection [message #595065 is a reply to message #54290] Fri, 03 April 2009 22:18 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
yes I understand what you're saying, except I don't know where I would be
setting the version to 5.1.7. It's true that the jar file name ends in
5.1.7, but I can't see anywhere else I'm setting the version number one
way or the other.

I did try setting the following properties on the driver before you told
me how to set the same ones on the profile, by getting them form the
driver instance in the profile.

driverProperties.setProperty(IJDBCConnectionProfileConstants .DATABASE_VENDOR_PROP_ID,
"MySQL");
driverProperties.setProperty(IJDBCDriverDefinitionConstants. DATABASE_VENDOR_PROP_ID,
"MySQL");
driverProperties.setProperty(IJDBCConnectionProfileConstants .DATABASE_VERSION_PROP_ID,
"5.1");
driverProperties.setProperty(IJDBCDriverDefinitionConstants. DATABASE_VERSION_PROP_ID,
"5.1");

I set them with two different constants classes because I wasn't sure
which one to use.

Here's the statement for creating my profile, in case that relates.

pfm.createProfile("MySQL", "MySQL JDBC Driver",
providerID, props);

providerID is set to

"org.eclipse.datatools.enablement.mysql.connectionProfile"

which is the only value I found to work, and it's the profile ID from the
enablement plug-in's plugin.xml.

-Mark
Re: Still can't create a connection [message #595074 is a reply to message #54317] Fri, 03 April 2009 22:20 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Just to clarify, I set those properties for vendor name and version again
after I added the statements for setting them on the profile properties,
and i still get the exception about the catalog.
Re: Still can't create a connection [message #595079 is a reply to message #54343] Fri, 03 April 2009 22:45 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Oops. silly error on my end. As yo may have noticed in my previous post,
when I set the vendor name property in the driver, I used MySQL instead of
MySql, which is how the extension point is defined in plugin.xml.

So now it's working and there are no exceptions. I appreciate your help
very much. I've been working on this off and on for a few weeks, and it's
great to have it working going into the weekend.

I do have one more question, however. I originally wanted to do this by
declaring the properties for the driver in my plugin.xml. That way I can
contribute one plug-in that would make the profile available to other
plug-ins without running the Java code that sets the properties.

It seemed straightforward how to do that using the driverTemplateOverride
extension point. I was providing overriden values for jarList, URL, and
database name, since the other driver properties were the same as that in
the template i was overriding. Then I provided username and password as
connection profile props. But I was getting the same NPE I was getting
before you showed me how to set those properties in Java.

I have a feeling the problem is with the jarList attribute for the
driverTemplateOverride element. Is there a way to specify in teh XML a
path relative to a plugin? For example, my plugin is called
com.mysql.jdbc, and I'd like to specify a jarList path that's relative to
that plug-in.

The example uses

[PLUGIN]\mydriver\driver.jar

I thought I could therefore use

com.mysql.jdbc\<relative path to the jar file>

Is that correct? If so, I can look elsewhere for the problem. Thanks again.

-Mark
Re: Still can't create a connection [message #595088 is a reply to message #54343] Fri, 03 April 2009 22:45 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
Can you trace into that
org.eclipse.datatools.connectivity.sqm.internal.core.util.Da tabaseProviderHelper.getCatalogDatabase(DatabaseProviderHelp er.java:37)
call?

I'm just wondering why it's not finding it based on the vendor/version.

Sorry I can't be more help today, I have to head off to soccer for my
youngest. I'll try to help more on Monday.

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:d35cb22fa146a1a829a16437cdc4b3f8$1@www.eclipse.org...
> Just to clarify, I set those properties for vendor name and version again
> after I added the statements for setting them on the profile properties,
> and i still get the exception about the catalog.
>
Re: Still can't create a connection [message #595102 is a reply to message #54397] Mon, 06 April 2009 12:57 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Brian Fitzpatrick wrote:
> Can you trace into that
> org.eclipse.datatools.connectivity.sqm.internal.core.util.Da tabaseProviderHelper.getCatalogDatabase(DatabaseProviderHelp er.java:37)
> call?
>
Fitz,

Looks like we posted at the same time. I managed to mis-spell MySQL,
i.e. I had the wrong capitalization vis a vis that used in the
enablement plug-in's XML file.

Thanks again for all your help Friday. I do have one additional question
in my previous post, regarding how I can make this work via plug-in XML
declarations exclusively vice Java code that runs via early startup.

-Mark
Re: Still can't create a connection [message #595111 is a reply to message #54370] Mon, 06 April 2009 13:25 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
Hey Mark!

That's great news. You don't know how often I get killed by typos. :)

As for specifying a plug-in wrapped driver jar, you can definitely do that
using the [PLUGIN ID]/relative path method...

So if your plug-in ID is "my.plugin.id", your jar path would look something
like "my.plugin.id/libs/myjar.jar". If you have issues with that particular
path, you can try flipping the slashes.

The other option is to provide a "Driver Values Provider class" like I do
with the SQLite and Derby drivers. This allows you to hunt in the
plug-in/bundle registry for your driver plug-in wrapper and find the jar
that way. You can find examples in
o.e.d.enablement.sqlite.driver.SQLiteDriverValuesProvider and
org.eclipse.datatools.connectivity.apache.internal.derby.dri ver.DerbyDriverValuesProvider101.

Glad you're getting all of this working. I hope to have time to document all
this stuff soon on the Wiki so it's much easier to find the next time
someone goes looking. :)

Thanks for your patience and like I said, don't hesitate to ask more
questions. We'll be here. :)

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:99fadedf8fd2c0129883bd127f5a3531$1@www.eclipse.org...
> Oops. silly error on my end. As yo may have noticed in my previous post,
> when I set the vendor name property in the driver, I used MySQL instead of
> MySql, which is how the extension point is defined in plugin.xml.
>
> So now it's working and there are no exceptions. I appreciate your help
> very much. I've been working on this off and on for a few weeks, and it's
> great to have it working going into the weekend.
>
> I do have one more question, however. I originally wanted to do this by
> declaring the properties for the driver in my plugin.xml. That way I can
> contribute one plug-in that would make the profile available to other
> plug-ins without running the Java code that sets the properties.
>
> It seemed straightforward how to do that using the driverTemplateOverride
> extension point. I was providing overriden values for jarList, URL, and
> database name, since the other driver properties were the same as that in
> the template i was overriding. Then I provided username and password as
> connection profile props. But I was getting the same NPE I was getting
> before you showed me how to set those properties in Java.
>
> I have a feeling the problem is with the jarList attribute for the
> driverTemplateOverride element. Is there a way to specify in teh XML a
> path relative to a plugin? For example, my plugin is called
> com.mysql.jdbc, and I'd like to specify a jarList path that's relative to
> that plug-in.
> The example uses
>
> [PLUGIN]\mydriver\driver.jar
>
> I thought I could therefore use
>
> com.mysql.jdbc\<relative path to the jar file>
>
> Is that correct? If so, I can look elsewhere for the problem. Thanks
> again.
>
> -Mark
>
>
Re: Still can't create a connection [message #595120 is a reply to message #54478] Mon, 06 April 2009 20:38 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Fitz,

Thanks for the additional instructions. I just completed a plug-in that
creates a profile bound to the MySQL driver, and with the desired profile
properties set. This runs via early startup, which is problematic because
there's no guarantee when execution will complete. For that reason I'm
looking for a way to declare entirely via XML in plugin.xml the desired
profile and driver characteristics, so other plug-ins can gab the profile
from the Profile Manager and establish connections with it.

I see the Profile definition in the enablement plug-in, and I'm able to
grab that profile via the Profile Manager. But there's no driver
associated with it, so if I call connect() on it, I get an NPE as I was
doing originally. So now I understand how to declare override properties
for the driver templates defined by the enablement plug-in, which I can
use to point to my driver. But I don't understand how I can associate the
driver that I override with the profile that is declared.

Is there a way I can make this association purely in XML, so that when I
grab the declared profile by name from the Profile Manager, I can call
connect() on the profile and the connection will be established via the
driver whose properties I overrode in plug-in.xml?

-Mark
Re: Still can't create a connection [message #595131 is a reply to message #54505] Mon, 06 April 2009 20:57 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
There is a way to do this, but I've not tried it...

You can use the
org.eclipse.datatools.connectivity.ProfileManagerInitializat ionProvider
extension point to, when the connectivity plug-in fires up, create a profile
with your specifications.

I believe BIRT uses this extension point to create their Derby sample
database at startup, but like I said, I haven't tried it.

See if that does what you're looking for though. If you need more help, I
can ask one of the other Connectivity folks who works on ODA & BIRT to help
out.

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:a58e4586cba49f1af7dfbf43347a9dc3$1@www.eclipse.org...
> Fitz,
>
> Thanks for the additional instructions. I just completed a plug-in that
> creates a profile bound to the MySQL driver, and with the desired profile
> properties set. This runs via early startup, which is problematic because
> there's no guarantee when execution will complete. For that reason I'm
> looking for a way to declare entirely via XML in plugin.xml the desired
> profile and driver characteristics, so other plug-ins can gab the profile
> from the Profile Manager and establish connections with it.
>
> I see the Profile definition in the enablement plug-in, and I'm able to
> grab that profile via the Profile Manager. But there's no driver
> associated with it, so if I call connect() on it, I get an NPE as I was
> doing originally. So now I understand how to declare override properties
> for the driver templates defined by the enablement plug-in, which I can
> use to point to my driver. But I don't understand how I can associate the
> driver that I override with the profile that is declared.
>
> Is there a way I can make this association purely in XML, so that when I
> grab the declared profile by name from the Profile Manager, I can call
> connect() on the profile and the connection will be established via the
> driver whose properties I overrode in plug-in.xml?
>
> -Mark
>
Re: Still can't create a connection [message #595139 is a reply to message #54533] Tue, 07 April 2009 14:34 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
That's helpful info, Fitz. Thanks for all your efforts.

The schema for ProfileManagerInitializationProvider is pretty
straightforward, and I created a plug-in providing an implementation of
that extension. I get an NPE when I grab the profile, which traces into
the DTP source code indicating that the template is null when retrieved by
ID.

I pasted my plugin.xml below. The driver template ID I used is the one
that appears in the enablement plugin.xml, and I made my plug-in dependent
on the enablement plug-in.

One question I have is how to implement the IExecutableExtension instance
referenced by the connectionInitializer attribute. I see during runtime
that the method on this class receives a Java representation of the
elements and attributes I declared for the
ProfileManagerInitializationProvider extension. I don't do anything with
these in the method implementation, because I'm assuming that DTP is
handling the task of creating the profile and driver definitions based on
my declarations. Indeed it seems the profile gets created, but not the
driver. Or maybe I need to do some initialization in the
ExecutableExtension, although I'm hoping that won't be necessary. I'm
trying to find the BIRT implementation you mentioned, and hopefully that
will shed some light.

Unless you happen to know the answer to my questions above, if you can
point someone else on the Connectivity team to my post as you offered, I'd
very much appreciate it.

-Mark

My plugin.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension

id=" com.tasc.swb.datatools.connctivity.mysql.profileManagerIniti alization "
name="XML Generated MySQL Connection Profile"

point=" org.eclipse.datatools.connectivity.ProfileManagerInitializat ionProvider ">
<connection

connectionInitializer=" com.tasc.swb.datatools.connectivity.mysql.declaredprofile.My SQLConnectionInitializer "

connectionProfileID=" com.tasc.swb.datatools.connectivity.mysql.declaredProfile.co nnection1 "

connectionProfileName=" com.tasc.swb.datatools.connectivity.mysql.declaredProfile.co nnection1 "

driverDefinitionName=" com.tasc.swb.datatools.connectivity.mysql.declaredProfile.co nnection1 "

driverTemplateID="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate "
jarList="com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar" >
<property
id="org.eclipse.datatools.connectivity.db.databaseName"
value="prophet_test_db">
</property>
<property
id="org.eclipse.datatools.connectivity.db.URL"
value="jdbc:mysql://localhost:3306/prophet_test_db">
</property>
<property
id="org.eclipse.datatools.connectivity.db.username"
value="root">
</property>
<property
id="org.eclipse.datatools.connectivity.db.password"
value="squerdiddle1!">
</property>
</connection>
</extension>
</plugin>
Re: Still can't create a connection [message #595161 is a reply to message #54569] Tue, 07 April 2009 22:57 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
In your driver template override, can you set createDefault = true and see
if that fixes the problem?

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:02778f8973f54e6b78dda8c187a0804c$1@www.eclipse.org...
> That's helpful info, Fitz. Thanks for all your efforts.
>
> The schema for ProfileManagerInitializationProvider is pretty
> straightforward, and I created a plug-in providing an implementation of
> that extension. I get an NPE when I grab the profile, which traces into
> the DTP source code indicating that the template is null when retrieved by
> ID.
>
> I pasted my plugin.xml below. The driver template ID I used is the one
> that appears in the enablement plugin.xml, and I made my plug-in dependent
> on the enablement plug-in.
>
> One question I have is how to implement the IExecutableExtension instance
> referenced by the connectionInitializer attribute. I see during runtime
> that the method on this class receives a Java representation of the
> elements and attributes I declared for the
> ProfileManagerInitializationProvider extension. I don't do anything with
> these in the method implementation, because I'm assuming that DTP is
> handling the task of creating the profile and driver definitions based on
> my declarations. Indeed it seems the profile gets created, but not the
> driver. Or maybe I need to do some initialization in the
> ExecutableExtension, although I'm hoping that won't be necessary. I'm
> trying to find the BIRT implementation you mentioned, and hopefully that
> will shed some light.
>
> Unless you happen to know the answer to my questions above, if you can
> point someone else on the Connectivity team to my post as you offered, I'd
> very much appreciate it.
>
> -Mark
>
> My plugin.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <?eclipse version="3.4"?>
> <plugin>
> <extension
>
> id=" com.tasc.swb.datatools.connctivity.mysql.profileManagerIniti alization "
> name="XML Generated MySQL Connection Profile"
>
> point=" org.eclipse.datatools.connectivity.ProfileManagerInitializat ionProvider ">
> <connection
>
> connectionInitializer=" com.tasc.swb.datatools.connectivity.mysql.declaredprofile.My SQLConnectionInitializer "
>
> connectionProfileID=" com.tasc.swb.datatools.connectivity.mysql.declaredProfile.co nnection1 "
>
> connectionProfileName=" com.tasc.swb.datatools.connectivity.mysql.declaredProfile.co nnection1 "
>
> driverDefinitionName=" com.tasc.swb.datatools.connectivity.mysql.declaredProfile.co nnection1 "
>
> driverTemplateID="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate "
> jarList="com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar" >
> <property
> id="org.eclipse.datatools.connectivity.db.databaseName"
> value="prophet_test_db">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.URL"
> value="jdbc:mysql://localhost:3306/prophet_test_db">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.username"
> value="root">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.password"
> value="squerdiddle1!">
> </property>
> </connection>
> </extension>
> </plugin>
>
>
Re: Still can't create a connection [message #595182 is a reply to message #54650] Wed, 08 April 2009 15:12 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Fitz,

I thought about the createDefault attribute, but I didn't see how to
override it. Since the ProfileManagerInitializationProvider extension has
property members in its Connection element which are defined as property
overrides for the driverTemplate, I assumed I didn't need a
driverExtension extension with a driverTemplateOverride.

But you seem to be saying I should be using a driverTemplateOverride, at
least to override the createDefault attribute. So I tried that, and it's
still not working, but maybe I'm not overriding properly. I tried it two
different ways, overriding the generic driver template and overriding a
template declared with a driverExtension in my plugin.xml (copied and
adapted from the enablement plug-in). In each case I used the ID of the
base template (the one being overriden) for the value of the
driverTemplateID attribute of the Connection element in the
ProfileManagerInitializationProvider extension. I assume this is correct
since the ID for the driverTemplateOverride element is an optional
attribute.

I've pasted below two versions of plugin.xml, showing both approaches
described above. In each case an NPE is thrown because the driver template
is null when retrieved by templateID. I also pasted the stack trace below
(the first lines of it, down to invocation by the Workbench.

plugin.xml overriding the generic template:

<plugin>
<extension

id=" com.tasc.swb.datatools.connctivity.mysql.profileManagerIniti alization "
name="XML Generated MySQL Connection Profile"

point=" org.eclipse.datatools.connectivity.ProfileManagerInitializat ionProvider ">
<connection

connectionInitializer=" com.tasc.swb.datatools.connectivity.mysql.declaredprofile.My SQLConnectionInitializer "
connectionProfileID="some.id"
connectionProfileName="MySQL2"
driverDefinitionName="MySQL JDBC Driver"

driverTemplateID="org.eclipse.datatools.connectivity.db.genericDriverTemplate "
jarList="com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar" >
<property
id="org.eclipse.datatools.connectivity.db.databaseName"
value="prophet_test_db">
</property>
<property
id="org.eclipse.datatools.connectivity.db.URL"
value="jdbc:mysql://localhost:3306/prophet_test_db">
</property>
<property
id="org.eclipse.datatools.connectivity.db.username"
value="root">
</property>
<property
id="org.eclipse.datatools.connectivity.db.password"
value="squerdiddle1!">
</property>
<property
id="org.eclipse.datatools.connectivity.drivers.defnType"

value=" org.eclipse.datatools.connectivity.db.generic.genericDriverT emplate ">
</property>
<property
id="org.eclipse.datatools.connectivity.db.driverClass"
value="com.mysql.jdbc.Driver">
</property>
<property
id="org.eclipse.datatools.connectivity.db.vendor"
value="MySql">
</property>
<property
id="org.eclipse.datatools.connectivity.db.version"
value="5.1">
</property>
</connection>
</extension>

<extension
point="org.eclipse.datatools.connectivity.driverExtension">

<driverTemplateOverride
createDefault="true"
jarList="com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar"
name="Override for Generic JDBC Driver"

targetId="org.eclipse.datatools.connectivity.db.genericDriverTemplate ">
<propertyOverrides>
<propertyOverride
value="prophet_test_db"

targetId="org.eclipse.datatools.connectivity.db.databaseName "/>
<propertyOverride
value="com.mysql.jdbc.Driver"

targetId="org.eclipse.datatools.connectivity.db.driverClass "/>
propertyOverride
value="jdbc:mysql://localhost:3306/prophet_test_db"
targetId="org.eclipse.datatools.connectivity.db.URL"/>
</propertyOverrides>
</driverTemplateOverride>
</extension>

</plugin>

plugin.xml overriding a declared template:

<plugin>
<extension

id=" com.tasc.swb.datatools.connctivity.mysql.profileManagerIniti alization "
name="XML Generated MySQL Connection Profile"

point=" org.eclipse.datatools.connectivity.ProfileManagerInitializat ionProvider ">
<connection

connectionInitializer=" com.tasc.swb.datatools.connectivity.mysql.declaredprofile.My SQLConnectionInitializer "
connectionProfileID="some.id"
connectionProfileName="MySQL2"
driverDefinitionName="MySQL JDBC Driver"

driverTemplateID="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate2 "
jarList="com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar" >
<property
id="org.eclipse.datatools.connectivity.db.databaseName"
value="prophet_test_db">
</property>
<property
id="org.eclipse.datatools.connectivity.db.URL"
value="jdbc:mysql://localhost:3306/prophet_test_db">
</property>
<property
id="org.eclipse.datatools.connectivity.db.username"
value="root">
</property>
<property
id="org.eclipse.datatools.connectivity.db.password"
value="squerdiddle1!">
</property>
<property
id="org.eclipse.datatools.connectivity.drivers.defnType"

value=" org.eclipse.datatools.connectivity.db.generic.genericDriverT emplate ">
</property>
<property
id="org.eclipse.datatools.connectivity.db.driverClass"
value="com.mysql.jdbc.Driver">
</property>
<property
id="org.eclipse.datatools.connectivity.db.vendor"
value="MySql">
</property>
<property
id="org.eclipse.datatools.connectivity.db.version"
value="5.1">
</property>
</connection>
</extension>

<extension
point="org.eclipse.datatools.connectivity.driverExtension">

<driverTemplate
createDefault="true"
emptyJarListIsOK="false"
id="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate2 "
jarList="com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar"
name="MySQL JDBC Driver Template"

parentCategory="org.eclipse.datatools.enablement.mysql.5_1.driverCategory ">
<properties>
<property
generated="false"
id="org.eclipse.datatools.connectivity.db.driverClass"
value="com.mysql.jdbc.Driver"
name="Driver Class"
required="true"
visible="true"/>
<property
generated="false"
id="org.eclipse.datatools.connectivity.db.vendor"
name="Vendor"
value="MySql"
required="true"
visible="false"/>
<property
generated="false"
id="org.eclipse.datatools.connectivity.db.version"
name="Version"
value="5.1"
required="true"
visible="false"/>
<property
generated="false"
id="org.eclipse.datatools.connectivity.db.databaseName"
name="Database Name"
value="prophet_test_db"
required="true"
visible="true"/>
<property
generated="false"
id="org.eclipse.datatools.connectivity.db.URL"
name="Connection URL"
value="jdbc:mysql://localhost:3306/prophet_test_db"
required="true"
visible="true"/>
<property
generated="false"
id="org.eclipse.datatools.connectivity.db.username"
name="User ID"
value="root"
required="false"
visible="true"/>
<property
generated="false"
id="org.eclipse.datatools.connectivity.db.password"
name="Password"
value="squerdiddle1!"
required="false"
visible="true"/>
</properties>
</driverTemplate>
</extension>

</plugin>

Stack trace:


java.lang.NullPointerException
at
org.eclipse.datatools.connectivity.drivers.DriverManager.get DriverInstancesFromMapForTemplateID(DriverManager.java:150)
at
org.eclipse.datatools.connectivity.drivers.DriverManager.get DriverInstancesByTemplate(DriverManager.java:189)
at
org.eclipse.datatools.connectivity.internal.InternalProfileM anager.getDriverInstance(InternalProfileManager.java:1328)
at
org.eclipse.datatools.connectivity.internal.InternalProfileM anager.enableLocalDatabase(InternalProfileManager.java:1252)
at
org.eclipse.datatools.connectivity.internal.InternalProfileM anager.loadLocalRegisteredDatabases(InternalProfileManager.j ava:1211)
at
org.eclipse.datatools.connectivity.internal.InternalProfileM anager.loadProfiles(InternalProfileManager.java:929)
at
org.eclipse.datatools.connectivity.internal.InternalProfileM anager.getProfiles(InternalProfileManager.java:140)
at
org.eclipse.datatools.connectivity.internal.InternalProfileM anager.getProfileByName(InternalProfileManager.java:215)
at
org.eclipse.datatools.connectivity.ProfileManager.getProfile ByName(ProfileManager.java:96)
at
com.tasc.swb.datatools.connectivity.testclient.views.TestCli entView.testJDBCConnection(TestClientView.java:96)
at
com.tasc.swb.datatools.connectivity.testclient.views.TestCli entView.access$0(TestClientView.java:86)
at
com.tasc.swb.datatools.connectivity.testclient.views.TestCli entView$ViewContentProvider.getElements(TestClientView.java: 43)
at
org.eclipse.jface.viewers.StructuredViewer.getRawChildren(St ructuredViewer.java:937)
at
org.eclipse.jface.viewers.ColumnViewer.getRawChildren(Column Viewer.java:703)
at
org.eclipse.jface.viewers.AbstractTableViewer.getRawChildren (AbstractTableViewer.java:1071)
at
org.eclipse.jface.viewers.StructuredViewer.getFilteredChildr en(StructuredViewer.java:871)
at
org.eclipse.jface.viewers.StructuredViewer.getSortedChildren (StructuredViewer.java:994)
at
org.eclipse.jface.viewers.AbstractTableViewer.internalRefres hAll(AbstractTableViewer.java:685)
at
org.eclipse.jface.viewers.AbstractTableViewer.internalRefres h(AbstractTableViewer.java:633)
at
org.eclipse.jface.viewers.AbstractTableViewer.internalRefres h(AbstractTableViewer.java:620)
at
org.eclipse.jface.viewers.AbstractTableViewer$2.run(Abstract TableViewer.java:576)
at
org.eclipse.jface.viewers.StructuredViewer.preservingSelecti on(StructuredViewer.java:1365)
at
org.eclipse.jface.viewers.StructuredViewer.preservingSelecti on(StructuredViewer.java:1328)
at
org.eclipse.jface.viewers.AbstractTableViewer.inputChanged(A bstractTableViewer.java:574)
at
org.eclipse.jface.viewers.ContentViewer.setInput(ContentView er.java:251)
at
org.eclipse.jface.viewers.StructuredViewer.setInput(Structur edViewer.java:1603)
at
com.tasc.swb.datatools.connectivity.testclient.views.TestCli entView.createPartControl(TestClientView.java:79)
at
org.eclipse.ui.internal.ViewReference.createPartHelper(ViewR eference.java:371)
at
org.eclipse.ui.internal.ViewReference.createPart(ViewReferen ce.java:230)
at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:594)
at org.eclipse.ui.internal.Perspective.showView(Perspective.jav a:2127)
at
org.eclipse.ui.internal.WorkbenchPage.busyShowView(Workbench Page.java:1062)
at org.eclipse.ui.internal.WorkbenchPage$19.run(WorkbenchPage.j ava:3773)

...
Re: Still can't create a connection [message #595192 is a reply to message #54702] Wed, 08 April 2009 17:12 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
I found the problem with the driver template. Stepping though with teh
debugger I saw that the NPE was actually occurring when DTP tried to load
a template using a key for a template that I defined previously for the
earlyStartup version of the plug-in. A co-worker then told me about the
need to clear my workspace in my run configuration, which I wasn't clued
into. Sorry about that, as I'm pretty new to eclipse plug-in development.
So I'm going to say this was a hardware error: a loose nut on the keyboard.

I also found that I need to have profile id and name to match an existing
declared profile (I used the one defined in the enablement plug-in),
otherwise the catyegory is unknown and it blows up when trying to
establish a connection. I pasted my plugin.xml below.

However... I still have a problem. I'm getting a ClassNotFoundException of
rhte driver class, com.mysql.jdbc.Driver. I added a dependency to a
plug-in that wraps the COnnector/J jar file and exports package
com.mysql.jdbc. But I think that's not what it's using to resolve the
classpath, right? I believe that's what the jarList attribute is for.

I'm using com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar because
com.mysql.jdbc is the name of the plug-in, and the jar file is in the root
directory of the plug-in. I also tried a backslash instead of the forward
slash. Any other ideas for specifying the jarList attribute?

Do you agree this is probably where my problem is?

My current plugin.xml

<plugin>
<extension

id=" com.tasc.swb.datatools.connctivity.mysql.profileManagerIniti alization "
name="XML Generated MySQL Connection Profile"

point=" org.eclipse.datatools.connectivity.ProfileManagerInitializat ionProvider ">
<connection

connectionInitializer=" com.tasc.swb.datatools.connectivity.mysql.declaredprofile.My SQLConnectionInitializer "

connectionProfileID="org.eclipse.datatools.enablement.mysql.connectionProfile "
connectionProfileName="MySQL"
driverDefinitionName="MySQL JDBC Driver"

driverTemplateID="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate "
jarList="com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar" >
<property
id="org.eclipse.datatools.connectivity.db.databaseName"
value="prophet_test_db">
</property>
<property
id="org.eclipse.datatools.connectivity.db.URL"
value="jdbc:mysql://localhost:3306/prophet_test_db">
</property>
<property
id="org.eclipse.datatools.connectivity.db.username"
value="root">
</property>
<property
id="org.eclipse.datatools.connectivity.db.password"
value="squerdiddle1!">
</property>
<property
id="org.eclipse.datatools.connectivity.drivers.defnType"

value=" org.eclipse.datatools.connectivity.db.generic.genericDriverT emplate ">
</property>
<property
id="org.eclipse.datatools.connectivity.db.driverClass"
value="com.mysql.jdbc.Driver">
</property>
<property
id="org.eclipse.datatools.connectivity.db.vendor"
value="MySql">
</property>
<property
id="org.eclipse.datatools.connectivity.db.version"
value="5.1">
</property>
</connection>
</extension>

</plugin>
Re: Still can't create a connection [message #595205 is a reply to message #54729] Wed, 08 April 2009 21:08 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
Hey Mark...

I think to be a programmer you have to be a little nuts anyway. :) So no
worries there.

As for the other bit, I'm going to take a look at this tomorrow to see if I
can figure out what's going on by recreating some of what you're doing here.
There has to be a reason that the createDefault isn't triggering a creation
of the driver when it ought to.

Unfortunately I'm knee-deep in another issue today. So I apologize for
pushing you off another day, but I hope you'll understand.

I'll get back to this first thing tomorrow.

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:ef84239000030b68d75bb07dc86349b8$1@www.eclipse.org...
>I found the problem with the driver template. Stepping though with teh
>debugger I saw that the NPE was actually occurring when DTP tried to load a
>template using a key for a template that I defined previously for the
>earlyStartup version of the plug-in. A co-worker then told me about the
>need to clear my workspace in my run configuration, which I wasn't clued
>into. Sorry about that, as I'm pretty new to eclipse plug-in development.
>So I'm going to say this was a hardware error: a loose nut on the keyboard.
>
> I also found that I need to have profile id and name to match an existing
> declared profile (I used the one defined in the enablement plug-in),
> otherwise the catyegory is unknown and it blows up when trying to
> establish a connection. I pasted my plugin.xml below.
>
> However... I still have a problem. I'm getting a ClassNotFoundException of
> rhte driver class, com.mysql.jdbc.Driver. I added a dependency to a
> plug-in that wraps the COnnector/J jar file and exports package
> com.mysql.jdbc. But I think that's not what it's using to resolve the
> classpath, right? I believe that's what the jarList attribute is for.
>
> I'm using com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar because
> com.mysql.jdbc is the name of the plug-in, and the jar file is in the root
> directory of the plug-in. I also tried a backslash instead of the forward
> slash. Any other ideas for specifying the jarList attribute?
>
> Do you agree this is probably where my problem is?
>
> My current plugin.xml
>
> <plugin>
> <extension
>
> id=" com.tasc.swb.datatools.connctivity.mysql.profileManagerIniti alization "
> name="XML Generated MySQL Connection Profile"
>
> point=" org.eclipse.datatools.connectivity.ProfileManagerInitializat ionProvider ">
> <connection
>
> connectionInitializer=" com.tasc.swb.datatools.connectivity.mysql.declaredprofile.My SQLConnectionInitializer "
>
> connectionProfileID="org.eclipse.datatools.enablement.mysql.connectionProfile "
> connectionProfileName="MySQL"
> driverDefinitionName="MySQL JDBC Driver"
>
> driverTemplateID="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate "
> jarList="com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar" >
> <property
> id="org.eclipse.datatools.connectivity.db.databaseName"
> value="prophet_test_db">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.URL"
> value="jdbc:mysql://localhost:3306/prophet_test_db">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.username"
> value="root">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.password"
> value="squerdiddle1!">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.drivers.defnType"
>
> value=" org.eclipse.datatools.connectivity.db.generic.genericDriverT emplate ">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.driverClass"
> value="com.mysql.jdbc.Driver">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.vendor"
> value="MySql">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.version"
> value="5.1">
> </property>
> </connection>
> </extension>
>
> </plugin>
>
Re: Still can't create a connection [message #595219 is a reply to message #54729] Wed, 08 April 2009 21:34 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
I'm sorry this thread is running so long, but I think I'm almost there. My
connection is working, but there are two issues remaining.

1. I found a workaround for the classpath problem, which is not acceptable
but confirms that the problem is in the way I'm setting the jarList
attribute. I entered the absolute file path on my development system as
the value for jarList, and it worked. So the value I used originally for
jarList (com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar) doesn't
resolve to path of the jar file in plugin com.mysql.jdbc, which is what I
need. Hopefully this is a basic thing I'm missing and someone can
enlighten me.

2. For some reason the password property is not being set on the profile.
I can get around this by specifying it as part of the URL, but I'd rather
not do that. After stepping through with the debugger, it looks like DTP
is dropping the password property. I print out the values of all the
properties set in the ProfileManagerInitializationProvider extension as
passed to my implementation of the class referenced by the
connectionInitializer attribute. AT that point, all the properties are
set, including password. Then using the debugger I looked at
org.eclipse.datatools.connectivity.internal.ManagedConnectio n during
runtime.

Just before createConnection() returns (line 178), I inspect the profile
(mProfile is the variable name). By traversing the heirarchical set of
property entries inside mPropertiesMap, I find all the properties set
except for password. There is no entry for password, not an entry with a
null value. And downstream when the connection is created from the
profile, it is made with no password, resulting in a SQLException.

I'm setting the password property just the same as I set the user
property, so I'm not sure what's going on. Is there a reason the password
property would not be passed on? Or is this a bug in the DTP code?

Repeating from my previous post, here's how I set the password and user
properties in plugin.xml:


<connection

connectionInitializer=" com.tasc.swb.datatools.connectivity.mysql.declaredprofile.My SQLConnectionInitializer "

connectionProfileID="org.eclipse.datatools.enablement.mysql.connectionProfile "
connectionProfileName="MySqlJdbcConnectionProfile"
driverDefinitionName="MySQL JDBC Driver"

driverTemplateID="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate "
jarList="C:\Documents and Settings\leonema\My
Documents\Eclipse NG\com.mysql.jdbc\mysql-connector-java-5.1.7-bin.jar">
<!--
jarList="Plugin:com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar "> -->
<property
id="org.eclipse.datatools.connectivity.db.databaseName"
value="prophet_test_db">
</property>
<property
id="org.eclipse.datatools.connectivity.db.URL"
value="jdbc:mysql://localhost:3306">
</property>
<property
id="org.eclipse.datatools.connectivity.db.username"
value="root">
</property>
<property
id="org.eclipse.datatools.connectivity.db.password"
value="squerdiddle1!">
</property>

...
Re: Still can't create a connection [message #595236 is a reply to message #54756] Wed, 08 April 2009 21:40 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Fitz,

No worries at all. You've been super with all the help you've given. Once
again our messages crossed in the mail, so please look at my post just
before this one. There's no longer an issue with creating the driver, and
I have it working with two workarounds that I'd like to not have to use.
One is probably a simple matter that someone can clear up, and the other
seems to be a bit thornier, based on running through some DTP code with
the debugger. Have a great evening.

-Mark
Re: Still can't create a connection [message #595284 is a reply to message #54783] Thu, 09 April 2009 14:05 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
Hey Mark...

No worries. I'm just glad we're making progress. :)

For 1, can you try simply putting the plug-in id in square brackets?
[com.mysql.jdbc]. I think that's the trick there. So it would be
"[com.mysql.jdbc]/mysql-connector-java-5.1.7-bin.jar".

For 2, there is a "save password" property you would need to set on the
profile properties when you create it initially... Let me find that...
IJDBCConnectionProfileConstants.SAVE_PASSWORD_PROP_ID

Set that to true and it should persist the password for you. It's just
another property to set on the properties set for the connection profile. We
default to not saving it because of the security concerns, but the profile
store is encrypted so you should be ok.

Let me know if that helps. :)

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:7e9d71d9f5fa97902aa8f1ca6a680311$1@www.eclipse.org...
> I'm sorry this thread is running so long, but I think I'm almost there. My
> connection is working, but there are two issues remaining.
>
> 1. I found a workaround for the classpath problem, which is not acceptable
> but confirms that the problem is in the way I'm setting the jarList
> attribute. I entered the absolute file path on my development system as
> the value for jarList, and it worked. So the value I used originally for
> jarList (com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar) doesn't
> resolve to path of the jar file in plugin com.mysql.jdbc, which is what I
> need. Hopefully this is a basic thing I'm missing and someone can
> enlighten me.
>
> 2. For some reason the password property is not being set on the profile.
> I can get around this by specifying it as part of the URL, but I'd rather
> not do that. After stepping through with the debugger, it looks like DTP
> is dropping the password property. I print out the values of all the
> properties set in the ProfileManagerInitializationProvider extension as
> passed to my implementation of the class referenced by the
> connectionInitializer attribute. AT that point, all the properties are
> set, including password. Then using the debugger I looked at
> org.eclipse.datatools.connectivity.internal.ManagedConnectio n during
> runtime.
>
> Just before createConnection() returns (line 178), I inspect the profile
> (mProfile is the variable name). By traversing the heirarchical set of
> property entries inside mPropertiesMap, I find all the properties set
> except for password. There is no entry for password, not an entry with a
> null value. And downstream when the connection is created from the
> profile, it is made with no password, resulting in a SQLException.
>
> I'm setting the password property just the same as I set the user
> property, so I'm not sure what's going on. Is there a reason the password
> property would not be passed on? Or is this a bug in the DTP code?
>
> Repeating from my previous post, here's how I set the password and user
> properties in plugin.xml:
>
>
> <connection
>
> connectionInitializer=" com.tasc.swb.datatools.connectivity.mysql.declaredprofile.My SQLConnectionInitializer "
>
> connectionProfileID="org.eclipse.datatools.enablement.mysql.connectionProfile "
> connectionProfileName="MySqlJdbcConnectionProfile"
> driverDefinitionName="MySQL JDBC Driver"
>
> driverTemplateID="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate "
> jarList="C:\Documents and Settings\leonema\My Documents\Eclipse
> NG\com.mysql.jdbc\mysql-connector-java-5.1.7-bin.jar">
> <!--
> jarList="Plugin:com.mysql.jdbc/mysql-connector-java-5.1.7-bin.jar "> -->
> <property
> id="org.eclipse.datatools.connectivity.db.databaseName"
> value="prophet_test_db">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.URL"
> value="jdbc:mysql://localhost:3306">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.username"
> value="root">
> </property>
> <property
> id="org.eclipse.datatools.connectivity.db.password"
> value="squerdiddle1!">
> </property>
>
> ..
>
>
Re: Still can't create a connection [message #595294 is a reply to message #54944] Thu, 09 April 2009 15:18 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Thanks, Fitz. I'll give those both a try. I have one quick question about
#2 however:

When you say to set the property

IJDBCConnectionProfileConstants.SAVE_PASSWORD_PROP_ID

It looks like that's a property I should use in the Java code. Is there an
equivalent property I can set in the XML via the
ProfileManagerInitializationProvider extension?
Re: Still can't create a connection [message #595299 is a reply to message #54944] Thu, 09 April 2009 15:28 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Fitz,

I tried

jarList="[com.mysql.jdbc]/mysql-connector-java-5.1.7-bin.jar "

and I'm still getting ClassNotFoundException for the driver class. If I
set jarList tot he absolute path of the jar file, it works fine. I also
tried a backslash after the plugin designator, with the same result. Do
you have any other ideas, or how I can investigate the class loading
problem?

FWIW here's the stack trace:


java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java :592)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at
org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnecti on.createConnection(JDBCConnection.java:88)
at
org.eclipse.datatools.connectivity.DriverConnectionBase.inte rnalCreateConnection(DriverConnectionBase.java:104)
at
org.eclipse.datatools.connectivity.DriverConnectionBase.open (DriverConnectionBase.java:53)
at
org.eclipse.datatools.enablement.internal.mysql.connection.J DBCMySQLConnectionFactory.createConnection(JDBCMySQLConnecti onFactory.java:28)
at
org.eclipse.datatools.connectivity.internal.ConnectionFactor yProvider.createConnection(ConnectionFactoryProvider.java:83 )
at
org.eclipse.datatools.connectivity.internal.ConnectionProfil e.createConnection(ConnectionProfile.java:355)
at
org.eclipse.datatools.connectivity.internal.ManagedConnectio n.createConnection(ManagedConnection.java:166)
at
org.eclipse.datatools.connectivity.internal.CreateConnection Job.run(CreateConnectionJob.java:56)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Re: Still can't create a connection [message #595310 is a reply to message #54995] Thu, 09 April 2009 19:42 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
Ok. I'm close to having this working locally.

Can you paste in the (I'm guessing minimal) code for your initializer class?

I'm just trying to get as close to what you're doing as I can. I was able to
create a default driver definition with this:
<extension

point="org.eclipse.datatools.connectivity.driverExtension">

<driverTemplateOverride

createDefault="true"

jarList="[com.mysql.jdbc]/mysql-connector-java-5.1.5-bin.jar "

priority="4"

targetId="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate ">

</driverTemplateOverride>

</extension>

So now I'm just trying to figure out the initialization part.

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:44a7a5cb5c0662470861917ffb79ca08$1@www.eclipse.org...
> Fitz,
>
> I tried
>
> jarList="[com.mysql.jdbc]/mysql-connector-java-5.1.7-bin.jar "
>
> and I'm still getting ClassNotFoundException for the driver class. If I
> set jarList tot he absolute path of the jar file, it works fine. I also
> tried a backslash after the plugin designator, with the same result. Do
> you have any other ideas, or how I can investigate the class loading
> problem?
>
> FWIW here's the stack trace:
>
>
> java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
> at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java :592)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
> at
> org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnecti on.createConnection(JDBCConnection.java:88)
> at
> org.eclipse.datatools.connectivity.DriverConnectionBase.inte rnalCreateConnection(DriverConnectionBase.java:104)
> at
> org.eclipse.datatools.connectivity.DriverConnectionBase.open (DriverConnectionBase.java:53)
> at
> org.eclipse.datatools.enablement.internal.mysql.connection.J DBCMySQLConnectionFactory.createConnection(JDBCMySQLConnecti onFactory.java:28)
> at
> org.eclipse.datatools.connectivity.internal.ConnectionFactor yProvider.createConnection(ConnectionFactoryProvider.java:83 )
> at
> org.eclipse.datatools.connectivity.internal.ConnectionProfil e.createConnection(ConnectionProfile.java:355)
> at
> org.eclipse.datatools.connectivity.internal.ManagedConnectio n.createConnection(ManagedConnection.java:166)
> at
> org.eclipse.datatools.connectivity.internal.CreateConnection Job.run(CreateConnectionJob.java:56)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
>
>
Re: Still can't create a connection [message #595320 is a reply to message #55022] Fri, 10 April 2009 00:50 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Fitz,

Thanks for trying on your end. Sorry I didn't get back to you earlier, as
I was doing some re-factoring that consumed me for most of the day.

I think it may be that the format you gave me for jarList works in the
drivertemplate but not in the ProfileManagerInitializationProvider. Below
is my plugin.xml. When I run it as-is, I get a ClasSNotFoundException
looking for teh driver class. When I use the jarList assignment that is
commented out, it works fine. I never tried this with DriverExtension,
only with ProfileManagerInitializationProvider.

I'm getting around this OK because of the way I've re-factored, in which
I;ve combined the XML and Java versions I did over the last several days.
Now I listen for DTP to send me the ConfigurationElement, using the class
specified as the connectionInitializer attribute. That class just calls a
configurator that grabs the driver properties out of the
ConfigurationElement and defiens a driver with them programmatically the
way you showed me last week. Then the configurator grabs profile
properties from a file where they're set by an admin user, and it creates
the profile programmatically, again with the code you gave me, and also
assigns the driver name and driver ID that came out of the
COnfigurationElement.

This way I have my driver properties hard-coded in the XML, and the
profile properties are set via a properties file. Since I'm doing it this
way, I go ahead and set the jarFile property by using Java to get the
plugin-relative location of the jar file. This works, vice the XML version
which causes a ClassNotFoundException. The Java code I use is

final File file = new
File(FileLocator.getBundleFile(Platform.getBundle("com.mysql.jdbc ")),
"mysql-connector-java-5.1.7-bin.jar");

I also set the password persistence property on the profile per your
earlier message, and now the connection works fine. It would be nice to
solve the jarList issue since it's supposed to work, but it's nto gating
me.

The last reamaining question I have is how the Data Source Explorer could
be used in conjunction with the profile I set up as described above. I see
the profile, but the only properties I can edit are name and description,
not password or user ID, etc. Also after I launch the DSE view, all my
connections fail until I restart the app. I don't have to do anything in
the DSE; just by showing the view I kill the ability to connect on the
profile I defined.

-Mark
Re: Still can't create a connection [message #595331 is a reply to message #55049] Fri, 10 April 2009 00:51 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Forgot to attach plugin.xml

plugin>
<extension

id=" com.tasc.swb.datatools.connctivity.mysql.profileManagerIniti alization "
name="XML Generated MySQL Connection Profile"

point=" org.eclipse.datatools.connectivity.ProfileManagerInitializat ionProvider ">
<connection

connectionInitializer=" com.tasc.swb.datatools.connectivity.mysql.ConfigurationEleme ntInitializer "

connectionProfileID="org.eclipse.datatools.enablement.mysql.connectionProfile "
connectionProfileName="MySqlJdbcConnectionProfile"
driverDefinitionName="Prophet MySQL JDBC Driver"

driverTemplateID="org.eclipse.datatools.enablement.mysql.5_1.driverTemplate "
jarList="[com.mysql.jdbc]/mysql-connector-java-5.1.7-bin.jar ">
<!-- jarList="C:\Documents and Settings\leonema\My
Documents\Eclipse NG\com.mysql.jdbc\mysql-connector-java-5.1.7-bin.jar" -->
<property
id="org.eclipse.datatools.connectivity.db.driverClass"
value="com.mysql.jdbc.Driver">
</property>
<property
id="org.eclipse.datatools.connectivity.db.vendor"
value="MySql">
</property>
<property
id="org.eclipse.datatools.connectivity.db.version"
value="5.1">
</property>
</connection>
</extension>
</plugin>
Re: Still can't create a connection [message #595345 is a reply to message #55049] Fri, 10 April 2009 13:16 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
Very odd. I know it works on the override provider side, so I don't know
what's going on.

If you're using the profile provider ID that goes with MySQL for your
profile, you should be able to edit the profile in the DSE.

But I'm not all that familiar with what the profile manager initialization
code is doing under the covers. Let me see if one of the other DTP folks can
help you out with that part.

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:f5a999ec0feda8c269138991584f9ec2$1@www.eclipse.org...
> Fitz,
>
> Thanks for trying on your end. Sorry I didn't get back to you earlier, as
> I was doing some re-factoring that consumed me for most of the day.
>
> I think it may be that the format you gave me for jarList works in the
> drivertemplate but not in the ProfileManagerInitializationProvider. Below
> is my plugin.xml. When I run it as-is, I get a ClasSNotFoundException
> looking for teh driver class. When I use the jarList assignment that is
> commented out, it works fine. I never tried this with DriverExtension,
> only with ProfileManagerInitializationProvider.
>
> I'm getting around this OK because of the way I've re-factored, in which
> I;ve combined the XML and Java versions I did over the last several days.
> Now I listen for DTP to send me the ConfigurationElement, using the class
> specified as the connectionInitializer attribute. That class just calls a
> configurator that grabs the driver properties out of the
> ConfigurationElement and defiens a driver with them programmatically the
> way you showed me last week. Then the configurator grabs profile
> properties from a file where they're set by an admin user, and it creates
> the profile programmatically, again with the code you gave me, and also
> assigns the driver name and driver ID that came out of the
> COnfigurationElement.
>
> This way I have my driver properties hard-coded in the XML, and the
> profile properties are set via a properties file. Since I'm doing it this
> way, I go ahead and set the jarFile property by using Java to get the
> plugin-relative location of the jar file. This works, vice the XML version
> which causes a ClassNotFoundException. The Java code I use is
>
> final File file = new
> File(FileLocator.getBundleFile(Platform.getBundle("com.mysql.jdbc ")),
> "mysql-connector-java-5.1.7-bin.jar");
>
> I also set the password persistence property on the profile per your
> earlier message, and now the connection works fine. It would be nice to
> solve the jarList issue since it's supposed to work, but it's nto gating
> me.
>
> The last reamaining question I have is how the Data Source Explorer could
> be used in conjunction with the profile I set up as described above. I see
> the profile, but the only properties I can edit are name and description,
> not password or user ID, etc. Also after I launch the DSE view, all my
> connections fail until I restart the app. I don't have to do anything in
> the DSE; just by showing the view I kill the ability to connect on the
> profile I defined.
>
> -Mark
>
Re: Still can't create a connection [message #595352 is a reply to message #55102] Fri, 10 April 2009 14:45 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Fitz, thanks for passing on the question about DSE interaction.

Can you help me verify I'm using the right provider ID? The only thing I
found that enables the profile to provide a working connection is

org.eclipse.datatools.enablement.mysql.connectionProfile

I got this from the MySQL enablement plugin.xml, as the id of the declared
connectionProfle. I pass it as the providerID parameter when I call
ProfileManager.createProfile(). Can you point me to somewhere else for the
provider ID value if this isn't correct?

Thanks.

-Mark
Re: Still can't create a connection [message #595360 is a reply to message #55129] Fri, 10 April 2009 15:51 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
That provider ID should be correct if you got it from the connection profile
extension. So that's probably not it.

Not sure what the deal is. I've asked Linda to chime in to see if she can
figure out what's going on.

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:94ed6745c1da894f26309770a32e742c$1@www.eclipse.org...
> Fitz, thanks for passing on the question about DSE interaction.
>
> Can you help me verify I'm using the right provider ID? The only thing I
> found that enables the profile to provide a working connection is
>
> org.eclipse.datatools.enablement.mysql.connectionProfile
>
> I got this from the MySQL enablement plugin.xml, as the id of the declared
> connectionProfle. I pass it as the providerID parameter when I call
> ProfileManager.createProfile(). Can you point me to somewhere else for the
> provider ID value if this isn't correct?
>
> Thanks.
>
> -Mark
>
Re: Still can't create a connection [message #595369 is a reply to message #55156] Mon, 13 April 2009 14:23 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Fitz,

I worked on this over the weekend, and it's working well now with just two
DSE issues that seem to be unrelated to what I've coded; hopefully just a
config issue on my end.

First, a quick summary of what changed over the weekend.

1. Issue with the DSE and profile connection not working together is
fixed; it was a bug with my test client.

2. I re-factored once more. With my team's decision last week to decouple
the driver and profile properties, ProfileManagerInitializationProvider
extension is no longer needed. Now I have no extensions declared for the
plug-in that provides connectivity. I programmatically define the driver
and setup the profile, with the code you showed me earlier in the thread,
getting the profile property settings from a file in the config directory.
To get around the startup timing issue when we used earlyStartup with this
approach, I activate my connectivity plug-in from the RCP app as the
platform is coming up.

Now everything works as desired except the following with the DSE.

1. As mentioned previously, when I edit the connection properties from the
DSE entry for the profile, I only see the name and description, not the
properties I set on the profile programmatically.

2. I don't see child entries for the profile that enable me to view and
edit the tables.

This is referring to when I launch an eclipse app with my plug-ins. When I
look at the DSE in the IDE, I see an entry below the connection that
enables me to view and edit the tables, schemas, etc. I'd like to have
this same capability in the DSE when I launch my app.

I thought I might be missing a DTP plug-in in my target environment, but I
added every one that seemed even remotely applicable, and I still don't
have the missing capability. Can you think of a plug-in or plug-ins I
should check for? Or perhaps there's another property I need to set on my
profile?

Below is the code I'm using to define the driver and configure and create
the profile. The property values are not evident in the snippet, but you
can see what properties I'm setting.

public void provideConnectivity() {
final Properties profileProps = new ConnectionProfileProperties();//
defineDriver(driverId, driverName);
createProfile(driverId, profileProps);
}

private void defineDriver(final String driverId, final String driverName) {
final String profileGenericJDBCDriverTemplateID =
" org.eclipse.datatools.connectivity.db.generic.genericDriverT emplate ";
final IPropertySet propSet = new PropertySetImpl(driverName, driverId);
final Properties driverProperties = new Properties();
driverProperties.setProperty(IJDBCDriverDefinitionConstants. DRIVER_CLASS_PROP_ID,
"com.mysql.jdbc.Driver");
driverProperties.setProperty(IDriverMgmtConstants.PROP_DEFN_ JARLIST,
getJarList());
driverProperties.setProperty(IDriverMgmtConstants.PROP_DEFN_ TYPE,
profileGenericJDBCDriverTemplateID);
driverProperties.setProperty(IJDBCDriverDefinitionConstants. DATABASE_VENDOR_PROP_ID,
"MySql");
driverProperties.setProperty(IJDBCDriverDefinitionConstants. DATABASE_VERSION_PROP_ID,
"5.1");
propSet.setBaseProperties(driverProperties);
DriverManager.getInstance().addDriverInstance(propSet);
}

private void createProfile(final String driverID, final Properties
profileProps) {
final String driverURL = "jdbc:mysql://" + profileProps.getProperty(
ProphetConnectionProfileConstants.PROP_DB_HOST_NAME) + ":"
+
profileProps.getProperty(ProphetConnectionProfileConstants.P ROP_DB_PORT) +
"/testdb";

connectionProfileName =
profileProps.getProperty(ProphetConnectionProfileConstants.P ROP_PROFILE_NAME);

final Properties props = new Properties();
props.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEF INITION_ID,
driverID);
props.setProperty(IJDBCDriverDefinitionConstants.PASSWORD_PR OP_ID,
profileProps.getProperty(ProphetConnectionProfileConstants.P ROP_PASSWORD));
props.setProperty(IJDBCDriverDefinitionConstants.USERNAME_PR OP_ID,
profileProps.getProperty(ProphetConnectionProfileConstants.P ROP_USER_ID));
props.setProperty(IJDBCDriverDefinitionConstants.URL_PROP_ID , driverURL);
//DTP will not persist the password if this property is not set
props.setProperty(IJDBCConnectionProfileConstants.SAVE_PASSW ORD_PROP_ID,
"true");
props.setProperty(IJDBCConnectionProfileConstants.DATABASE_N AME_PROP_ID,
"testdb");
props.setProperty(IJDBCDriverDefinitionConstants.DATABASE_VE NDOR_PROP_ID,
DriverManager.
getInstance().getDriverInstanceByID(driverID)

getNamedPropertyByID(IJDBCDriverDefinitionConstants.DATABASE _VENDOR_PROP_ID));
props.setProperty(IJDBCDriverDefinitionConstants.DATABASE_VE RSION_PROP_ID,
DriverManager.
getInstance().getDriverInstanceByID(driverID)

getNamedPropertyByID(IJDBCDriverDefinitionConstants.DATABASE _VERSION_PROP_ID));
ProfileManager pfm = null;
try {
pfm = ProfileManager.getInstance();
} catch (final Exception e) {
DatatoolsMySqlConnectivityPlugin.logError("Unable to insantiate the
Connection Profile Manager", e);
return;
}

if (pfm.getProfileByName(this.connectionProfileName) == null) {
createNewProfile(props);
} else {
modifyProfileProperties(props);
}
}

private void createNewProfile(final Properties props) {

ProfileManager pfm = null;
try {
pfm = ProfileManager.getInstance();
} catch (final Exception e) {
DatatoolsMySqlConnectivityPlugin.logError("Unable to insantiate the
Connection Profile Manager", e);
return;
}

try {
pfm.createProfile(this.connectionProfileName,
"Default connection profile for accessing the MySQL database",
this.providerID, props);
} catch (final ConnectionProfileException e) {
DatatoolsMySqlConnectivityPlugin.logError("Unable to create the
connection profile", e);
}
}
Re: Still can't create a connection [message #595384 is a reply to message #55182] Mon, 13 April 2009 17:18 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
Hey Mark...

Glad you're a bit futher along...

Couple of questions... The driver template ID you're providing in the
DefineDriver routine... Instead of using
" org.eclipse.datatools.connectivity.db.generic.genericDriverT emplate ", can
you try using "org.eclipse.datatools.enablement.mysql.5_1.driverTemplate".

I also don't think you need to set these properties for the driver:

> driverProperties.setProperty(IDriverMgmtConstants.PROP_DEFN_ TYPE,
> profileGenericJDBCDriverTemplateID);
> driverProperties.setProperty(IJDBCDriverDefinitionConstants. DATABASE_VENDOR_PROP_ID,
> "MySql");
> driverProperties.setProperty(IJDBCDriverDefinitionConstants. DATABASE_VERSION_PROP_ID,
> "5.1");

When you say that you can't edit anything more than the name/description,
are you seeing a property page called something like "JDBC Connection
Properties"? There should be more than one property page associated with
your profile.

If we can get the first part resolved, the catalog loader should be
satisfied as well, which should satisify your tree population issues.

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:2b36aedb74d3a857293328f26715a1ba$1@www.eclipse.org...
> Fitz,
>
> I worked on this over the weekend, and it's working well now with just two
> DSE issues that seem to be unrelated to what I've coded; hopefully just a
> config issue on my end.
>
> First, a quick summary of what changed over the weekend.
>
> 1. Issue with the DSE and profile connection not working together is
> fixed; it was a bug with my test client.
>
> 2. I re-factored once more. With my team's decision last week to decouple
> the driver and profile properties, ProfileManagerInitializationProvider
> extension is no longer needed. Now I have no extensions declared for the
> plug-in that provides connectivity. I programmatically define the driver
> and setup the profile, with the code you showed me earlier in the thread,
> getting the profile property settings from a file in the config directory.
> To get around the startup timing issue when we used earlyStartup with this
> approach, I activate my connectivity plug-in from the RCP app as the
> platform is coming up.
>
> Now everything works as desired except the following with the DSE.
>
> 1. As mentioned previously, when I edit the connection properties from the
> DSE entry for the profile, I only see the name and description, not the
> properties I set on the profile programmatically.
>
> 2. I don't see child entries for the profile that enable me to view and
> edit the tables.
>
> This is referring to when I launch an eclipse app with my plug-ins. When I
> look at the DSE in the IDE, I see an entry below the connection that
> enables me to view and edit the tables, schemas, etc. I'd like to have
> this same capability in the DSE when I launch my app.
>
> I thought I might be missing a DTP plug-in in my target environment, but I
> added every one that seemed even remotely applicable, and I still don't
> have the missing capability. Can you think of a plug-in or plug-ins I
> should check for? Or perhaps there's another property I need to set on my
> profile?
>
> Below is the code I'm using to define the driver and configure and create
> the profile. The property values are not evident in the snippet, but you
> can see what properties I'm setting.
>
> public void provideConnectivity() {
> final Properties profileProps = new ConnectionProfileProperties();//
> defineDriver(driverId, driverName);
> createProfile(driverId, profileProps);
> }
>
> private void defineDriver(final String driverId, final String driverName)
> {
> final String profileGenericJDBCDriverTemplateID =
> " org.eclipse.datatools.connectivity.db.generic.genericDriverT emplate ";
> final IPropertySet propSet = new PropertySetImpl(driverName, driverId);
> final Properties driverProperties = new Properties();
> driverProperties.setProperty(IJDBCDriverDefinitionConstants. DRIVER_CLASS_PROP_ID,
> "com.mysql.jdbc.Driver");
> driverProperties.setProperty(IDriverMgmtConstants.PROP_DEFN_ JARLIST,
> getJarList());
> driverProperties.setProperty(IDriverMgmtConstants.PROP_DEFN_ TYPE,
> profileGenericJDBCDriverTemplateID);
> driverProperties.setProperty(IJDBCDriverDefinitionConstants. DATABASE_VENDOR_PROP_ID,
> "MySql");
> driverProperties.setProperty(IJDBCDriverDefinitionConstants. DATABASE_VERSION_PROP_ID,
> "5.1");
> propSet.setBaseProperties(driverProperties);
> DriverManager.getInstance().addDriverInstance(propSet);
> }
>
> private void createProfile(final String driverID, final Properties
> profileProps) {
> final String driverURL = "jdbc:mysql://" + profileProps.getProperty(
> ProphetConnectionProfileConstants.PROP_DB_HOST_NAME) + ":"
> +
> profileProps.getProperty(ProphetConnectionProfileConstants.P ROP_DB_PORT) +
> "/testdb";
>
> connectionProfileName =
> profileProps.getProperty(ProphetConnectionProfileConstants.P ROP_PROFILE_NAME);
>
> final Properties props = new Properties();
> props.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEF INITION_ID,
> driverID);
> props.setProperty(IJDBCDriverDefinitionConstants.PASSWORD_PR OP_ID,
> profileProps.getProperty(ProphetConnectionProfileConstants.P ROP_PASSWORD));
> props.setProperty(IJDBCDriverDefinitionConstants.USERNAME_PR OP_ID,
> profileProps.getProperty(ProphetConnectionProfileConstants.P ROP_USER_ID));
> props.setProperty(IJDBCDriverDefinitionConstants.URL_PROP_ID , driverURL);
> //DTP will not persist the password if this property is not set
> props.setProperty(IJDBCConnectionProfileConstants.SAVE_PASSW ORD_PROP_ID,
> "true");
> props.setProperty(IJDBCConnectionProfileConstants.DATABASE_N AME_PROP_ID,
> "testdb");
> props.setProperty(IJDBCDriverDefinitionConstants.DATABASE_VE NDOR_PROP_ID,
> DriverManager.
> getInstance().getDriverInstanceByID(driverID)
>
> getNamedPropertyByID(IJDBCDriverDefinitionConstants.DATABASE _VENDOR_PROP_ID));
> props.setProperty(IJDBCDriverDefinitionConstants.DATABASE_VE RSION_PROP_ID,
> DriverManager.
> getInstance().getDriverInstanceByID(driverID)
>
> getNamedPropertyByID(IJDBCDriverDefinitionConstants.DATABASE _VERSION_PROP_ID));
> ProfileManager pfm = null;
> try {
> pfm = ProfileManager.getInstance();
> } catch (final Exception e) {
> DatatoolsMySqlConnectivityPlugin.logError("Unable to insantiate the
> Connection Profile Manager", e);
> return;
> }
>
> if (pfm.getProfileByName(this.connectionProfileName) == null) {
> createNewProfile(props);
> } else {
> modifyProfileProperties(props);
> }
> }
>
> private void createNewProfile(final Properties props) {
>
> ProfileManager pfm = null;
> try {
> pfm = ProfileManager.getInstance();
> } catch (final Exception e) {
> DatatoolsMySqlConnectivityPlugin.logError("Unable to insantiate the
> Connection Profile Manager", e);
> return;
> }
>
> try {
> pfm.createProfile(this.connectionProfileName, "Default connection profile
> for accessing the MySQL database", this.providerID, props);
> } catch (final ConnectionProfileException e) {
> DatatoolsMySqlConnectivityPlugin.logError("Unable to create the connection
> profile", e);
> }
> }
>
>
Re: Still can't create a connection [message #595391 is a reply to message #55209] Mon, 13 April 2009 18:29 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Thanks Fitz.

The value of driverID was already set to
org.eclipse.datatools.enablement.mysql.5_1.driverTemplate via an instance
variable assignment I didn't include in the snippet I posted. But I
changed the value of property IDriverMgmtConstants.PROP_DEFN_TYPE to be
the same value as driverID, and I took out the lines that set the values
of the vendor and version properties. If I don't set PROP_DEFN_TYPE to
reference the MySQL enablement template, everything works OK, I think, but
when I look at the driver in the Preference page it doesn't show the
vendor and version values.

With the above changes, I still have the two problems I mentioned earlier
when I launch my eclipse application. When I open the DSE view, I see a
top level entry "Database Connections" and below that is
"MySqlJdbcConnectionProfile", the profile that I created programmatically.
If I right-click and select ping, it works. If I double-click it, it
connects. But I never see any items below it, for schema, tables, etc.

If I right-click the profile and select Properties, a window comes up that
is titled "Properties for MySqlJdbcConnectionProfile". It has a tree on
the left that has top-levle elements "Common" and "Version". If I select
Common, on the right I have text box fields I can set for Name and
Description (optional), as well as a check box "Connect every time the
workbench is started." I'm hoping to see fields for setting the username,
password, etc. I also don't see any reference to the driver in the profile
properties, which I would think would be there. I don't see any other
property pages or references to such in the window that appears.

When I display the DSE in the IDE, of course I don't see any profiles
until I create them via the DTP GUI. From the context menu in the DSE, I
select New, to launch the New Connection Profile wizard. On the second
wizard page, I specify the driver from the drop-down menu, and configure
the driver properties. Then when I complete the wizard, in the DSE under
the entry for the profile, I see an entry for the database instance, which
I can then expand to see "Schemas" and "Tables", etc.

I thought maybe the problem only occurs for profiles created
programmatically. So I tried in the DSE for my launched eclipse
application to create a driver and profile manually via the DSE GUI. That
one behaved the same as the one created programmtically. I can ping it and
connect to it, but I don't see the child elements for it.

One possible hint for the cause of the difference is that my Preferences
pages are different between the IDE and the launched application. For the
IDE, I have a perference page Data Management/Connectivity/Database
Conenction Profile. Ut has two checkboxes "Show schema" and "Show database
object owner". I don;t have this preference page on the launched
application. I have the page Data Management/Connectivity, but it's only
child page is Driver Definitions. That's what made me think I may be
missing a plug-in for the launched application.
Re: Still can't create a connection [message #595401 is a reply to message #55234] Mon, 13 April 2009 18:36 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Correction: I do see a see reference to the driver from the profile
properties page. In addition to the Common and Version pages in the tree
on the left, I also see pages for filters (schema, tables, and stored
procs) and a page for Driver Properties.
Re: Still can't create a connection [message #595417 is a reply to message #55261] Tue, 14 April 2009 13:58 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
And on the Driver Properties page, you can't edit the properties for the
profile?
--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:9334931d851f5832bf04c37d0974132b$1@www.eclipse.org...
> Correction: I do see a see reference to the driver from the profile
> properties page. In addition to the Common and Version pages in the tree
> on the left, I also see pages for filters (schema, tables, and stored
> procs) and a page for Driver Properties.
>
Re: Still can't create a connection [message #595426 is a reply to message #55288] Tue, 14 April 2009 15:38 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Brian Fitzpatrick wrote:

> And on the Driver Properties page, you can't edit the properties for the
> profile?
> --Fitz

Actually, I can edit the properties there. I was assuming that I'd be
modifying the properties bound to the driver rather than those bound to
the profile in that case, since the properties page is named Driver
Properties. It's my understanding that DTP intends to provide a driver
definition independent of profile definitions, so users can create
multiple profiles that potentially use the same driver, with the driver
providing a single physical connection spec and the profiles providing
different user-oriented connection properties. For our purposes, we'd like
to have one fixed driver definition (class name and jar file) and
(potentially) different connection profiles with distinct user IDs,
passwords, databases, or URLs.

Am I correct that I'd be modifying the driver properties vice the profile
properties on the Driver properties page that comes up when viewing a
profile? Either way, this is not too big of a deal. I'm more concerned
with having the ability to view and edit tables through the DSE. That
would be a very convenient development support capability.
Re: Still can't create a connection [message #595436 is a reply to message #55314] Tue, 14 April 2009 23:10 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
Actually even though it's labeled "Driver Properties" -- it's actually the
properties for the profile. It's very poorly labeled. If you feel so
inclined, you can create a bug in Bugzilla for it so we change the label.

But even so, you're still not able to connect and drill into the profile to
see the tables?

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:2160e030dcac13e21edfeda9bea74219$1@www.eclipse.org...
> Brian Fitzpatrick wrote:
>
>> And on the Driver Properties page, you can't edit the properties for the
>> profile?
>> --Fitz
>
> Actually, I can edit the properties there. I was assuming that I'd be
> modifying the properties bound to the driver rather than those bound to
> the profile in that case, since the properties page is named Driver
> Properties. It's my understanding that DTP intends to provide a driver
> definition independent of profile definitions, so users can create
> multiple profiles that potentially use the same driver, with the driver
> providing a single physical connection spec and the profiles providing
> different user-oriented connection properties. For our purposes, we'd like
> to have one fixed driver definition (class name and jar file) and
> (potentially) different connection profiles with distinct user IDs,
> passwords, databases, or URLs.
>
> Am I correct that I'd be modifying the driver properties vice the profile
> properties on the Driver properties page that comes up when viewing a
> profile? Either way, this is not too big of a deal. I'm more concerned
> with having the ability to view and edit tables through the DSE. That
> would be a very convenient development support capability.
>
>
Re: Still can't create a connection [message #595442 is a reply to message #55341] Wed, 15 April 2009 13:11 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Brian Fitzpatrick wrote:

> Actually even though it's labeled "Driver Properties" -- it's actually the
> properties for the profile. It's very poorly labeled. If you feel so
> inclined, you can create a bug in Bugzilla for it so we change the label.

> But even so, you're still not able to connect and drill into the profile to
> see the tables?

> --Fitz

Thanks, it's good to know those are the profile properties. I'll go ahead
and create a Bugzilla entry about changing the label.

Yes, the only remaining problem I have with my current DTP-based
implementation is the inability to drill into my profile via the DSE and
view or edit tables. I can connect to the profile in the DSE, but I just
don't see any child entries for the profile.

I can drill down in the DSE if I just launch the eclipse IDE and display
the DSE view. But when I launch an eclipse application with the plug-ins
that I and my team have created, the DSE doesn't have the ability to
drill-down to tables. That's why I'm thinking I might just be missing the
DTP plug-in that enables this capability in the DSE, though I've tried
adding various DTP plug-ins to my workspace and/or target environment.
Re: Still can't create a connection [message #595450 is a reply to message #55369] Wed, 15 April 2009 13:20 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
What DTP plug-ins do you have in your project so far and I can probably tell
you what's missing?
--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:7f35f0f751f03ba21095ae5b11fc27e1$1@www.eclipse.org...
> Brian Fitzpatrick wrote:
>
>> Actually even though it's labeled "Driver Properties" -- it's actually
>> the properties for the profile. It's very poorly labeled. If you feel so
>> inclined, you can create a bug in Bugzilla for it so we change the label.
>
>> But even so, you're still not able to connect and drill into the profile
>> to see the tables?
>
>> --Fitz
>
> Thanks, it's good to know those are the profile properties. I'll go ahead
> and create a Bugzilla entry about changing the label.
>
> Yes, the only remaining problem I have with my current DTP-based
> implementation is the inability to drill into my profile via the DSE and
> view or edit tables. I can connect to the profile in the DSE, but I just
> don't see any child entries for the profile.
>
> I can drill down in the DSE if I just launch the eclipse IDE and display
> the DSE view. But when I launch an eclipse application with the plug-ins
> that I and my team have created, the DSE doesn't have the ability to
> drill-down to tables. That's why I'm thinking I might just be missing the
> DTP plug-in that enables this capability in the DSE, though I've tried
> adding various DTP plug-ins to my workspace and/or target environment.
>
Re: Still can't create a connection [message #595458 is a reply to message #55395] Wed, 15 April 2009 17:06 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Brian Fitzpatrick wrote:

> What DTP plug-ins do you have in your project so far and I can probably tell
> you what's missing?
> --Fitz

These are the DTP plug-ins I have in my target:

02/17/2009 10:21 PM 25,804
org.eclipse.datatools.connectivity.console.profile_1.0.0.v20 0805231345.jar
02/17/2009 10:21 PM 27,692
org.eclipse.datatools.connectivity.db.generic.ui_1.0.1.v2008 05152355.jar
04/10/2009 04:38 PM 13,015
org.eclipse.datatools.connectivity.db.generic_1.0.1.v2008101 40922.jar
02/17/2009 10:21 PM 8,695
org.eclipse.datatools.connectivity.dbdefinition.genericJDBC_ 1.0.1.v200810300511.jar
02/17/2009 10:21 PM 324,241
org.eclipse.datatools.connectivity.sqm.core.ui_1.1.3.v200902 070558.jar
04/10/2009 04:38 PM 309,127
org.eclipse.datatools.connectivity.sqm.core_1.0.7.v200902180 551.jar
04/10/2009 04:38 PM 75,769
org.eclipse.datatools.connectivity.ui.dse_1.1.3.v20081014034 9.jar
02/17/2009 10:22 PM 70,272
org.eclipse.datatools.connectivity.ui.templates_1.0.0.v20080 5152355.jar
04/10/2009 04:38 PM 532,625
org.eclipse.datatools.connectivity.ui_1.1.3.v200901150027.ja r
04/10/2009 04:38 PM 230,243
org.eclipse.datatools.connectivity_1.1.2.v200901090028.jar
02/17/2009 10:24 PM 18,632
org.eclipse.datatools.enablement.mysql.dbdefinition_1.0.4.v2 00901090853.jar
02/17/2009 10:24 PM 11,736
org.eclipse.datatools.enablement.mysql.ui_1.0.0.v20080515235 5.jar
02/17/2009 10:24 PM 57,210
org.eclipse.datatools.enablement.mysql_1.0.2.v200810160130.j ar
04/10/2009 04:38 PM 13,677
org.eclipse.datatools.help_1.5.0.v200805152355.jar
04/10/2009 04:38 PM 161,196
org.eclipse.datatools.modelbase.dbdefinition_1.0.1.v20090109 0853.jar
02/17/2009 10:26 PM 274,569
org.eclipse.datatools.modelbase.sql.edit_1.0.0.v200805152355 .jar
02/17/2009 10:26 PM 190,244
org.eclipse.datatools.modelbase.sql.query.edit_1.0.0.v200806 070329.jar
02/17/2009 10:26 PM 554,526
org.eclipse.datatools.modelbase.sql.query_1.0.1.v20090124114 5.jar
02/17/2009 10:27 PM 256,701
org.eclipse.datatools.modelbase.sql.xml.query_1.0.0.v2008070 80500.jar
04/10/2009 04:38 PM 429,277
org.eclipse.datatools.modelbase.sql_1.0.1.v200812031125.jar
02/17/2009 10:27 PM 125,565
org.eclipse.datatools.sqltools.common.ui_1.0.0.v200812121740 .jar
02/17/2009 10:27 PM 62,994
org.eclipse.datatools.sqltools.data.core_1.0.1.v200902140515 .jar
02/17/2009 10:27 PM 109,403
org.eclipse.datatools.sqltools.data.ui_1.1.1.v200901140830.j ar
02/17/2009 10:27 PM 144,149
org.eclipse.datatools.sqltools.db.derby_1.0.0.v200805152355. jar
02/17/2009 10:27 PM 131,176
org.eclipse.datatools.sqltools.db.generic_1.0.0.v20090203160 0.jar
02/17/2009 10:27 PM 66,532
org.eclipse.datatools.sqltools.ddlgen.ui_1.0.0.v200808140615 .jar
02/17/2009 10:27 PM 116,271
org.eclipse.datatools.sqltools.debugger.core_1.0.0.v20080814 0615.jar
02/17/2009 10:27 PM 149,776
org.eclipse.datatools.sqltools.doc.user_1.6.1.v2008082813371 3.jar
02/17/2009 10:28 PM 172,920
org.eclipse.datatools.sqltools.editor.core_1.0.0.v2009020316 00.jar
02/17/2009 10:28 PM 137,865
org.eclipse.datatools.sqltools.parsers.sql.lexer_1.0.1.v2008 11081015.jar
02/17/2009 10:28 PM 299,987
org.eclipse.datatools.sqltools.parsers.sql.query_1.0.1.v2008 10291500.jar
02/17/2009 10:28 PM 274,409
org.eclipse.datatools.sqltools.parsers.sql.xml.query_1.0.0.v 200808140615.jar
02/17/2009 10:28 PM 42,531
org.eclipse.datatools.sqltools.parsers.sql_1.0.1.v2008081406 15.jar
02/17/2009 10:28 PM 123,971
org.eclipse.datatools.sqltools.plan_1.0.0.v200812121520.jar
02/17/2009 10:28 PM 374,293
org.eclipse.datatools.sqltools.result_1.0.0.v200902120900.ja r
02/17/2009 10:28 PM 185,043
org.eclipse.datatools.sqltools.routineeditor_1.0.0.v20080721 1830.jar
02/17/2009 10:28 PM 1,029,608
org.eclipse.datatools.sqltools.sqlbuilder_1.0.0.v20090128065 0.jar
02/17/2009 10:29 PM 451,600
org.eclipse.datatools.sqltools.sqleditor_1.0.0.v200901220945 .jar
02/17/2009 10:29 PM 123,355
org.eclipse.datatools.sqltools.sqlscrapbook_1.0.0.v200901151 810.jar
02/17/2009 10:28 PM 89,401
org.eclipse.datatools.sqltools.sql_1.0.0.v200902031600.jar
02/17/2009 10:29 PM 28,366
org.eclipse.datatools.sqltools.tabledataeditor_1.0.0.v200901 280500.jar
02/17/2009 10:29 PM 72,146
org.eclipse.datatools.sqltools.tablewizard_1.0.0.v2008081406 15.jar
Re: Still can't create a connection [message #595474 is a reply to message #55423] Wed, 15 April 2009 20:05 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
Based on that list, I don't think you're missing anything.

And you're getting absolutely nothing in the tree when you connect? No +
sign to expand or anything?

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:c9a1e5c0ee4ac2350bb0f3c21cee032d$1@www.eclipse.org...
> Brian Fitzpatrick wrote:
>
>> What DTP plug-ins do you have in your project so far and I can probably
>> tell you what's missing?
>> --Fitz
>
> These are the DTP plug-ins I have in my target:
>
> 02/17/2009 10:21 PM 25,804
> org.eclipse.datatools.connectivity.console.profile_1.0.0.v20 0805231345.jar
> 02/17/2009 10:21 PM 27,692
> org.eclipse.datatools.connectivity.db.generic.ui_1.0.1.v2008 05152355.jar
> 04/10/2009 04:38 PM 13,015
> org.eclipse.datatools.connectivity.db.generic_1.0.1.v2008101 40922.jar
> 02/17/2009 10:21 PM 8,695
> org.eclipse.datatools.connectivity.dbdefinition.genericJDBC_ 1.0.1.v200810300511.jar
> 02/17/2009 10:21 PM 324,241
> org.eclipse.datatools.connectivity.sqm.core.ui_1.1.3.v200902 070558.jar
> 04/10/2009 04:38 PM 309,127
> org.eclipse.datatools.connectivity.sqm.core_1.0.7.v200902180 551.jar
> 04/10/2009 04:38 PM 75,769
> org.eclipse.datatools.connectivity.ui.dse_1.1.3.v20081014034 9.jar
> 02/17/2009 10:22 PM 70,272
> org.eclipse.datatools.connectivity.ui.templates_1.0.0.v20080 5152355.jar
> 04/10/2009 04:38 PM 532,625
> org.eclipse.datatools.connectivity.ui_1.1.3.v200901150027.ja r
> 04/10/2009 04:38 PM 230,243
> org.eclipse.datatools.connectivity_1.1.2.v200901090028.jar
> 02/17/2009 10:24 PM 18,632
> org.eclipse.datatools.enablement.mysql.dbdefinition_1.0.4.v2 00901090853.jar
> 02/17/2009 10:24 PM 11,736
> org.eclipse.datatools.enablement.mysql.ui_1.0.0.v20080515235 5.jar
> 02/17/2009 10:24 PM 57,210
> org.eclipse.datatools.enablement.mysql_1.0.2.v200810160130.j ar
> 04/10/2009 04:38 PM 13,677
> org.eclipse.datatools.help_1.5.0.v200805152355.jar
> 04/10/2009 04:38 PM 161,196
> org.eclipse.datatools.modelbase.dbdefinition_1.0.1.v20090109 0853.jar
> 02/17/2009 10:26 PM 274,569
> org.eclipse.datatools.modelbase.sql.edit_1.0.0.v200805152355 .jar
> 02/17/2009 10:26 PM 190,244
> org.eclipse.datatools.modelbase.sql.query.edit_1.0.0.v200806 070329.jar
> 02/17/2009 10:26 PM 554,526
> org.eclipse.datatools.modelbase.sql.query_1.0.1.v20090124114 5.jar
> 02/17/2009 10:27 PM 256,701
> org.eclipse.datatools.modelbase.sql.xml.query_1.0.0.v2008070 80500.jar
> 04/10/2009 04:38 PM 429,277
> org.eclipse.datatools.modelbase.sql_1.0.1.v200812031125.jar
> 02/17/2009 10:27 PM 125,565
> org.eclipse.datatools.sqltools.common.ui_1.0.0.v200812121740 .jar
> 02/17/2009 10:27 PM 62,994
> org.eclipse.datatools.sqltools.data.core_1.0.1.v200902140515 .jar
> 02/17/2009 10:27 PM 109,403
> org.eclipse.datatools.sqltools.data.ui_1.1.1.v200901140830.j ar
> 02/17/2009 10:27 PM 144,149
> org.eclipse.datatools.sqltools.db.derby_1.0.0.v200805152355. jar
> 02/17/2009 10:27 PM 131,176
> org.eclipse.datatools.sqltools.db.generic_1.0.0.v20090203160 0.jar
> 02/17/2009 10:27 PM 66,532
> org.eclipse.datatools.sqltools.ddlgen.ui_1.0.0.v200808140615 .jar
> 02/17/2009 10:27 PM 116,271
> org.eclipse.datatools.sqltools.debugger.core_1.0.0.v20080814 0615.jar
> 02/17/2009 10:27 PM 149,776
> org.eclipse.datatools.sqltools.doc.user_1.6.1.v2008082813371 3.jar
> 02/17/2009 10:28 PM 172,920
> org.eclipse.datatools.sqltools.editor.core_1.0.0.v2009020316 00.jar
> 02/17/2009 10:28 PM 137,865
> org.eclipse.datatools.sqltools.parsers.sql.lexer_1.0.1.v2008 11081015.jar
> 02/17/2009 10:28 PM 299,987
> org.eclipse.datatools.sqltools.parsers.sql.query_1.0.1.v2008 10291500.jar
> 02/17/2009 10:28 PM 274,409
> org.eclipse.datatools.sqltools.parsers.sql.xml.query_1.0.0.v 200808140615.jar
> 02/17/2009 10:28 PM 42,531
> org.eclipse.datatools.sqltools.parsers.sql_1.0.1.v2008081406 15.jar
> 02/17/2009 10:28 PM 123,971
> org.eclipse.datatools.sqltools.plan_1.0.0.v200812121520.jar
> 02/17/2009 10:28 PM 374,293
> org.eclipse.datatools.sqltools.result_1.0.0.v200902120900.ja r
> 02/17/2009 10:28 PM 185,043
> org.eclipse.datatools.sqltools.routineeditor_1.0.0.v20080721 1830.jar
> 02/17/2009 10:28 PM 1,029,608
> org.eclipse.datatools.sqltools.sqlbuilder_1.0.0.v20090128065 0.jar
> 02/17/2009 10:29 PM 451,600
> org.eclipse.datatools.sqltools.sqleditor_1.0.0.v200901220945 .jar
> 02/17/2009 10:29 PM 123,355
> org.eclipse.datatools.sqltools.sqlscrapbook_1.0.0.v200901151 810.jar
> 02/17/2009 10:28 PM 89,401
> org.eclipse.datatools.sqltools.sql_1.0.0.v200902031600.jar
> 02/17/2009 10:29 PM 28,366
> org.eclipse.datatools.sqltools.tabledataeditor_1.0.0.v200901 280500.jar
> 02/17/2009 10:29 PM 72,146
> org.eclipse.datatools.sqltools.tablewizard_1.0.0.v2008081406 15.jar
>
Re: Still can't create a connection [message #595482 is a reply to message #55477] Wed, 15 April 2009 20:36 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Brian Fitzpatrick wrote:

> Based on that list, I don't think you're missing anything.

> And you're getting absolutely nothing in the tree when you connect? No +
> sign to expand or anything?

Yes, that's correct, absolutely nothing. Since it works in the IDE, I know
what I'm supposed to see, and it's definitely not there when running an
eclipse app. And as I mentioned previously, I tried defining a profile
manually via the DSE view menu, and that profile also didn't have any
child elements either.
Re: Still can't create a connection [message #595491 is a reply to message #55504] Wed, 15 April 2009 20:55 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
Can you create a different type of connection profile? Such as for a Derby
database or something?

I'm just trying to determine if it's the fact that the driver is overridden
or that something is missing...

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:af7cd8bb467a50921c10385ff9e92cd3$1@www.eclipse.org...
> Brian Fitzpatrick wrote:
>
>> Based on that list, I don't think you're missing anything.
>
>> And you're getting absolutely nothing in the tree when you connect? No +
>> sign to expand or anything?
>
> Yes, that's correct, absolutely nothing. Since it works in the IDE, I know
> what I'm supposed to see, and it's definitely not there when running an
> eclipse app. And as I mentioned previously, I tried defining a profile
> manually via the DSE view menu, and that profile also didn't have any
> child elements either.
>
Re: Still can't create a connection [message #595543 is a reply to message #55529] Thu, 16 April 2009 19:12 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 123
Registered: July 2009
Senior Member
Brian Fitzpatrick wrote:

> Can you create a different type of connection profile? Such as for a Derby
> database or something?

Fitz,

Success at last! The Derby suggestion was a good one. I had to add a
number of bundles to get the Derby bundles to resolve, and some of those
turned out to be the ones needed to make the MySQL profile drill-down
work. The missing bundles were:

org.eclipse.datatools.connectivity.sqm.core.ui
org.eclipse.datatools.connectivity.sqm.server.ui
org.eclipse.datatools.modelbase.sql.edit


It's interesting that the dependencies were identified when I used Derby,
but for MySQL profiles the DSE silently failed to expose the drill-down
capability. Perhaps that's something that can be addressed.

Once again, I;'m very grateful for the superb help you gave me. You hung
in there with me, and we were able to get everything that I needed working.

-Mark
Re: Still can't create a connection [message #595555 is a reply to message #55685] Fri, 17 April 2009 14:04 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
Hooray! :)

You bet. I'm glad I could help and it was a relatively minor problem of
missing bundles in the end. I had a few more options, but they got ugly
quickly. ;)

I'm going to take this thread and try and write up some basics on using the
APIs and the various options available on the Wiki. It was a great exercise
trying to walk someone else through the process -- thanks for being patient!

Do let us know if you need anything else and if you find more bugs or
issues, give us a holler!

Have a great weekend!

--Fitz

"Mark Leone" <midnightjava@verizon.net> wrote in message
news:ac29597ba240eb07094fa7c5dd29cc5a$1@www.eclipse.org...
> Brian Fitzpatrick wrote:
>
>> Can you create a different type of connection profile? Such as for a
>> Derby database or something?
>
> Fitz,
>
> Success at last! The Derby suggestion was a good one. I had to add a
> number of bundles to get the Derby bundles to resolve, and some of those
> turned out to be the ones needed to make the MySQL profile drill-down
> work. The missing bundles were:
>
> org.eclipse.datatools.connectivity.sqm.core.ui
> org.eclipse.datatools.connectivity.sqm.server.ui
> org.eclipse.datatools.modelbase.sql.edit
>
>
> It's interesting that the dependencies were identified when I used Derby,
> but for MySQL profiles the DSE silently failed to expose the drill-down
> capability. Perhaps that's something that can be addressed.
>
> Once again, I;'m very grateful for the superb help you gave me. You hung
> in there with me, and we were able to get everything that I needed
> working.
>
> -Mark
>
Previous Topic:How to get dataset filters
Next Topic:generate entities problem with sql server
Goto Forum:
  


Current Time: Fri Dec 04 05:24:52 GMT 2020

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

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

Back to the top