Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 25976 invoked from network); 11 Mar 2006 00:14:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 11 Mar 2006 00:14:00 -0000 Received: (qmail 62875 invoked by uid 500); 11 Mar 2006 00:14:00 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 62846 invoked by uid 500); 11 Mar 2006 00:14:00 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 62834 invoked by uid 99); 11 Mar 2006 00:14:00 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Mar 2006 16:14:00 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 10 Mar 2006 16:13:59 -0800 Received: (qmail 25930 invoked by uid 65534); 11 Mar 2006 00:13:38 -0000 Message-ID: <20060311001338.25927.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r384959 - in /db/derby/site/trunk: build/site/integrate/db_ddlutils.html src/documentation/content/xdocs/integrate/db_ddlutils.xml Date: Sat, 11 Mar 2006 00:13:38 -0000 To: derby-commits@db.apache.org From: jta@apache.org X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: jta Date: Fri Mar 10 16:13:36 2006 New Revision: 384959 URL: http://svn.apache.org/viewcvs?rev=384959&view=rev Log: Modified the "Using DdlUtils to Migrate Databases to Derby" paper. Added the createDatabase subtask into the import target -- thanks to Tom Dudziak. Modified: db/derby/site/trunk/build/site/integrate/db_ddlutils.html db/derby/site/trunk/src/documentation/content/xdocs/integrate/db_ddlutils.xml Modified: db/derby/site/trunk/build/site/integrate/db_ddlutils.html URL: http://svn.apache.org/viewcvs/db/derby/site/trunk/build/site/integrate/db_ddlutils.html?rev=384959&r1=384958&r2=384959&view=diff ============================================================================== --- db/derby/site/trunk/build/site/integrate/db_ddlutils.html (original) +++ db/derby/site/trunk/build/site/integrate/db_ddlutils.html Fri Mar 10 16:13:36 2006 @@ -240,7 +240,7 @@ Add an import target to the build.xml
  • -Execute the Ant task +Execute the Ant task
  • @@ -618,11 +618,12 @@ <ddlToDatabase schemaFile="project-schema.xml"> - <database url="jdbc:derby:Books2;create=true" + <database url="jdbc:derby:Books2" driverClassName="org.apache.derby.jdbc.EmbeddedDriver" username="" password=""/> + <createDatabase failonerror="false"/> <writeSchemaToDatabase/> <writeDataToDatabase datafile="data.xml"/> @@ -642,14 +643,19 @@ site shows an example using that syntax. -
  • You might notice a createDatabase subtask in the DdlUtils - examples. - It is omitted from this example because - a Derby database gets created in the connection URL. +
  • The createDatabase subtask creates the Derby database. +
  • + +
  • The writeSchemaToDatabase subtask creates the schema + from the file specified by schemaFile. +
  • + +
  • The writeDataToDatabase subtask loads the data from the + specified data file.
  • - +

    Execute the Ant task

    Execute the task with ant: @@ -661,44 +667,24 @@ import-target-db: [ddlToDatabase] Read schema file /home/jta/DerbyDb/DdlUtils/project-schema.xml -[ddlToDatabase] Mar 9, 2006 4:27:04 PM org.apache.ddlutils.platform.SqlBuilder alterDatabase +[ddlToDatabase] Created database +[ddlToDatabase] Mar 10, 2006 4:03:05 PM org.apache.ddlutils.platform.SqlBuilder alterDatabase [ddlToDatabase] INFO: Creating table AUTHOR -[ddlToDatabase] Mar 9, 2006 4:27:04 PM org.apache.ddlutils.platform.SqlBuilder alterDatabase +[ddlToDatabase] Mar 10, 2006 4:03:05 PM org.apache.ddlutils.platform.SqlBuilder alterDatabase [ddlToDatabase] INFO: Creating table BOOK -[ddlToDatabase] Mar 9, 2006 4:27:04 PM org.apache.ddlutils.platform.SqlBuilder alterDatabase +[ddlToDatabase] Mar 10, 2006 4:03:05 PM org.apache.ddlutils.platform.SqlBuilder alterDatabase [ddlToDatabase] INFO: Creating table PUBLISHER -[ddlToDatabase] Mar 9, 2006 4:27:05 PM org.apache.ddlutils.platform.PlatformImplBase evaluateBatch -[ddlToDatabase] WARNING: SQL Warning: Database 'Books2' not created, connection made to existing database instead. -[ddlToDatabase] Mar 9, 2006 4:27:05 PM org.apache.ddlutils.platform.PlatformImplBase evaluateBatch +[ddlToDatabase] Mar 10, 2006 4:03:06 PM org.apache.ddlutils.platform.PlatformImplBase evaluateBatch [ddlToDatabase] INFO: Executed 5 SQL command(s) with 0 error(s) [ddlToDatabase] Written schema to database [ddlToDatabase] Read data file /home/jta/DerbyDb/DdlUtils/data.xml BUILD SUCCESSFUL Total time: 4 seconds

    -

    Notice the warning in the output:

    -

    [ddlToDatabase] WARNING: SQL Warning: Database 'Books2' not created, connection made to existing database instead.

    -

    This occurs because the database url in the build.xml specifies -create=true. -DdlUtils connects to the database twice to -carry out the tasks. The first time it connects, the database is created. -The second time it connects, it detects the warning that the database already -exists. -If you want to eliminate that warning, eliminate the create=true -in the subtask: -

    -

    <database url="jdbc:derby:Books2" - driverClassName="org.apache.derby.jdbc.EmbeddedDriver" - username="" - password=""/>

    -

    -If you remove the create=true, -be sure to manually create the database before running the Ant task. -

    - +

    Step 6: Verify Migration

    @@ -719,7 +705,7 @@

    - +

    Questions?

    Please post questions about this example to Modified: db/derby/site/trunk/src/documentation/content/xdocs/integrate/db_ddlutils.xml URL: http://svn.apache.org/viewcvs/db/derby/site/trunk/src/documentation/content/xdocs/integrate/db_ddlutils.xml?rev=384959&r1=384958&r2=384959&view=diff ============================================================================== --- db/derby/site/trunk/src/documentation/content/xdocs/integrate/db_ddlutils.xml (original) +++ db/derby/site/trunk/src/documentation/content/xdocs/integrate/db_ddlutils.xml Fri Mar 10 16:13:36 2006 @@ -387,11 +387,12 @@ <ddlToDatabase schemaFile="project-schema.xml"> - <database url="jdbc:derby:Books2;create=true" + <database url="jdbc:derby:Books2" driverClassName="org.apache.derby.jdbc.EmbeddedDriver" username="" password=""/> + <createDatabase failonerror="false"/> <writeSchemaToDatabase/> <writeDataToDatabase datafile="data.xml"/> @@ -411,10 +412,13 @@ DdlUtils site shows an example using that syntax. -

  • You might notice a createDatabase subtask in the DdlUtils - examples. - It is omitted from this example because - a Derby database gets created in the connection URL. +
  • The createDatabase subtask creates the Derby database. +
  • +
  • The writeSchemaToDatabase subtask creates the schema + from the file specified by schemaFile. +
  • +
  • The writeDataToDatabase subtask loads the data from the + specified data file.
  • @@ -435,15 +439,14 @@ import-target-db: [ddlToDatabase] Read schema file /home/jta/DerbyDb/DdlUtils/project-schema.xml -[ddlToDatabase] Mar 9, 2006 4:27:04 PM org.apache.ddlutils.platform.SqlBuilder alterDatabase +[ddlToDatabase] Created database +[ddlToDatabase] Mar 10, 2006 4:03:05 PM org.apache.ddlutils.platform.SqlBuilder alterDatabase [ddlToDatabase] INFO: Creating table AUTHOR -[ddlToDatabase] Mar 9, 2006 4:27:04 PM org.apache.ddlutils.platform.SqlBuilder alterDatabase +[ddlToDatabase] Mar 10, 2006 4:03:05 PM org.apache.ddlutils.platform.SqlBuilder alterDatabase [ddlToDatabase] INFO: Creating table BOOK -[ddlToDatabase] Mar 9, 2006 4:27:04 PM org.apache.ddlutils.platform.SqlBuilder alterDatabase +[ddlToDatabase] Mar 10, 2006 4:03:05 PM org.apache.ddlutils.platform.SqlBuilder alterDatabase [ddlToDatabase] INFO: Creating table PUBLISHER -[ddlToDatabase] Mar 9, 2006 4:27:05 PM org.apache.ddlutils.platform.PlatformImplBase evaluateBatch -[ddlToDatabase] WARNING: SQL Warning: Database 'Books2' not created, connection made to existing database instead. -[ddlToDatabase] Mar 9, 2006 4:27:05 PM org.apache.ddlutils.platform.PlatformImplBase evaluateBatch +[ddlToDatabase] Mar 10, 2006 4:03:06 PM org.apache.ddlutils.platform.PlatformImplBase evaluateBatch [ddlToDatabase] INFO: Executed 5 SQL command(s) with 0 error(s) [ddlToDatabase] Written schema to database [ddlToDatabase] Read data file /home/jta/DerbyDb/DdlUtils/data.xml @@ -451,28 +454,6 @@ BUILD SUCCESSFUL Total time: 4 seconds

    -

    Notice the warning in the output:

    - -

    [ddlToDatabase] WARNING: SQL Warning: Database 'Books2' not created, connection made to existing database instead.

    - -

    This occurs because the database url in the build.xml specifies -create=true. -DdlUtils connects to the database twice to -carry out the tasks. The first time it connects, the database is created. -The second time it connects, it detects the warning that the database already -exists. -If you want to eliminate that warning, eliminate the create=true -in the subtask: -

    -

    <database url="jdbc:derby:Books2" - driverClassName="org.apache.derby.jdbc.EmbeddedDriver" - username="" - password=""/>

    - -

    -If you remove the create=true, -be sure to manually create the database before running the Ant task. -