CN101645073A - Method for guiding prior database file into embedded type database - Google Patents
Method for guiding prior database file into embedded type database Download PDFInfo
- Publication number
- CN101645073A CN101645073A CN200910018205A CN200910018205A CN101645073A CN 101645073 A CN101645073 A CN 101645073A CN 200910018205 A CN200910018205 A CN 200910018205A CN 200910018205 A CN200910018205 A CN 200910018205A CN 101645073 A CN101645073 A CN 101645073A
- Authority
- CN
- China
- Prior art keywords
- database
- file
- data
- sqlite
- csv
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 16
- 238000006243 chemical reaction Methods 0.000 claims abstract description 10
- 230000008859 change Effects 0.000 claims description 3
- 230000008569 process Effects 0.000 abstract description 2
- 239000003814 drug Substances 0.000 description 4
- 239000000463 material Substances 0.000 description 2
- 239000002253 acid Substances 0.000 description 1
- 238000013480 data collection Methods 0.000 description 1
- 238000009795 derivation Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000008676 import Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 230000010076 replication Effects 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a method for leading the prior database file into an embedded type database, belonging to the field of the embedded type database and comprising the following steps: (1) guiding a database file of a database inside a software system or a support system of an original computer out, and simultaneously converting the database file into a file of a CSV form; (2) establishing aneeded Sqlite database and a corresponding table in a subsequent embedded type system; (3) operating a conversion program, and selecting the file to be converted and the led-in Sqlite database; (4) taking out data inside the CSV file line by line, and splitting the data into field values to generate SQL sentences to be inserted into the corresponding table of the Sqlite so as to complete conversion. The method for guiding the prior database file into the embedded type database greatly accelerates the conversion from the prior database data to the Sqlite database and ensures the accuracy of thedata in the conversion process.
Description
Technical field
The present invention relates to a kind of embedded database field, specifically a kind of method that the data with existing library file is imported embedded database.
Background technology
The increasing function of finishing enterprise real-time data collection and monitoring that combines with background server of built-in terminal.Before enterprise adopts built-in terminal, have usually and run on the software systems of PC and the database of back-up system, as Access, SqlServer, Oracle, Mysql etc.And for built-in terminal, the database volume of the last use of PC is too huge, has exceeded the load-bearing capacity of built-in terminal.
Sqlite is a light-duty database, is the correlation data base management system (DBMS) of observing ACID.The Sqlite data base management system (DBMS) has advantages such as simple, small and exquisite, quick, stable, is one of embedded database commonly used at present.Sqlite takies very low of resource, in embedded device, may only need the internal memory of hundreds of K just much of that.It can support the operating system of Windows/Linux/Unix or the like main flow, can combine with a lot of program languages simultaneously, such as Tcl, PHP, Java etc., also has the ODBC interface, compared with this two world-renowned data base management system (DBMS) of increasing income of Mysql, PostgreSQL, its processing speed is all faster than them equally.
With system upgrade or be converted to built-in terminal and during the server binding pattern, can run into and change legacy data storehouse content in the embedded database problem.Just how the part useful data of large-scale or medium database is changed over to the problem of Sqlite database.Manual typing will expend lot of manpower and material resources and time, and error rate also can be very big.
Summary of the invention
Technical assignment of the present invention provides a kind of can the quickening greatly by a kind of method that data with existing library file imported embedded database of data with existing database data to the speed of Sqlite database conversion.
Technical assignment of the present invention realizes that in the following manner concrete steps are:
(1), software systems or the data file in the database in the back-up system with original computer derives the file that also is converted to the CSV form simultaneously;
(2), in embedded system afterwards, create required Sqlite database and corresponding table;
(3), move converse routine, the Sqlite database of file that selection will be changed and importing;
(4), take out data in the csv file line by line, split out field value, generate SQL (StructuredQuery Language Structured Query Language (SQL) is used for access data and inquiry, renewal and administrative relationships Database Systems) statement, be inserted in the corresponding table of Sqlite, finish conversion.
With the software systems of the original computer of needs conversions or the file that the data file in the database in the back-up system derived and be converted to simultaneously the CSV form.
Data file in the database in the software systems of original computer or the back-up system can be changed according to client needs selectivity.
Create required Sqlite database and corresponding table, guarantee that table name is identical with the csv file name, field name is identical with CSV row first place.
CSV comma separated value file (Comma Separated value) is a kind of text-only file form that is used for storing data, is generally used for electrical form or database software.The frequently-used data base management system all directly provides the menu of data being derived position CSV form.
A kind of method with data with existing library file importing embedded database of the present invention has the following advantages:
1, accelerated greatly by the speed of data with existing database data to the conversion of Sqlite database;
2, guaranteed the accuracy of data in the transfer process;
3, can once import a plurality of tables of data.
Description of drawings
The present invention is further described below in conjunction with accompanying drawing.
Accompanying drawing 1 is a kind of program flow diagram that the data with existing library file is imported the method for embedded database.
Embodiment
Explain below with reference to Figure of description and specific embodiment a kind of method that the data with existing library file is imported embedded database of the present invention being done.
Embodiment:
A kind of method with data with existing library file importing embedded database of the present invention is implemented in medicine prison system.The original oracle database that uses of pharmaceutical factory.In medicine prison terminal acquisition system, the pharmaceutical factory information in the former database of needs, product information, material information, supplier information etc.Use this invention, existing information in the oracle database is imported in the Sqlite database.
Concrete steps are:
(1), will need the software systems of the original computer changed or the file that the data file in the oracle database in the back-up system derived and be converted to simultaneously the CSV form;
(2), in embedded system afterwards, create required Sqlite database and corresponding table; Create required Sqlite database and corresponding table, guarantee that table name is identical with the csv file name, field name is identical with CSV row first place;
(3), move converse routine, the Sqlite database of file that selection will be changed and importing;
(4), line by line take out the data in the csv file, split out field value, generate SQL statement, be inserted in the corresponding table of Sqlite, finish conversion;
(5), will change the relevant position of good Sqlite database replication to medicine prison terminal.
After converting, medicine prison terminal acquisition system just can normally have been used.
As shown in Figure 1, a kind of idiographic flow that the data with existing library file is imported the method program of embedded database of the present invention is: will need the software systems of the original computer changed or the file that the data file in the database in the back-up system derived and be converted to simultaneously the CSV form; At first read in filename (can be a plurality of), database name in Sqlite database and the corresponding table, open the file of the CSV form of original database derivation; Search for first file and whether exist, if there is no termination routine then; If exist, then open file, from the file of CSV form, read in delegation from file header, split out field value, generate SQL statement, will write down and insert database, i.e. Sqlite database; Up to end-of-file; Close file then; Search for next file and whether exist, if do not have then closing database, EOP (end of program); If file exists, then open file, repeat above step.
Except that the described technical characterictic of instructions, be the known technology of those skilled in the art.
Claims (4)
1, a kind of method with data with existing library file importing embedded database is characterized in that concrete steps are:
(1), software systems or the data file in the database in the back-up system with original computer derives the file that also is converted to the CSV form simultaneously;
(2), in embedded system afterwards, create required Sqlite database and corresponding table;
(3), move converse routine, the Sqlite database of file that selection will be changed and importing;
(4), line by line take out the data in the csv file, split out field value, generate SQL statement, be inserted in the corresponding table of Sqlite, finish conversion.
2, according to claim 1ly a kind of the data with existing library file is imported the method for embedded database, it is characterized in that the software systems of the original computer of needs conversion or the file that the data file in the database in the back-up system derived and be converted to simultaneously the CSV form.
3, according to claim 1 and 2ly a kind of the data with existing library file is imported the method for embedded database, it is characterized in that the software systems of original computer or the data file in the database in the back-up system can change according to client needs selectivity.
4, a kind of method with data with existing library file importing embedded database according to claim 1 is characterized in that creating required Sqlite database and corresponding table, guarantees that table name is identical with the csv file name, and field name is identical with CSV row first place.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN200910018205A CN101645073A (en) | 2009-08-25 | 2009-08-25 | Method for guiding prior database file into embedded type database |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN200910018205A CN101645073A (en) | 2009-08-25 | 2009-08-25 | Method for guiding prior database file into embedded type database |
Publications (1)
Publication Number | Publication Date |
---|---|
CN101645073A true CN101645073A (en) | 2010-02-10 |
Family
ID=41656961
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN200910018205A Pending CN101645073A (en) | 2009-08-25 | 2009-08-25 | Method for guiding prior database file into embedded type database |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101645073A (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101968794A (en) * | 2010-09-02 | 2011-02-09 | 四川长虹电器股份有限公司 | Method for transforming between embedded database and PC database |
CN104408150A (en) * | 2014-12-03 | 2015-03-11 | 天津南大通用数据技术股份有限公司 | Data import/ export method and device adapted to a plurality of data formats of databases |
CN104657123A (en) * | 2013-11-21 | 2015-05-27 | 航天信息股份有限公司 | Method for dynamically exporting files |
CN105868402A (en) * | 2016-04-20 | 2016-08-17 | 中国商用飞机有限责任公司 | Aircraft maintenance quality analysis oriented QAR (quick access recorder) data preprocessing method and device |
CN106649310A (en) * | 2015-10-29 | 2017-05-10 | 北京国双科技有限公司 | Data acquisition method and device |
CN106649449A (en) * | 2016-09-22 | 2017-05-10 | 济南浪潮高新科技投资发展有限公司 | Internal and external network data exchange method based on SQLite |
CN110019226A (en) * | 2017-12-22 | 2019-07-16 | 杭州海康威视数字技术股份有限公司 | A kind of introduction method and device of database file |
-
2009
- 2009-08-25 CN CN200910018205A patent/CN101645073A/en active Pending
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101968794A (en) * | 2010-09-02 | 2011-02-09 | 四川长虹电器股份有限公司 | Method for transforming between embedded database and PC database |
CN104657123A (en) * | 2013-11-21 | 2015-05-27 | 航天信息股份有限公司 | Method for dynamically exporting files |
CN104657123B (en) * | 2013-11-21 | 2018-09-11 | 航天信息股份有限公司 | A kind of method of dynamic export |
CN104408150A (en) * | 2014-12-03 | 2015-03-11 | 天津南大通用数据技术股份有限公司 | Data import/ export method and device adapted to a plurality of data formats of databases |
CN106649310A (en) * | 2015-10-29 | 2017-05-10 | 北京国双科技有限公司 | Data acquisition method and device |
CN106649310B (en) * | 2015-10-29 | 2020-04-24 | 北京国双科技有限公司 | Data acquisition method and device |
CN105868402A (en) * | 2016-04-20 | 2016-08-17 | 中国商用飞机有限责任公司 | Aircraft maintenance quality analysis oriented QAR (quick access recorder) data preprocessing method and device |
CN106649449A (en) * | 2016-09-22 | 2017-05-10 | 济南浪潮高新科技投资发展有限公司 | Internal and external network data exchange method based on SQLite |
CN110019226A (en) * | 2017-12-22 | 2019-07-16 | 杭州海康威视数字技术股份有限公司 | A kind of introduction method and device of database file |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10176208B2 (en) | Processing time series data from multiple sensors | |
CN104899295B (en) | A kind of heterogeneous data source data relation analysis method | |
CN101719149B (en) | Data synchronization method and device | |
CN101645073A (en) | Method for guiding prior database file into embedded type database | |
CN111324610A (en) | Data synchronization method and device | |
CN101405728B (en) | Relational database architecture with dynamic load capability | |
CN110795499B (en) | Cluster data synchronization method, device, equipment and storage medium based on big data | |
CN104599032A (en) | Distributed memory power grid construction method and system for resource management | |
CN104615736A (en) | Quick analysis and storage method of big data based on database | |
CN105608126A (en) | Method and apparatus for establishing secondary indexes for massive databases | |
EP2897401B1 (en) | Method and device for guaranteeing consistency of planning data | |
CN106970929A (en) | Data lead-in method and device | |
CN105138685A (en) | HBase-oriented performance testing system | |
CN106919697B (en) | Method for simultaneously importing data into multiple Hadoop assemblies | |
CN111858760A (en) | Data processing method and device for heterogeneous database | |
CN113177090A (en) | Data processing method and device | |
CN105760505A (en) | Hive-based historical data analysis and archiving method | |
CN107798120B (en) | Data conversion method and device | |
CN105005572A (en) | Database mapping method and device | |
CN114416868B (en) | Data synchronization method, device, equipment and storage medium | |
CN105528381A (en) | Database data migration method and system | |
CN103440302B (en) | The method and system of Real Data Exchangs | |
CN108763323A (en) | Meteorological lattice point file application process based on resource set and big data technology | |
EP2904520B1 (en) | Reference data segmentation from single to multiple tables | |
CN113010542A (en) | Service data processing method and device, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C02 | Deemed withdrawal of patent application after publication (patent law 2001) | ||
WD01 | Invention patent application deemed withdrawn after publication |
Open date: 20100210 |