db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1179786 - in /db/derby/code/trunk/java/demo/toursdb: build.xml disconnect.sql insertMaps.java toursdb.xml
Date Thu, 06 Oct 2011 19:41:14 GMT
Author: kahatlen
Date: Thu Oct  6 19:41:13 2011
New Revision: 1179786

URL: http://svn.apache.org/viewvc?rev=1179786&view=rev
Log:
DERBY-5437: Load all toursdb tables in one invocation of ij

- Execute all scripts in a single invocation of ij.

- Make toursdb.insertMaps shut down the database cleanly so that a
  final invocation of ij to perform recovery and clean the logs isn't
  necessary.

Removed:
    db/derby/code/trunk/java/demo/toursdb/disconnect.sql
Modified:
    db/derby/code/trunk/java/demo/toursdb/build.xml
    db/derby/code/trunk/java/demo/toursdb/insertMaps.java
    db/derby/code/trunk/java/demo/toursdb/toursdb.xml

Modified: db/derby/code/trunk/java/demo/toursdb/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/toursdb/build.xml?rev=1179786&r1=1179785&r2=1179786&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/toursdb/build.xml (original)
+++ db/derby/code/trunk/java/demo/toursdb/build.xml Thu Oct  6 19:41:13 2011
@@ -34,7 +34,7 @@
 
 <!-- Targets -->
 
-  <target name="toursdb" depends="compile,buildschema,loadtables,jarup,copyfiles"/>
+  <target name="toursdb" depends="compile,builddb,jarup,copyfiles"/>
 
   <target name="compile">
     <javac
@@ -56,35 +56,17 @@
     </javac>
   </target>
 
-  <target name="buildschema">
+  <target name="builddb">
     <echo level="info" message="Begin building toursdb"/>
+    <echo file="${generated.toursdb.dir}/build_toursdb.sql">
+      run 'ToursDB_schema.sql';
+      run 'loadTables.sql';
+      -- ToursDB_schema.sql turns autocommit off, so commit now.
+      commit;
+    </echo>
     <antcall target="runijscript">
-      <param name="script.name" value="ToursDB_schema.sql"/>
-    </antcall>
-  </target>
-
-  <target name="loadtables">
-    <echo level="info" message="Begin loading toursdb"/>
-    <antcall target="runijscript">
-      <param name="script.name" value="loadCOUNTRIES.sql"/>
-    </antcall>
-    <antcall target="runijscript">
-      <param name="script.name" value="loadCITIES.sql"/>
-    </antcall>
-    <antcall target="runijscript">
-      <param name="script.name" value="loadAIRLINES.sql"/>
-    </antcall>
-    <antcall target="runijscript">
-      <param name="script.name" value="loadFLIGHTS1.sql"/>
-    </antcall>
-    <antcall target="runijscript">
-      <param name="script.name" value="loadFLIGHTS2.sql"/>
-    </antcall>
-    <antcall target="runijscript">
-      <param name="script.name" value="loadFLIGHTAVAILABILITY1.sql"/>
-    </antcall>
-    <antcall target="runijscript">
-      <param name="script.name" value="loadFLIGHTAVAILABILITY2.sql"/>
+      <param name="script.name"
+             value="${generated.toursdb.dir}/build_toursdb.sql"/>
     </antcall>
     <java classname="toursdb.insertMaps"
           output="${generated.toursdb.dir}/toursdb.out" append="true"
@@ -96,16 +78,6 @@
       </classpath>
       <sysproperty key="derby.system.home" value="${generated.toursdb.dir}"/>
     </java>
-    <java classname="org.apache.derby.tools.ij"
-          output="${generated.toursdb.dir}/toursdb.out" append="true"
-          failonerror="true"
-          dir="${generated.toursdb.dir}" fork="true">
-      <classpath>
-        <pathelement path="${out.dir}"/>
-        <pathelement path="${compile.classpath}"/>
-      </classpath>
-      <arg value="${derby.demo.src.dir}/toursdb/disconnect.sql"/>
-    </java>
   </target>
 
   <target name="runijscript">
@@ -114,14 +86,15 @@
           output="${generated.toursdb.dir}/toursdb.out"
           append="true"
           failonerror="true"
-          dir="${generated.toursdb.dir}" fork="true">
+          dir="${derby.demo.src.dir}/toursdb" fork="true">
       <classpath>
         <pathelement path="${out.dir}"/>
         <pathelement path="${compile.classpath}"/>
       </classpath>
+      <sysproperty key="derby.system.home" value="${generated.toursdb.dir}"/>
       <sysproperty key="ij.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
       <sysproperty key="ij.database" value="jdbc:derby:toursdb;create=true"/>
-      <arg value="${derby.demo.src.dir}/toursdb/${script.name}"/>
+      <arg value="${script.name}"/>
     </java>
   </target>
 

Modified: db/derby/code/trunk/java/demo/toursdb/insertMaps.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/toursdb/insertMaps.java?rev=1179786&r1=1179785&r2=1179786&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/toursdb/insertMaps.java (original)
+++ db/derby/code/trunk/java/demo/toursdb/insertMaps.java Thu Oct  6 19:41:13 2011
@@ -52,6 +52,17 @@ public class insertMaps {
 						   " rows into the ToursDB");
 
 		connCS.close();
+
+		// Shut down the database cleanly before exiting.
+		try {
+			DriverManager.getConnection(dbURLCS + ";shutdown=true");
+		} catch (SQLException sqle) {
+			// Database shutdown is expected to raise SQLState 08006.
+			// Report any other exception.
+			if (!"08006".equals(sqle.getSQLState())) {
+				throw sqle;
+			}
+		}
 	}
 	
 	public static int insertRows(String path, Connection conn) 

Modified: db/derby/code/trunk/java/demo/toursdb/toursdb.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/toursdb/toursdb.xml?rev=1179786&r1=1179785&r2=1179786&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/toursdb/toursdb.xml (original)
+++ db/derby/code/trunk/java/demo/toursdb/toursdb.xml Thu Oct  6 19:41:13 2011
@@ -70,16 +70,6 @@
         <pathelement path=".."/>
       </classpath>
     </java>
-    <java classname="org.apache.derby.tools.ij"
-          output="toursdb.out" append="true"
-          failonerror="true"
-          dir="." fork="true">
-      <classpath>
-        <pathelement path="${lib.dir}/derby.jar"/>
-        <pathelement path="${lib.dir}/derbytools.jar"/>
-      </classpath>
-      <arg value="disconnect.sql"/>
-    </java>
   </target>
 
   <target name="jarup"> 



Mime
View raw message