db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Dudziak <tom...@gmail.com>
Subject Re: [Howto?] Creating a new Derby database with ddlutils.
Date Mon, 07 Nov 2005 13:04:12 GMT
On 11/7/05, Thorbjørn Ravn Andersen <thunderaxiom@gmail.com> wrote:

> I want my ddlutils program to create a fresh database in Derby when
> starting, but I cannot quite figure out how to do this correctly.
>
> I understand that I need to use something similar to:
>
>         EmbeddedDataSource dataSource = new EmbeddedDataSource();
>         DataSource ds = dataSource;
>         Platform platform = PlatformFactory.createNewPlatformInstance(ds);

You should not create the platform via the datasource because this
will fail as the platform factory will try to determine the database
type by connecting to it.
Rather, create it by specifying the database type or the jdbc driver &
url as the argument(s).

>         platform.createDatabase("org.apache.derby.jdbc.ClientDriver", dbURL,
>                 "me", "mine", Collections.EMPTY_MAP);

This should work as long as the platform is correctly for Derby.

Tom

Mime
View raw message