On 1/11/06, Mark Shifman <[EMAIL PROTECTED]> wrote:
> I just started playing with ddlutils and I was trying to read a live
> database
> and write the structure to a file (hopefully as sql to avoid dbartisan).
> 1. the example from api-usage.html didn't work in my hands since
>
> platform.readModelFromDatabase(); was not defined in version from yesterday.
Yes, that's because the reading of models from the database is
currently work in progress as we test it against the different
databases. Currently tested and working are: HsqlDb, McKoi, Derby,
PostgreSql, MySql 4 & 5. Testing is in progress for the bigger ones
(those which are more difficult to setup): Oracle, Db2, MaxDb, Sql
Server, Sybase
> 2. I tried (actually with a bunch of different readModelFromDatabase's)
>
> public static void writemodel (DataSource dataSource, String
> filename) throws Exception
> {
> Platform platform =
> PlatformFactory.createNewPlatformInstance(dataSource);
> Database db =platform.readModelFromDatabase(null,null,null,new
> String[] {});
> new DatabaseIO().write( db ,filename);
> }
> and got org.apache.ddlutils.DynaSqlException: java.sql.SQLException:
> ORA-00911: invalid character
> The full stack trace is below.
> My database is Oracle 9.
You should use the readModelFromDatabase(String) method where the
single argument is the name of the resulting database model (has
nothing to do with the live database).
Oracle databases are not fully tested yet, I wanted to do that
sometime this week (probably weekend). For playing around and getting
familiar with DdlUtils, you could in the meantime use an embedded
database (e.g. Derby).
Tom