You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-user@db.apache.org by Thomas Dudziak <to...@gmail.com> on 2005/11/07 14:04:12 UTC

Re: [Howto?] Creating a new Derby database with ddlutils.

On 11/7/05, Thorbjørn Ravn Andersen <th...@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