Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DTP » again on Data Tools api / extensions. How to write on DB using DTP objects.
again on Data Tools api / extensions. How to write on DB using DTP objects. [message #491225] Tue, 13 October 2009 16:59 Go to next message
No real name is currently offline No real nameFriend
Messages: 14
Registered: October 2009
Junior Member
Hi all,
I'm using the Data Tools Api and Extension Points on Eclipse 3.5 SR-1 (Galileo) and MySql 5.

On my RCP application I've created a ConnectionProfile.
I've seen and tried with success the code to get the Database object (http://wiki.eclipse.org/DTP_FAQ) but in that case I can just read data or write it using the classic java.sql.statement/SQL.
I'd like to WRITE objects' api in offline mode and save all just in the end.
Is it possible?
Anyway I don't have idea on how to do it also in online mode.
Which java classes can I use to create a table or modify a foreign key?
In the topic seems that there's no way...


I'm also wondering where is the "new table" context menu item who disappeared since I installed Galileo.
In the topic "Capabilities of DTP" Brian doesn't give a solution on it Neutral

I also have this error when I try to change perspective of my application from Plug-in Dev. to Database Development (I'm using IDE as TARGET and I included all the plugin in the run-configuration):
Could not acquire children from extension: org.eclipse.datatools.connectivity.dsexplorer.content.extend ed


I hope that someone will answer me Wink

Thank you,

Lero
Re: again on Data Tools api / extensions. How to write on DB using DTP objects. [message #491504 is a reply to message #491225] Wed, 14 October 2009 19:48 Go to previous messageGo to next message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
I'm not quite sure I understand what it is you're trying to do... When
you say you want to "write" objects api offline and then push things
back, I'm not sure what that means. Are you trying to use offline mode
to do DDL development and then when you connect, execute the DDL on the
live database? At this point, I don't believe that's possible.

In online mode, you can use the SQL Scrapbook to execute DDL against the
database to create objects in the database.

The new table functionality is in CVS, but has been removed from DTP
builds due to a lack of support. The developers who contributed that
have moved on to other projects and we have nobody left to pick up the
work.

Are you doing RCP development? Just sounds like you have a missing
dependency. You might try adding the org.eclipse.ui.ide plug-in as a
dependency and see if that clears it up. We have an existing issue with
that being a missing bit.

--Fitz

lero@email.it wrote:
> Hi all,
> I'm using the Data Tools Api and Extension Points on Eclipse 3.5 SR-1
> (Galileo) and MySql 5.
>
> On my RCP application I've created a ConnectionProfile.
> I've seen and tried with success the code to get the Database object
> (http://wiki.eclipse.org/DTP_FAQ) but in that case I can just read data
> or write it using the classic java.sql.statement/SQL.
> I'd like to WRITE objects' api in offline mode and save all just in the
> end.
> Is it possible?
> Anyway I don't have idea on how to do it also in online mode.
> Which java classes can I use to create a table or modify a foreign key?
> In the topic seems that there's no way...
>
>
> I'm also wondering where is the "new table" context menu item who
> disappeared since I installed Galileo.
> In the topic "Capabilities of DTP" Brian doesn't give a solution on it :|
>
> I also have this error when I try to change perspective of my
> application from Plug-in Dev. to Database Development (I'm using IDE as
> TARGET and I included all the plugin in the run-configuration):
> Could not acquire children from extension:
> org.eclipse.datatools.connectivity.dsexplorer.content.extend ed
>
>
> I hope that someone will answer me ;)
>
> Thank you,
>
> Lero
Re: again on Data Tools api / extensions. How to write on DB using DTP objects. [message #491583 is a reply to message #491504] Thu, 15 October 2009 07:45 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 14
Registered: October 2009
Junior Member
Thanks for the answer.
I arrived at the point where I create Sql Code to create a table on an existing schema (so... ready to be executed by a java.sql.statement).
The code is here...


ConnectionInfo connectionInfo = (ConnectionInfo) managedConnection.getConnection().getRawConnection();

database = connectionInfo.getSharedDatabase();
SQLQueryParserFactory factory = new SQLQueryParserFactory();

testSchema = factory.createSchema("test");
testSchema.setDatabase(database);


SQLTablesFactory tablesFactory = new SQLTablesFactoryImpl();
PersistentTable persistentTable = tablesFactory.createPersistentTable();
persistentTable.setName("tabletestN1");
persistentTable.setSchema(testSchema);

Column column = tablesFactory.createColumn();
column.setName("testcolumn");

DatabaseDefinition def = DatabaseDefinitionRegistryImpl.INSTANCE.getDefinition(database);
PredefinedDataType predefineDatatype = def.getPredefinedDataType("INTEGER");

column.setDataType(predefineDatatype);
column.setNullable(false);
column.setTable(persistentTable);

DDLGenerator dDLGenerator = new GenericDdlGenerator();
String[] generateSql = dDLGenerator.createSQLObjects(new SQLObject[]{persistentTable}, true, true, null);


I spent 3 days looking for a way in the DTP's java source files.
In this way I can say that you work ALWAYS offline, until you don't execute the Sql code
Re: again on Data Tools api / extensions. How to write on DB using DTP objects. [message #596695 is a reply to message #491225] Wed, 14 October 2009 19:48 Go to previous messageGo to next message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
I'm not quite sure I understand what it is you're trying to do... When
you say you want to "write" objects api offline and then push things
back, I'm not sure what that means. Are you trying to use offline mode
to do DDL development and then when you connect, execute the DDL on the
live database? At this point, I don't believe that's possible.

In online mode, you can use the SQL Scrapbook to execute DDL against the
database to create objects in the database.

The new table functionality is in CVS, but has been removed from DTP
builds due to a lack of support. The developers who contributed that
have moved on to other projects and we have nobody left to pick up the
work.

Are you doing RCP development? Just sounds like you have a missing
dependency. You might try adding the org.eclipse.ui.ide plug-in as a
dependency and see if that clears it up. We have an existing issue with
that being a missing bit.

--Fitz

lero@email.it wrote:
> Hi all,
> I'm using the Data Tools Api and Extension Points on Eclipse 3.5 SR-1
> (Galileo) and MySql 5.
>
> On my RCP application I've created a ConnectionProfile.
> I've seen and tried with success the code to get the Database object
> (http://wiki.eclipse.org/DTP_FAQ) but in that case I can just read data
> or write it using the classic java.sql.statement/SQL.
> I'd like to WRITE objects' api in offline mode and save all just in the
> end.
> Is it possible?
> Anyway I don't have idea on how to do it also in online mode.
> Which java classes can I use to create a table or modify a foreign key?
> In the topic seems that there's no way...
>
>
> I'm also wondering where is the "new table" context menu item who
> disappeared since I installed Galileo.
> In the topic "Capabilities of DTP" Brian doesn't give a solution on it :|
>
> I also have this error when I try to change perspective of my
> application from Plug-in Dev. to Database Development (I'm using IDE as
> TARGET and I included all the plugin in the run-configuration):
> Could not acquire children from extension:
> org.eclipse.datatools.connectivity.dsexplorer.content.extend ed
>
>
> I hope that someone will answer me ;)
>
> Thank you,
>
> Lero
Re: again on Data Tools api / extensions. How to write on DB using DTP objects. [message #596704 is a reply to message #491504] Thu, 15 October 2009 07:45 Go to previous message
No real name is currently offline No real nameFriend
Messages: 14
Registered: October 2009
Junior Member
Thanks for the answer.
I arrived at the point where I create Sql Code to create a table on an existing schema (so... ready to be executed by a java.sql.statement).
The code is here...



ConnectionInfo connectionInfo = (ConnectionInfo) managedConnection.getConnection().getRawConnection();

database = connectionInfo.getSharedDatabase();
SQLQueryParserFactory factory = new SQLQueryParserFactory();

testSchema = factory.createSchema("test");
testSchema.setDatabase(database);


SQLTablesFactory tablesFactory = new SQLTablesFactoryImpl();
PersistentTable persistentTable = tablesFactory.createPersistentTable();
persistentTable.setName("tabletestN1");
persistentTable.setSchema(testSchema);

Column column = tablesFactory.createColumn();
column.setName("testcolumn");

DatabaseDefinition def = DatabaseDefinitionRegistryImpl.INSTANCE.getDefinition(databa se);
PredefinedDataType predefineDatatype = def.getPredefinedDataType("INTEGER");

column.setDataType(predefineDatatype);
column.setNullable(false);
column.setTable(persistentTable);

DDLGenerator dDLGenerator = new GenericDdlGenerator();
String[] generateSql = dDLGenerator.createSQLObjects(new SQLObject[]{persistentTable}, true, true, null);


I spent 3 days looking for a way in the DTP's java source files.
In this way I can say that you work ALWAYS offline, until you don't execute the Sql code
Previous Topic:Programmatically DB access connection via DTP on Eclipse 3.5 (Galileo)
Next Topic:unable to deactivate DTP via capabilities in gallileo
Goto Forum:
  


Current Time: Wed Apr 24 19:27:15 GMT 2024

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

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

Back to the top