Skip to main content



      Home
Home » Eclipse Projects » DTP » Generating DDL from SQL Model
Generating DDL from SQL Model [message #26194] Mon, 05 February 2007 18:08 Go to next message
Eclipse UserFriend
Originally posted by: tas.frangoullides.barclaysglobal.com

Hi all,

I'd like to generate database schemas from a UML model (UML2 project) and
it looks like DTP provides Ecore models for all the tables, columns, views
etc. I was hoping I could write a transformation that constructed a
database schema model and then used this to generate the DDL. Is this sort
of thing supported by DTP? I am also lacking the key starting points and
would be very grateful if someone could point me in the right directions.

1. What class should I use for the the root object of a database schema?
2. What's the best way to go about generating DDL from the Model?

Thanks for your help,
Tas.
Re: Generating DDL from SQL Model [message #26275 is a reply to message #26194] Thu, 08 February 2007 13:18 Go to previous messageGo to next message
Eclipse UserFriend
Hey Tas,

There is a DDL generation component within DTP. There is a default
generator that produces (or will produce) ANSI DDL. These generators can
be specialized for particular databases (which would be part of the DTP
enablement project).

So, if you could transform you're UML model into a SQL model, you could
look up a DDL generator for a particular DB type and pass the object in
the SQL model to that generator and voila.

Sorry I can't give more details.

Hope that helps.
Rob
Re: Generating DDL from SQL Model [message #26314 is a reply to message #26275] Thu, 08 February 2007 15:38 Go to previous messageGo to next message
Eclipse UserFriend
This is a multipart message in MIME format.
--=_alternative 007160998825727C_=
Content-Type: text/plain; charset="US-ASCII"

Yes, Rob gave a precise description of how DDL generation is supposed to
work. You can actually see how this is supported for Derby database on the
implementation details.

Der ping
--=_alternative 007160998825727C_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">Yes, Rob gave a precise description
of how DDL generation is supposed to work. You can actually see how this
is supported for Derby database on the implementation details.</font>
<br>
<br><font size=2 face="sans-serif">Der ping</font>
--=_alternative 007160998825727C_=--
Re: Generating DDL from SQL Model [message #26353 is a reply to message #26314] Thu, 08 February 2007 18:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tas.frangoullides.barclaysglobal.com

This is a multi-part message in MIME format.

------=_NextPart_000_004D_01C74BD5.B0A1F5F0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


Thank you both very much for your pointers... I'll dig in see if I can =
work out the details.

Thanks,
Tas.
<dpchou@us.ibm.com> wrote in message =
news:eqg1nv$8g7$1@utils.eclipse.org...

Yes, Rob gave a precise description of how DDL generation is supposed =
to work. You can actually see how this is supported for Derby database =
on the implementation details.=20

Der ping
------=_NextPart_000_004D_01C74BD5.B0A1F5F0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.3020" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thank you both very much for your =
pointers... I'll=20
dig in see if I can work out the details.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Tas.</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>&lt;<A =
href=3D"mailto:dpchou@us.ibm.com">dpchou@us.ibm.com</A>&gt; wrote in=20
message <A=20
=
href=3D"news:eqg1nv$8g7$1@utils.eclipse.org">news:eqg1nv$8g7$1@utils.ecli=
pse.org</A>...</DIV><BR><FONT=20
face=3Dsans-serif size=3D2>Yes, Rob gave a precise description of how =
DDL=20
generation is supposed to work. You can actually see how this is =
supported for=20
Derby database on the implementation details.</FONT> <BR><BR><FONT=20
face=3Dsans-serif size=3D2>Der ping</FONT></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_004D_01C74BD5.B0A1F5F0--
Re: Generating DDL from SQL Model [message #26550 is a reply to message #26314] Tue, 13 February 2007 12:20 Go to previous message
Eclipse UserFriend
Originally posted by: alex.black.barclaysglobal.com

Hi Der Ping,

I am trying to test generate DDL from a SQL Model with this:

public static void main(String[] args) {
SQLSchemaFactory sqlSchemaFactory = SQLSchemaFactory.eINSTANCE;

Schema mySchema = sqlSchemaFactory.createSchema();
Table myTable = SQLTablesFactory.eINSTANCE.createPersistentTable() ;
myTable.setName("MyTable");
Column column = SQLTablesFactory.eINSTANCE.createColumn();

//set DataType
DataType dataType =
SQLDataTypesFactory.eINSTANCE.createBinaryStringDataType();
column.setDataType(dataType);
myTable.getColumns().add(column);
mySchema.getTables().add(myTable);


//pass schema to DDLGen
GenericDdlGenerator gdg = new GenericDdlGenerator();
String[] test = gdg.generateDDL(new SQLObject[]{(SQLObject)mySchema},
new NullProgressMonitor());
System.out.println(test);
}

Right now I get an NPE from
org.eclipse.datatools.connectivity.sqm.core.containment.Cont ainmentServiceImpl. <init>(ContainmentServiceImpl.java:181).

Did I miss anything out? Am I suppose to set a property via
EngineeringOption[] , any help would be much appreciated.

Thanks,
Alex
Re: Generating DDL from SQL Model [message #584279 is a reply to message #26194] Thu, 08 February 2007 13:18 Go to previous message
Eclipse UserFriend
Hey Tas,

There is a DDL generation component within DTP. There is a default
generator that produces (or will produce) ANSI DDL. These generators can
be specialized for particular databases (which would be part of the DTP
enablement project).

So, if you could transform you're UML model into a SQL model, you could
look up a DDL generator for a particular DB type and pass the object in
the SQL model to that generator and voila.

Sorry I can't give more details.

Hope that helps.
Rob
Re: Generating DDL from SQL Model [message #584293 is a reply to message #26275] Thu, 08 February 2007 15:38 Go to previous message
Eclipse UserFriend
This is a multipart message in MIME format.
--=_alternative 007160998825727C_=
Content-Type: text/plain; charset="US-ASCII"

Yes, Rob gave a precise description of how DDL generation is supposed to
work. You can actually see how this is supported for Derby database on the
implementation details.

Der ping
--=_alternative 007160998825727C_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">Yes, Rob gave a precise description
of how DDL generation is supposed to work. You can actually see how this
is supported for Derby database on the implementation details.</font>
<br>
<br><font size=2 face="sans-serif">Der ping</font>
--=_alternative 007160998825727C_=--
Re: Generating DDL from SQL Model [message #584307 is a reply to message #26314] Thu, 08 February 2007 18:05 Go to previous message
Eclipse UserFriend
This is a multi-part message in MIME format.

------=_NextPart_000_004D_01C74BD5.B0A1F5F0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


Thank you both very much for your pointers... I'll dig in see if I can =
work out the details.

Thanks,
Tas.
<dpchou@us.ibm.com> wrote in message =
news:eqg1nv$8g7$1@utils.eclipse.org...

Yes, Rob gave a precise description of how DDL generation is supposed =
to work. You can actually see how this is supported for Derby database =
on the implementation details.=20

Der ping
------=_NextPart_000_004D_01C74BD5.B0A1F5F0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.3020" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thank you both very much for your =
pointers... I'll=20
dig in see if I can work out the details.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Tas.</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>&lt;<A =
href=3D"mailto:dpchou@us.ibm.com">dpchou@us.ibm.com</A>&gt; wrote in=20
message <A=20
=
href=3D"news:eqg1nv$8g7$1@utils.eclipse.org">news:eqg1nv$8g7$1@utils.ecli=
pse.org</A>...</DIV><BR><FONT=20
face=3Dsans-serif size=3D2>Yes, Rob gave a precise description of how =
DDL=20
generation is supposed to work. You can actually see how this is =
supported for=20
Derby database on the implementation details.</FONT> <BR><BR><FONT=20
face=3Dsans-serif size=3D2>Der ping</FONT></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_004D_01C74BD5.B0A1F5F0--
Re: Generating DDL from SQL Model [message #584405 is a reply to message #26314] Tue, 13 February 2007 12:20 Go to previous message
Eclipse UserFriend
Hi Der Ping,

I am trying to test generate DDL from a SQL Model with this:

public static void main(String[] args) {
SQLSchemaFactory sqlSchemaFactory = SQLSchemaFactory.eINSTANCE;

Schema mySchema = sqlSchemaFactory.createSchema();
Table myTable = SQLTablesFactory.eINSTANCE.createPersistentTable() ;
myTable.setName("MyTable");
Column column = SQLTablesFactory.eINSTANCE.createColumn();

//set DataType
DataType dataType =
SQLDataTypesFactory.eINSTANCE.createBinaryStringDataType();
column.setDataType(dataType);
myTable.getColumns().add(column);
mySchema.getTables().add(myTable);


//pass schema to DDLGen
GenericDdlGenerator gdg = new GenericDdlGenerator();
String[] test = gdg.generateDDL(new SQLObject[]{(SQLObject)mySchema},
new NullProgressMonitor());
System.out.println(test);
}

Right now I get an NPE from
org.eclipse.datatools.connectivity.sqm.core.containment.Cont ainmentServiceImpl. <init>(ContainmentServiceImpl.java:181).

Did I miss anything out? Am I suppose to set a property via
EngineeringOption[] , any help would be much appreciated.

Thanks,
Alex
Previous Topic:Connect to MySql 5.0
Next Topic:Database Explorer Connections access
Goto Forum:
  


Current Time: Sun Jun 08 01:50:49 EDT 2025

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

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

Back to the top