1. Foreword
At present, many unit mis systems in our country are built on PC or novellnetware LAN environment, database and development tools adopt Foxpro2.5 for DOS or FoxPro 2.5 for Windows, DBF file as data organization management means, With the continuous expansion of the system and the actual application needs, many units have begun to adopt a large database Oracle. In the process of upgrading the MIS from FoxPro to a large database Oracle, it is very important to load the FoxPro DBF file into the Oracle database through Oracle Tools Sql*loader. The specific implementation steps for general Sql*loader loading are:
* Run FoxPro, open the database, and copy the DBF file as a text file in SDF format
* Create an Oracle table (createtable) SQL statement based on the DBF file structure
* Log in to Oracle to run SQL statements that produce Oracle tables (createtable)
* Generate Sql*loader control files according to DBF file structure
* Run Sql*loader, load data
Using manual method to generate CreateTable SQL statements, especially when generating sql*loader control files, the position start and end positions are often mistaken, and when a large amount of data is required to load,
Not only cumbersome, but also low efficiency. In practice, we use borlandc++5.0 to develop a C + + utility program Load.cpp to automatically generate Sql*loader data files, control files and production
A SQL statement that createtable. Using load, we just:
* load< Database name >
* Log in to Oracle to run SQL statements that produce Oracle tables (createtable)
* Run Sql*loader, load data
In practice, we improve the efficiency of the data loading process of the Client/server platform from FoxPro to oraclefordigitalunix+ Chinese Windows95 through this method.
2.Foxpro Medium DBF file structure
The DBF file consists of a file header and a file record, where the file header is composed of a database description and a field description. The database description consists of 32 bytes, each byte meaning as follows:
byte meaning
0 Database File Flags have Memo-type fields (03H none)
1-3 Last Modified Date
4-7 Number of file records
8-9 file head length
10-11 record length
12-31 not used
The field description consists of several 32 bytes, one field per 32 byte, each byte meaning as follows:
byte meaning
0-10 Field Name
11 Field type
12-15 the address of the field in the first record of the file
16 Field length
17 Number of decimal places
18-31 not used
File records are stored in ASCII form, with each record beginning with a space (20H), which is used for deletion flags.
Three
"Note":
* No integrity constraints are considered, and default values are taken for tablespace and storage storage parameters.
* For numeric fields, n indicates the width of the number and contains the decimal point position in the FoxPro, which is not included in Oracle.
* For foxprological Type field types, because there is no corresponding logical variable in Oracle, it is converted to a character type.
* Do not consider the memo, general, picture field conversion.