Hi everyone,
we are developing Software using Databases. The Software is said to run
under various databases (Oracle, Interbase, MySQL, etc.)
In order to run correctly we need to run several DB-Scripts creating
tables and filling them once before our application can be started.
I would like to have a single source of descriptionfile (XML or
whatever) i can generate DB-Scripts from.
So i can specify the tables in an abstract way and create generation
scripts for the various databases on a single click.
I also want to specify the data for the inserts (as java Datatypes i.e.)
X-Doclet is a good start, but with X-Doclet you cant generate inserts to
fill the db with statupvalues.
I wonder if there are dummy JDBC Drivers? A Driver that does NOT do the
inserts into the Database but print out the generated SQL-Commands would
be of help, because then we could write a java program do the job for
the inserts.
any ideas (products?)
Damodar Periwal - 28 Apr 2004 00:50 GMT
Hi Volker,
You should check out JDX OR-Mapper product to easily accomplish these
tasks. To use JDX, you define your Java business classes and define
OR-Mapping specification in a simple declarative fashion.
Now you can generate required schema creation (DDL) statements for
different backend RDBMS by just changing the database type name.
These statements can be generated in a script file. JDX can also
apply these scripts to create the database tables. JDX comes with a
nice GUI tool (JDXStudio) to make these tasks a breeze with just a few
mouse clicks.
You can also populate your database by writing a straightforward Java
program that creates instances of your business objects and invokes
insert method of JDX. You can easily write a compact utility that
generates and inserts test data programmatically without having to
write a single line of SQL code. For a simple example, see STORM(tm)
benchmark programs that ships with JDX.
Link to JDX Highlights:
http://www.softwaretree.com/products/jdx/JDXHighlights.htm
Visit Software Tree's web site (http://www.softwaretree.com) for a
free evaluation download of JDX.
-- Damodar Periwal
Software Tree, Inc.
Simplify Data Integration
http://wwww.softwaretree.com
> Hi everyone,
>
[quoted text clipped - 15 lines]
>
> any ideas (products?)
David Harper - 28 Apr 2004 07:03 GMT
> Hi everyone,
>
[quoted text clipped - 4 lines]
> I would like to have a single source of descriptionfile (XML or
> whatever) i can generate DB-Scripts from.
You might want to consider an open source solution such as Hibernate
(www.hibernate.org) which maps Java objects to relational databases
automatically. It knows about a wide range of databases systems and
their idiosyncracies, so you won't be tying yourself to a specific system.
David Harper
Cambridge, England
T E Schmitz - 28 Apr 2004 13:17 GMT
Hallo Volker,
> we are developing Software using Databases. The Software is said to run
> under various databases (Oracle, Interbase, MySQL, etc.)
[quoted text clipped - 4 lines]
> So i can specify the tables in an abstract way and create generation
> scripts for the various databases on a single click.
This is just what we are doing with Torque (http://db.apache.org/torque/).
The schema is specified in XML. The Torque generator comes with an Ant
build file, which can generate/do a variety of things for you:
1) an SQL file for table, index etc. creation
2) source code consisting of a set of classes per DB table
3) Schema documentation
4) a data DTD (for loading data into the DB)
5) create the DB (DROP and CREATE)
6) initialise the DB with generated SQL
7) dump data into XML
8) load data from XML
Torque supports a variety of databases. All you have to do is specify
the type of DB and the generator chooses the templates accordingly. The
Torque generator is driven by Velocity templates, which are easy enough
to amend. I have added a few more templates for source code generation,
which reduced hand-coding dramatically.
Under the hood, Torque uses DBCP connection pooling, which is configured
via a Torque properties file.
Beware, you need to download the Torque generator as well as the runtime.

Signature
Best Regards,
Mit freundlichen Grüßen,
Tarlika Elisabeth Schmitz