Populating the Zoo Database with Data (Optional)

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Tutorials > "ZooDB" Database > Inserting Data into the Database >

Populating the Zoo Database with Data (Optional)

In the previous steps of this tutorial, you have imported data into the database from a text file (see Importing Data from TXT Files ) as well as from an XML file (see Importing Data from XML Files).

 

Optionally, you can also import data from several text or XML files available in the \Altova\DatabaseSpy2019\DatabaseSpyExamples\Tutorial sub-folder of the Documents folder. In this case, make sure to import files in the order shown below, to avoid problems with foreign key relationships.

 

Text files

XML files

1.tblZookeepers.txt
2.tblFeedSuppliers.txt
3.tblAnimalFeed.txt
4.tblFeedingSchedules.txt
5.tblAnimals.txt
6.tblVeterinarians.txt
7.tblAnimalBirths.txt
8.tblMedicalTreatments.txt
1.dbo.tblZookeepers.xml
2.dbo.tblFeedSuppliers.xml
3.dbo.tblAnimalFeed.xml
4.dbo.tblFeedingSchedules.xml
5.dbo.tblAnimals.xml
6.dbo.tblVeterinarians.xml
7.dbo.tblAnimalBirths.xml
8.dbo.tblMedicalTreatments.xml

 

Note that, for the import of all these files to succeed, the foreign key values defined in the source file (text or XML) must exist in the target database tables. If any of the import operations fails due to any reason (for example, due to data already present in the database tables), it is likely that other subsequent imports will fail. In this case, it is recommended to perform the import against a fresh copy of the database.

 

 

To set up a fresh copy of the ZooDB database:

1.Create a new database (see Creating the Tutorial Database ).
2.Using the SQL Editor, run the following two scripts against it:
ocreate_ZooDB_tables.sql
ocreate_ZooDB_relationships.sql

© 2019 Altova GmbH