CN112905567A - Database replacement method, device, system and medium based on network protocol conversion - Google Patents

Database replacement method, device, system and medium based on network protocol conversion Download PDF

Info

Publication number
CN112905567A
CN112905567A CN202110310836.1A CN202110310836A CN112905567A CN 112905567 A CN112905567 A CN 112905567A CN 202110310836 A CN202110310836 A CN 202110310836A CN 112905567 A CN112905567 A CN 112905567A
Authority
CN
China
Prior art keywords
network protocol
database
protocol packet
conversion
packet
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.)
Granted
Application number
CN202110310836.1A
Other languages
Chinese (zh)
Other versions
CN112905567B (en
Inventor
李建辉
李春
陈栋
罗春
魏兴华
张文件
吴炎
臧冰凌
杨禹航
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Woqu Technology Co ltd
Original Assignee
Hangzhou Woqu Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Hangzhou Woqu Technology Co ltd filed Critical Hangzhou Woqu Technology Co ltd
Priority to CN202110310836.1A priority Critical patent/CN112905567B/en
Publication of CN112905567A publication Critical patent/CN112905567A/en
Application granted granted Critical
Publication of CN112905567B publication Critical patent/CN112905567B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/214Database migration support
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/08Protocols for interworking; Protocol conversion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computer And Data Communications (AREA)
  • Communication Control (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention relates to a database replacement method, a device, a system and a medium based on network protocol conversion, wherein the replacement method comprises the following steps: acquiring a first network protocol packet corresponding to a service access request from an application program, wherein the first network protocol packet is adapted to an original database; converting the first network protocol packet into a second network protocol packet, wherein the first network protocol packet is matched with the replaced database; receiving an access feedback result of the replaced database based on the second network protocol packet to form a third network protocol packet; converting the third network protocol packet into a fourth network protocol packet, wherein the fourth network protocol packet is matched with the original database; and analyzing the fourth network protocol packet. Compared with the prior art, the method and the system can realize the replacement of the database under the condition of zero modification or small modification of the service.

Description

Database replacement method, device, system and medium based on network protocol conversion
Technical Field
The present invention relates to the field of database and protocol conversion technologies, and in particular, to a method, an apparatus, a system, and a medium for database replacement based on network protocol conversion.
Background
The business programming determines which database to use, and certain database-specific functions or features are used to ensure efficiency and performance. Under the current new distributed architecture, business programs and databases are generally distributed on multiple servers. The business program calls a driver provided by the database to request the database service through the network. For example, a business may utilize MySQL's official JDBC to drive MySQL Connector/J to access the MySQL server. As businesses iterate and evolve, the business' dependence on a database, particularly a particular database, becomes stronger, resulting in being completely "kidnapped" by the database. The authorization cost of the database is too high, the support of the original database manufacturer is weakened, or due to policy reasons, a business needs to be modified greatly, even reconstructed or rewritten if a customer wants to migrate from the database.
However, if the database replacement is implemented by making a large number of modifications to the service, it is easy to make mistakes in the replacement process, and even because of the iteration of the developer or the system being out of date, the developer has no ability to make database modifications to the service.
The prior patent application CN111125218A discloses a database compatibility method based on protocol analysis, in which a compatibility proxy device is arranged between a client requesting a database and a server requesting a database, and receives a request from the client and a protocol packet requesting the database, and performs analysis, and assembly, and sends the result to the server; and the compatibility agent device receives the returned data of the server side of the target database and the database protocol packet, analyzes and assembles the returned data and the database protocol packet, and returns the analyzed and assembled data to the client side requesting the database. The method realizes database compatibility to a certain extent, but a new device is added, and the code needs to be modified again.
Disclosure of Invention
The present invention aims to overcome the defects of the prior art and provide a database replacement method, device, system and medium based on network protocol conversion, which can conveniently and quickly realize the replacement of different databases on the basis of not modifying service data.
The purpose of the invention can be realized by the following technical scheme:
a database replacement method based on network protocol conversion comprises the following steps:
acquiring a first network protocol packet corresponding to a service access request from an application program, wherein the first network protocol packet is adapted to an original database;
converting the first network protocol packet into a second network protocol packet, wherein the first network protocol packet is matched with the replaced database;
receiving an access feedback result of the replaced database based on the second network protocol packet to form a third network protocol packet;
converting the third network protocol packet into a fourth network protocol packet, wherein the fourth network protocol packet is matched with the original database;
and analyzing the fourth network protocol packet.
Further, converting the first network protocol packet into a second network protocol packet specifically includes: and analyzing the first network protocol packet to obtain a request of the application program to the database, packaging the request to form the second network protocol packet, and sending the second network protocol packet to the replaced database.
Further, the request to the database carries the application program identification and the access type information.
Further, converting the third network protocol packet into a fourth network protocol packet specifically includes: and analyzing a returned result set of the third network protocol packet, encapsulating the result set to form the fourth network protocol packet, and returning the fourth network protocol packet to the application program.
The invention also provides a database replacing device based on network protocol conversion, which comprises:
the acquisition module is used for acquiring a first network protocol packet corresponding to a service access request from an application program, and the first network protocol packet is matched with an original database;
the first conversion module is used for converting the first network protocol packet into a second network protocol packet, and the first network protocol packet is matched with the replaced database;
the result receiving module is used for receiving the access feedback result of the replaced database based on the second network protocol packet to form a third network protocol packet;
the second conversion module is used for converting the third network protocol packet into a fourth network protocol packet, and the fourth network protocol packet is matched with the original database;
and the analysis module is used for analyzing the fourth network protocol packet.
Further, in the first conversion module, the first network protocol packet is analyzed to obtain a request of the application program to the database, the request is encapsulated to form the second network protocol packet, and the second network protocol packet is sent to the replaced database.
Further, the request to the database carries the application program identification and the access type information.
Further, in the second conversion module, a result set of the returned third network protocol packet is analyzed, and the result set is encapsulated to form the fourth network protocol packet and returned to the application program.
The invention also provides a database access system, which comprises a network protocol conversion server, a service program client, a first database and a second database, wherein the service program client is connected to the first database or the second database through the network protocol conversion server, and the network protocol conversion server controls the service program client to be replaced and accessed from the first database to the second database or replaced and accessed from the second database to the first database by adopting the database replacement method based on network protocol conversion.
The present invention also provides a computer readable storage medium comprising one or more programs for execution by one or more processors of an electronic device, the one or more programs including instructions for performing the network protocol conversion based database replacement method as described above.
Compared with the prior art, the invention has the following beneficial effects:
1. the invention realizes the replacement of the access of the bottom database by converting the received access request and the corresponding network protocol packet, can effectively solve the problem of replacing the bottom database under the condition that the service code is not modified, and is suitable for the service scene which is not bound by a certain specific database.
2. The invention only needs to analyze and repackage the network protocol packet, has high database replacement efficiency and can be realized without adding new equipment.
Drawings
FIG. 1 is a schematic flow chart of the present invention.
Detailed Description
The invention is described in detail below with reference to the figures and specific embodiments. The present embodiment is implemented on the premise of the technical solution of the present invention, and a detailed implementation manner and a specific operation process are given, but the scope of the present invention is not limited to the following embodiments.
Example 1
Referring to fig. 1, the present embodiment provides a database replacement method based on network protocol conversion, including the following steps:
acquiring a first network protocol packet corresponding to a service access request from an application program, wherein the first network protocol packet is adapted to an original database;
converting the first network protocol packet into a second network protocol packet, specifically, analyzing the first network protocol packet to obtain a request of an application program to a database, encapsulating the request to form the second network protocol packet, and sending the second network protocol packet to a replaced database, wherein the first network protocol packet is adapted to the replaced database, and the request to the database carries an application program identifier and access type information;
receiving an access feedback result of the replaced database based on the second network protocol packet to form a third network protocol packet;
converting the third network protocol packet into a fourth network protocol packet, specifically, analyzing a result set of the returned third network protocol packet, encapsulating the result set to form the fourth network protocol packet, and returning the fourth network protocol packet to the application program, wherein the fourth network protocol packet is adapted to the original database;
and analyzing the fourth network protocol packet.
Service access to a database is achieved by invoking a driver for the database. When the service of the database is required to be requested by the service, the interface provided by the database driver is called to initiate a request, the request is analyzed into a fixed network protocol packet in the driver, and the fixed network protocol packet is sent to a specified database server through the network interface provided by the operating system. The database server receives the network protocol packet sent by the operating system, confirms the request and the authority, executes the corresponding action and returns the result to the database driver, and the database driver returns the result to the service program after analyzing the result. The method realizes the database replacement by converting the intermediate network protocol packet, and realizes the purpose of replacing the database under the condition of zero modification of the service.
The above functions, if implemented in the form of software functional units and sold or used as a separate product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Example 2
The embodiment provides a database replacing device based on network protocol conversion, which comprises an acquisition module, a first conversion module, a result receiving module, a second conversion module and an analysis module, wherein the acquisition module is used for acquiring a first network protocol packet corresponding to a service access request from an application program, and the first network protocol packet is matched with an original database; the first conversion module is used for converting the first network protocol packet into a second network protocol packet, and the first network protocol packet is matched with the replaced database; the result receiving module is used for receiving the access feedback result of the replaced database based on the second network protocol packet to form a third network protocol packet; the second conversion module is used for converting the third network protocol packet into a fourth network protocol packet, and the fourth network protocol packet is matched with the original database; and the analysis module is used for analyzing the fourth network protocol packet. The rest is the same as example 1.
Example 3
The present embodiment provides a database access system, which includes a network protocol conversion server P (proxy), a service program client M, a first database a, and a second database B, where the service program client M is connected to the first database a or the second database B through the network protocol conversion server P, and the network protocol conversion server P controls the service program client M to be changed from the first database a to the second database B or from the second database B to the first database a by using the database change method based on network protocol conversion as described above.
Referring to fig. 1, when the service program client M schedules the driver of the database a and sends a network protocol packet a, P receives the network protocol packet a. Through internal conversion, the P reversely analyzes the network protocol of the access request to the database A, modifies the network protocol packet a into a network protocol packet B which can be analyzed by the database B, and forwards the network protocol packet B to the database B. When the database B executes and returns a result as a network protocol packet x, P receives the network protocol packet x, performs inverse analysis to convert the network protocol packet x into a network protocol packet y which can be received by a database A driver, and sends the network protocol packet y to a database driver of a service program, and after receiving the network protocol packet y, the database driver analyzes and returns the result to the service program. For the service program, the service program does not know whether the back end is a database or a middleware, the new database B can be accessed by adopting the drive of the original database A, the request of the service program is completely converted into the service provided by the database B, and the aim of replacing the database under the condition of zero modification of the service is fulfilled.
The foregoing detailed description of the preferred embodiments of the invention has been presented. It should be understood that numerous modifications and variations could be devised by those skilled in the art in light of the present teachings without departing from the inventive concepts. Therefore, the technical solutions available to those skilled in the art through logic analysis, reasoning and limited experiments based on the prior art according to the concept of the present invention should be within the scope of protection defined by the claims.

Claims (10)

1. A database replacement method based on network protocol conversion is characterized by comprising the following steps:
acquiring a first network protocol packet corresponding to a service access request from an application program, wherein the first network protocol packet is adapted to an original database;
converting the first network protocol packet into a second network protocol packet, wherein the first network protocol packet is matched with the replaced database;
receiving an access feedback result of the replaced database based on the second network protocol packet to form a third network protocol packet;
converting the third network protocol packet into a fourth network protocol packet, wherein the fourth network protocol packet is matched with the original database;
and analyzing the fourth network protocol packet.
2. The database replacement method based on network protocol conversion according to claim 1, wherein converting the first network protocol packet into the second network protocol packet specifically comprises: and analyzing the first network protocol packet to obtain a request of the application program to the database, packaging the request to form the second network protocol packet, and sending the second network protocol packet to the replaced database.
3. The method according to claim 2, wherein the request for the database carries an application identifier and access type information.
4. The database replacement method based on network protocol conversion according to claim 1, wherein converting the third network protocol packet into the fourth network protocol packet specifically comprises: and analyzing a returned result set of the third network protocol packet, encapsulating the result set to form the fourth network protocol packet, and returning the fourth network protocol packet to the application program.
5. A database replacing apparatus based on network protocol conversion, comprising:
the acquisition module is used for acquiring a first network protocol packet corresponding to a service access request from an application program, and the first network protocol packet is matched with an original database;
the first conversion module is used for converting the first network protocol packet into a second network protocol packet, and the first network protocol packet is matched with the replaced database;
the result receiving module is used for receiving the access feedback result of the replaced database based on the second network protocol packet to form a third network protocol packet;
the second conversion module is used for converting the third network protocol packet into a fourth network protocol packet, and the fourth network protocol packet is matched with the original database;
and the analysis module is used for analyzing the fourth network protocol packet.
6. The device of claim 5, wherein the first conversion module parses a request of the first network protocol packet acquisition application program for the database, encapsulates the request into the second network protocol packet, and sends the second network protocol packet to the database after the change.
7. The network protocol conversion based database exchange device according to claim 6, wherein the request for the database carries an application identifier and access type information.
8. The apparatus according to claim 5, wherein the second conversion module parses a result set of the returned third network protocol packet, encapsulates the result set to form the fourth network protocol packet, and returns the fourth network protocol packet to the application.
9. A database access system, comprising a network protocol conversion server, a service program client, a first database and a second database, wherein the service program client is connected to the first database or the second database through the network protocol conversion server, and the network protocol conversion server controls the service program client to change access from the first database to the second database or from the second database to the first database by using the database change method based on network protocol conversion as claimed in any one of claims 1 to 4.
10. A computer-readable storage medium comprising one or more programs for execution by one or more processors of an electronic device, the one or more programs including instructions for performing the network protocol conversion based database replacement method of any of claims 1-4.
CN202110310836.1A 2021-03-23 2021-03-23 Database replacement method, device, system and medium based on network protocol conversion Active CN112905567B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110310836.1A CN112905567B (en) 2021-03-23 2021-03-23 Database replacement method, device, system and medium based on network protocol conversion

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110310836.1A CN112905567B (en) 2021-03-23 2021-03-23 Database replacement method, device, system and medium based on network protocol conversion

Publications (2)

Publication Number Publication Date
CN112905567A true CN112905567A (en) 2021-06-04
CN112905567B CN112905567B (en) 2023-04-07

Family

ID=76106137

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110310836.1A Active CN112905567B (en) 2021-03-23 2021-03-23 Database replacement method, device, system and medium based on network protocol conversion

Country Status (1)

Country Link
CN (1) CN112905567B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115062092A (en) * 2022-08-10 2022-09-16 阿里云计算有限公司 Database access method, device, system and storage medium
CN115174452A (en) * 2022-07-01 2022-10-11 天津神舟通用数据技术有限公司 Application migration method based on Oracle database protocol proxy
CN115174452B (en) * 2022-07-01 2024-05-31 天津神舟通用数据技术有限公司 Application transplanting method based on Oracle database protocol proxy

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030061205A1 (en) * 2001-09-27 2003-03-27 Cleghorn Monica Rose System and method for processing database queries
US20030187816A1 (en) * 2002-03-27 2003-10-02 Jardin Cary A. System and method for transparent database conversion
US20090307230A1 (en) * 2006-11-06 2009-12-10 Kenichiro Fujiyama Computer system, database access method, application server, and program
US20100094838A1 (en) * 2008-10-10 2010-04-15 Ants Software Inc. Compatibility Server for Database Rehosting
CN106933869A (en) * 2015-12-30 2017-07-07 北京京东尚科信息技术有限公司 A kind of method and apparatus of operating database
CN108629035A (en) * 2018-05-10 2018-10-09 福建星瑞格软件有限公司 A kind of heterogeneous database application moving method based on JDBC agencies
CN109766352A (en) * 2018-11-19 2019-05-17 成都四方伟业软件股份有限公司 The method and system that a kind of pair of heterogeneous data source is uniformly processed
CN111061757A (en) * 2019-12-19 2020-04-24 用友网络科技股份有限公司 Database language conversion method and device, electronic equipment and storage medium
CN111125218A (en) * 2019-12-13 2020-05-08 成都安恒信息技术有限公司 Database compatibility method based on protocol analysis and compatibility proxy device thereof
CN111581231A (en) * 2020-04-20 2020-08-25 北京明略软件系统有限公司 Query method and device based on heterogeneous database
CN111767299A (en) * 2019-12-18 2020-10-13 北京沃东天骏信息技术有限公司 Database operation method, device and system, storage medium and electronic equipment
CN112417024A (en) * 2020-12-11 2021-02-26 中国建设银行股份有限公司 Method and device for quickly adapting database script, computer equipment and storage medium

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030061205A1 (en) * 2001-09-27 2003-03-27 Cleghorn Monica Rose System and method for processing database queries
US20030187816A1 (en) * 2002-03-27 2003-10-02 Jardin Cary A. System and method for transparent database conversion
US20090307230A1 (en) * 2006-11-06 2009-12-10 Kenichiro Fujiyama Computer system, database access method, application server, and program
US20100094838A1 (en) * 2008-10-10 2010-04-15 Ants Software Inc. Compatibility Server for Database Rehosting
CN106933869A (en) * 2015-12-30 2017-07-07 北京京东尚科信息技术有限公司 A kind of method and apparatus of operating database
CN108629035A (en) * 2018-05-10 2018-10-09 福建星瑞格软件有限公司 A kind of heterogeneous database application moving method based on JDBC agencies
CN109766352A (en) * 2018-11-19 2019-05-17 成都四方伟业软件股份有限公司 The method and system that a kind of pair of heterogeneous data source is uniformly processed
CN111125218A (en) * 2019-12-13 2020-05-08 成都安恒信息技术有限公司 Database compatibility method based on protocol analysis and compatibility proxy device thereof
CN111767299A (en) * 2019-12-18 2020-10-13 北京沃东天骏信息技术有限公司 Database operation method, device and system, storage medium and electronic equipment
CN111061757A (en) * 2019-12-19 2020-04-24 用友网络科技股份有限公司 Database language conversion method and device, electronic equipment and storage medium
CN111581231A (en) * 2020-04-20 2020-08-25 北京明略软件系统有限公司 Query method and device based on heterogeneous database
CN112417024A (en) * 2020-12-11 2021-02-26 中国建设银行股份有限公司 Method and device for quickly adapting database script, computer equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115174452A (en) * 2022-07-01 2022-10-11 天津神舟通用数据技术有限公司 Application migration method based on Oracle database protocol proxy
CN115174452B (en) * 2022-07-01 2024-05-31 天津神舟通用数据技术有限公司 Application transplanting method based on Oracle database protocol proxy
CN115062092A (en) * 2022-08-10 2022-09-16 阿里云计算有限公司 Database access method, device, system and storage medium
CN115062092B (en) * 2022-08-10 2023-02-03 阿里云计算有限公司 Database access method, device, system and storage medium

Also Published As

Publication number Publication date
CN112905567B (en) 2023-04-07

Similar Documents

Publication Publication Date Title
CN108509392B (en) Multi-mechanism account checking method, system, computer equipment and storage medium
CN103546532B (en) A kind of method and system of Application share data
CN105681113A (en) Automatic operation and maintenance method based on SaltStack
CN113067866B (en) Batch file transmission method and device between heterogeneous systems
CN112905567B (en) Database replacement method, device, system and medium based on network protocol conversion
CN112511591A (en) Method, device, equipment and medium for realizing hospital interface data interaction
CN105141653A (en) Method, equipment and system for data interaction of service platform
CA2729314C (en) A method of performing data mediation, and an associated computer program product, data mediation device and information system
EP2224381A1 (en) Method and apparatus for case-based service composition
CN110620819B (en) Block chain interaction method and device, computer equipment and readable storage medium
CN110740464A (en) NF service discovery method and device
CN113760562A (en) Link tracking method, device, system, server and storage medium
CN112100260A (en) Interface engine-based multi-application data fusion method and system
CN109286666A (en) A kind of scheduling request processing method, correlation technique and the relevant apparatus of cloud platform
CN114139093A (en) Data communication method, equipment and medium
CN112565194A (en) Transaction link tracking method, electronic device and storage medium
CN113543049B (en) Information processing method and device and business server
CN110489234A (en) Message processing method, device, equipment and the readable storage medium storing program for executing of block link layer
CN111782363A (en) Method and flow system for supporting multi-service scene calling
CN113296745B (en) Data processing method and device, computer readable storage medium and processor
CN112448854B (en) Kubernetes complex network policy system and implementation method thereof
CN111352748B (en) Interface calling method and device, electronic equipment and storage medium
CN110032458B (en) PHP cross-language unified calling system
CN113535744B (en) Tenant data modification method, system, equipment and storage medium
WO2009103776A2 (en) Method and apparatus for correct mappings of uml to owl ontology format

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant