xml spy
Previous  Top  Next
Converting a database to a schema

To create a schema from a database file:
1.Select the menu option Convert | Create Database Schema.  

tut_67a  

2.Select Microsoft Access database, and click the Choose file button.  
3.Select the DB2schema.mdb file supplied with XML Spy, and click the Open button.  
4.Click the OK button of the Create Database Schema dialog, to start the conversion process.  

The generated schema appears in the Schema Design View. Click the "Identity constraints" tab, to see the keyref and key fields of the respective elements.  

tut_67b  

5.Click the component icon ic_schem_part next to the Altova global element, to see the content model.  

tut_68aa  

6.Select the menu option File | Save as, and save the new schema e.g. DB2schema.xsd.  
7.Click the Display all globals icon ic_back2global, to return to the schema overview.  

Please note:  
When generating the schema, all namespace prefix colons are automatically converted into underscore characters.  
 
Databases currently supporting the key and keyref fields:
MS Access and several other databases are able to automatically provide the key and keyref information for the ADO driver, used to create the database hierarchy.

Please note:  
The following text describes in condensed form, how to create a database schema using other types of databases. This text is added for the sake of completeness, and is not a tutorial task. Please contact your database administrator for further information regarding the setup and use of these databases!  

To create relationships for NON MS Access databases:
1.Click the "ADO connection string" radio button in the Create Database Schema dialog box.  

tut_68a  

2.Click the Build button that has now become active.  
This opens the Data Link Properties dialog box.  
3.Select the corresponding Microsoft OLE DB Provider (or vendor specific provider) for the database you use, do not select one of the generic drivers. Please see the "To convert from..." list at the end of this section.  

tut_68b  

4.Click the Next button to switch to the Connection tab and fill in the required information: the data source, the user name and password, and activate the Allow saving password check box.  
5.Click the Test Connection button to test the connection, and Click OK to confirm the settings.  

tut_68c  

6.Click OK in the Create Database Schema dialog box, to create the schema.  

To convert from... SQL server databases:

·Select the Microsoft OLE DB provider for SQL server provider.  

To convert from Oracle... databases:

·Select the Microsoft OLE DB provider for Oracle provider.  

To convert from... MS Access:

·Click the Microsoft Access Database radio button in the Create Database Schema dialog box. This selects the correct provider, there is no need to use the ADO connection string and Data Link Properties dialog box.  
·If however, you want to build the connection string yourself, please use the MicrosoftJet 4.0 OLE DB provider.  

To convert from... Other databases:
·Select the corresponding Microsoft OLE DB, or vendor specific provider, from the Data Link Properties dialog box.  

To convert from... databases without a specific provider:
Other databases will create a flat structured schema, including all tables and their corresponding datatypes.

·Use drag and drop in the schema overview, to create the necessary relations between the imported elements.  
·To create an element hierarchy you have to directly edit the key and keyref fields, visible in the Identity constraints tab. Please see "Creating Identity Constraints" in the Reference manual for more information.  



Previous  Top  Next

© 2002 Altova