[go: up one dir, main page]

CN109815214A - Database access method, system, device and storage medium - Google Patents

Database access method, system, device and storage medium Download PDF

Info

Publication number
CN109815214A
CN109815214A CN201811645253.9A CN201811645253A CN109815214A CN 109815214 A CN109815214 A CN 109815214A CN 201811645253 A CN201811645253 A CN 201811645253A CN 109815214 A CN109815214 A CN 109815214A
Authority
CN
China
Prior art keywords
data
service request
handling system
database
data base
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
CN201811645253.9A
Other languages
Chinese (zh)
Other versions
CN109815214B (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.)
Shenzhen Intellifusion Technologies Co Ltd
Original Assignee
Shenzhen Intellifusion Technologies 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 Shenzhen Intellifusion Technologies Co Ltd filed Critical Shenzhen Intellifusion Technologies Co Ltd
Priority to CN201811645253.9A priority Critical patent/CN109815214B/en
Publication of CN109815214A publication Critical patent/CN109815214A/en
Application granted granted Critical
Publication of CN109815214B publication Critical patent/CN109815214B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请实施例公开了一种数据库访问方法、系统、装置及存储介质,该方法包括:数据库处理系统接收客户端针对数据库的服务请求,服务请求携带协议参数;数据库处理系统根据协议参数确定服务请求是否采用默认传输协议;若服务请求不采用默认传输协议,数据库处理系统将服务请求的协议参数转换为与默认传输协议对应的统一协议参数。本申请实施例可以支持多种协议语言的服务请求。

The embodiments of the present application disclose a database access method, system, device and storage medium. The method includes: a database processing system receives a service request from a client for a database, and the service request carries protocol parameters; the database processing system determines the service request according to the protocol parameters Whether to use the default transmission protocol; if the service request does not use the default transmission protocol, the database processing system converts the protocol parameters of the service request into unified protocol parameters corresponding to the default transmission protocol. This embodiment of the present application can support service requests in multiple protocol languages.

Description

Data bank access method, system, device and storage medium
Technical field
This application involves field of computer technology, and in particular to a kind of data bank access method, system, device and storage are situated between Matter.
Background technique
Under current micro services development mode, a huge monomer applications are split as many services, each service Each performs its own functions.If any the file service of special disposal file, the acquisition service of data input, the excavation of processing data analysis are handled Service etc..If each service requires to access certain part common data, which cannot be by some clothes Business individually management, it is therefore desirable to design a data-storage system to save the public data entirely applied.Current data Storage system can only support a kind of hypertext transfer protocol (Hyper Text Transfer Protocol, HTTP) this agreement language Speech is unable to satisfy the demand of various protocols language access.
Summary of the invention
The embodiment of the present application provides a kind of data bank access method, system, device and storage medium, can support a variety of The service request of protocol language.
In a first aspect, the embodiment of the present application provides a kind of data bank access method, the method is applied to micro services system, The micro services system includes client, data base handling system and database, which comprises
The data base handling system receives the service request that the client is directed to the database, the service request Carry protocol parameter;
The data base handling system determines whether the service request uses default transport to assist according to the protocol parameter View;
If the service request does not use the default transport protocol, the data base handling system is by the service request Protocol parameter be converted to uniform protocol parameter corresponding with the default transport protocol.
Second aspect, the embodiment of the present application provide a kind of data base handling system, including
Receiving unit, the service request for being directed to database for receiving client, the service request carry protocol parameter;
Determination unit, for determining whether the service request uses default transport protocol according to the protocol parameter;
Parameter conversion unit, for determining that the service request does not use the default transport protocol when the determination unit When, the protocol parameter of the service request is converted into uniform protocol parameter corresponding with the default transport protocol.
The third aspect, the embodiment of the present application provides a kind of database processing device, including processor, memory, described to deposit Reservoir is for storing one or more programs, and one or more of programs are configured to be executed by the processor, above-mentioned journey Sequence is included the steps that for executing the instruction in the embodiment of the present application first aspect.
Fourth aspect, the embodiment of the present application provide a kind of computer readable storage medium, wherein above-mentioned computer-readable Storage medium storage is used for the computer program of electronic data interchange, wherein above-mentioned computer program executes computer such as Step some or all of described in the embodiment of the present application first aspect.
5th aspect, the embodiment of the present application provide a kind of computer program product, wherein above-mentioned computer program product Non-transient computer readable storage medium including storing computer program, above-mentioned computer program are operable to make to calculate Machine executes the step some or all of as described in the embodiment of the present application first aspect.The computer program product can be one A software installation packet.
As can be seen that data bank access method described in the embodiment of the present application, this method comprises: database processing system System receives the service request that client is directed to database, and service request carries protocol parameter;Data base handling system is according to agreement Parameter determines whether service request uses default transport protocol;If service request does not use default transport protocol, database processing The protocol parameter of service request is converted to uniform protocol parameter corresponding with default transport protocol by system.The embodiment of the present application In, when service request does not use default transport protocol, the protocol parameter of service request can be converted to and be passed with the default The corresponding uniform protocol parameter of defeated agreement can support the service request of various protocols language so as to subsequent carry out parameter processing.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of application for those of ordinary skill in the art without creative efforts, can be with It obtains other drawings based on these drawings.
Fig. 1 is a kind of structural schematic diagram of micro services system disclosed in the embodiment of the present application;
Fig. 2 is a kind of flow diagram of data bank access method disclosed in the embodiment of the present application;
Fig. 3 is the flow diagram of another kind data bank access method disclosed in the embodiment of the present application;
Fig. 4 is a kind of structural schematic diagram of data base handling system disclosed in the embodiment of the present application;
Fig. 5 is a kind of structural schematic diagram of database processing device disclosed in the embodiment of the present application.
Specific embodiment
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present application Attached drawing, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described embodiment is only A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art Every other embodiment obtained without creative efforts, shall fall within the protection scope of the present invention.
Description and claims of this specification and term " first " in above-mentioned attached drawing, " second " etc. are for distinguishing Different objects, are not use to describe a particular order.In addition, term " includes " and " having " and their any deformations, it is intended that It is to cover and non-exclusive includes.Such as the process, method, system, product or equipment for containing a series of steps or units do not have It is defined in listed step or unit, but optionally further comprising the step of not listing or unit, or optionally also wrap Include other step or units intrinsic for these process, methods, product or equipment.
Referenced herein " embodiment " is it is meant that a particular feature, structure, or characteristic described can wrap in conjunction with the embodiments Containing at least one embodiment of the present invention.Each position in the description occur the phrase might not each mean it is identical Embodiment, nor the independent or alternative embodiment with other embodiments mutual exclusion.Those skilled in the art explicitly and Implicitly understand, embodiment described herein can be combined with other embodiments.
Equipment in micro services system involved by the embodiment of the present application can be server, virtual machine, physical machine, cloud Hold server etc..
It describes in detail below to the embodiment of the present application.
In order to be best understood from the data bank access method of the application, a kind of micro services system is disclosed first.Referring to Fig. 1, Fig. 1 is a kind of structural schematic diagram of micro services system disclosed in the embodiment of the present application, as shown in Figure 1, the micro services system includes Client 11, data base handling system 12 and database 13.Wherein, client 11 can be understood as program.User can be in visitor Initiate on family end 11 to the service request of database, with realize some services (for example, data query service, data storage service, Data modification service, data statistics service, data delete service etc.), after data base handling system 12 receives service request, when When service request does not use default transport protocol, data base handling system 12 protocol parameter of service request can be converted to The corresponding uniform protocol parameter of the default transport protocol, can support the service request of various protocols language.At database After the protocol parameter of service request is converted to uniform protocol parameter corresponding with the default transport protocol by reason system 12, number Corresponding database manipulation can be executed according to the type of service request according to library processing system 12.Client 11 may be mounted at hand In the terminals such as machine.Data base handling system 12 and database 13 can be server, for example, can be distributed server.It should Distributed server can be any one of virtual machine, physical machine, cloud server.
Based on micro services system shown in FIG. 1, the embodiment of the present application discloses a kind of data bank access method, referring to Fig. 2, Fig. 2 is a kind of flow diagram of data bank access method disclosed in the embodiment of the present application, as shown in Fig. 2, the database access Method includes the following steps.
201, data base handling system receives the service request that client is directed to database, and service request carries agreement ginseng Number.
In the embodiment of the present application, the service request that client is sent to data base handling system can use Hyper text transfer Agreement (Hyper Text Transfer Protocol, HTTP), can also use transmission control protocol (Transmission Control Protocol, TCP), User Datagram Protocol (User Datagram Protocol, UDP) can also be used.Number May include protocol adaptation module according to library processing system, the protocol adaptation module include Transmission Control Protocol interface, http protocol interface, Udp protocol interface.Wherein, Transmission Control Protocol interface supports asynchronous message queue mode, and http protocol interface can be adapted to different Programming language and the decoupling of specific business service.Protocol adaptation module transfers to data to grasp after can converting different protocol parameters Make layer processing.
202, data base handling system determines whether service request uses default transport protocol according to protocol parameter.
203, if service request does not use default transport protocol, data base handling system turns the protocol parameter of service request It is changed to uniform protocol parameter corresponding with default transport protocol.
In the embodiment of the present application, default transport protocol can be any one of http protocol, Transmission Control Protocol, udp protocol. If service request does not use default transport protocol, data base handling system the protocol parameter of service request can be converted to The corresponding uniform protocol parameter of default transport protocol.Data base handling system can be handled uniform protocol parameter.For The protocol parameter of default transport protocol, data base handling system then can be handled directly.For non-default transport protocol Protocol parameter, data base handling system then can not be handled directly (for example, parameter extraction, verification, parameter encapsulation, parameter lattice Formula conversion etc.).For example, http protocol can be set by default transport protocol.
Wherein, protocol parameter may include: format/type of request content, request length, the client of body that can receive Data type, client can support returned content compressed encoding type, the receivable language of client, whether keep with The long connection of server indicates that request is field write with what language or frame etc..
In the embodiment of the present application, when service request does not use default transport protocol, the agreement of service request can be joined Number is converted to uniform protocol parameter corresponding with the default transport protocol, so as to subsequent carry out parameter processing, can support more The service request of kind protocol language.
Referring to Fig. 3, Fig. 3 is the flow diagram of another kind data bank access method disclosed in the embodiment of the present application, such as Shown in Fig. 3, which includes the following steps.
301, data base handling system receives the service request that client is directed to database, and service request carries agreement ginseng Number.
302, data base handling system determines whether service request uses default transport protocol according to protocol parameter.
303, if service request does not use default transport protocol, data base handling system turns the protocol parameter of service request It is changed to uniform protocol parameter corresponding with default transport protocol.
Wherein, if the service request uses default transport protocol, directly execution step 304 to step 305.
It should be noted that the specific implementation of step 301 to step 303 in the embodiment of the present application may refer to Fig. 2 institute The step 201 shown is to step 203, and details are not described herein again.
304, data base handling system carries out parameter extraction and parameter verification to uniform protocol parameter and other parameters, obtains The request type of service request.
305, data base handling system executes database manipulation corresponding with request type to database according to request type.
In the embodiment of the present application, uniform protocol parameter is and protocol-dependent parameter.Other parameters are unrelated with agreement Parameter, for example, time field, request type field, data field, Data Format fields etc..Due to including asking in other parameters Type field is sought, parameter extraction and parameter verification, the request type of available service request are carried out to other parameters.
Wherein, the request type of service request may include saving data type, modification data type, deleting data class Type, inquiry data type, statistical data type etc..Data base handling system executes database according to request type and requests class The corresponding database manipulation of type, specifically:
If request type is to save data type, data base handling system executes database and saves data manipulation;
If request type is modification data type, data base handling system executes modification data manipulation to database;
If request type is to delete data type, data base handling system executes deletion data operation to database;
If request type is inquiry data type, data base handling system executes inquiry data manipulation to database;
If request type is statistical data type, data base handling system executes statistical data operation to database.
Optionally, data base handling system carries out parameter extraction and parameter verification to uniform protocol parameter and other parameters Meanwhile data base handling system can also carry out parameter encapsulation to uniform protocol parameter and other parameters and format is converted.Data Library processing system carries out parameter extraction, parameter verification, parameter encapsulation and format to uniform protocol parameter and other parameters and converts.Its In, format conversion includes conversion, the conversion of integer real-coded GA etc. of time field.
In the embodiment of the present application, when service request does not use default transport protocol, the agreement of service request can be joined Number is converted to uniform protocol parameter corresponding with the default transport protocol, carries out parameter to uniform protocol parameter and other parameters Extraction and parameter verification, obtain the request type of service request, are executed according to request type to database corresponding with request type Database manipulation, can support the service request of various protocols language, the database of a variety of request types can also be supported to grasp Make.
Optionally, step 305 can specifically include following steps:
(11) if the type of service request is to save data type, the data that data base handling system carries service request Deposit caching, is arranged the cache invalidation time;
(12) data that data base handling system carries service request are stored in database;
(13) it when not reaching the cache invalidation time, if the data that service request carries successfully are stored in database, reaches When the cache invalidation time, data base handling system deletes the data that the service request in caching carries;
(14) when not reaching the cache invalidation time, if there is abnormal, number in the data deposit database that service request carries The data that the service request in caching carries are deleted according to library processing system.
In the embodiment of the present application, if the type of service request is to save data type, service request carrying needs to save Data, after data base handling system receives the service request, what which can be carried needs data to be saved It is stored in the caching of the data base handling system, and the cache invalidation time is set.
Wherein, the caching in data base handling system can cache the number that the needs carried in various service requests save According to the data base handling system can externally provide unified access interface, which can be compatible with different Agreement shields language details, guarantees that different language can access.The data base handling system can also provide caching, can be right The data of multiple services are cached in micro services system.The application can store general in the caching of data base handling system Type data provide the storage solution of universal data under micro services system.
The cache invalidation time is set, and the data that can be carried to avoid service request occupy caching for a long time.Due to database The service request quantity of processing system processing is larger, and the processing time for being assigned to each service request is limited, if one A service request failure, then need to discharge caching in time.The embodiment of the present application can be in data base handling system by service request When the data of carrying are stored in caching, the setting cache invalidation time (specifically, can by starting timer setting timing length, And start timing).The cache invalidation time of setting, corresponding cache invalidation duration (that is, timing length) can be according to service request Type, the size of data that carries of service request it is related.In general, the data that service request carries are bigger, the caching of setting The duration that fails is longer.
When not reaching the cache invalidation time, if the data that service request carries successfully are stored in database, database processing System can return to the successful notification message of service request, when reaching the cache invalidation time, database processing system to client System deletes the data that the service request in caching carries, so as to discharge caching in time.When not reaching the cache invalidation time, If exception occurs in the data deposit database that service request carries, data base handling system can return to service request to client The notification message of failure, data base handling system deletes the data that the service request in caching carries, so as to discharge in time Caching.
The embodiment of the present application can do the guarantee of things consistency to the data in the data and database in caching.Such as Fruit is saved in failed database, then will be deleted the data in caching, if deleting or having modified the record of database, and right If the record answered also saves in the buffer, corresponding deletion or update operation are also done.
Optionally, step 305 can specifically include following steps:
(21) if the type of service request is modification data type, the data that data base handling system carries service request Deposit caching, is arranged the cache invalidation time;
(22) number of targets to be modified is needed in the data and database that data base handling system foundation service request carries Data modification operation is executed according to database;
(23) if do not reach the cache invalidation time, if data modification operation runs succeeded, the cache invalidation time is reached When, data base handling system deletes the data that the service request in caching carries;
(24) when not reaching the cache invalidation time, if data modification operation executes failure, data base handling system is deleted The data that service request in caching carries.
In the embodiment of the present application, if the type of service request is modification data type, which carries the number of modification It can be by the service after data base handling system receives the service request according to the mark with target data that need to be to be modified The data that request carries are stored in the caching of the data base handling system, and the cache invalidation time is arranged.
Wherein, the caching in data base handling system can cache the number that the needs carried in various service requests are modified According to.The cache invalidation time is set, and the data that can be carried to avoid service request occupy caching for a long time.Due to database processing system Uniting, the service request quantity handled is larger, and the processing time for being assigned to each service request is limited, if a service Request failure then needs to discharge caching in time.What the embodiment of the present application can carry service request in data base handling system When data deposit caching, the setting cache invalidation time (specifically, can be by starting timer setting timing length, and start Timing).The cache invalidation time of setting, corresponding cache invalidation duration (that is, timing length) can be according to the class of service request The size of data that type, service request carry is related.In general, the data that service request carries are bigger, the cache invalidation of setting Duration is longer.
Target data pair to be modified is needed in the data and database that data base handling system foundation service request carries Database executes data modification operation.When not reaching the cache invalidation time, if data modification operation runs succeeded, at database Reason system can return to the successful notification message of service request, when reaching the cache invalidation time, database processing to client The data that service request in system-kill caching carries, so as to discharge caching in time.The cache invalidation time is not reached When, if data modification operation executes failure, the notice that data base handling system can return to service request failure to client disappears Breath, data base handling system deletes the data that the service request in caching carries, so as to discharge caching in time.
Optionally, step 305 can specifically include following steps:
(31) if the type of service request is to delete data type, data base handling system extracts to be deleted in database Data;
(32) data to be deleted are stored in and cache by data base handling system, and the cache invalidation time is arranged;
(33) data base handling system carries out data delete operation to the data to be deleted in database;
(34) if data delete operation runs succeeded before reaching the cache invalidation time, when reaching the cache invalidation time, Delete the data to be deleted in caching;
(35) when not reaching the cache invalidation time, if data delete operation executes failure, data base handling system will delay Deletion data in depositing are newly stored into database.
In the embodiment of the present application, if the type of service request is to delete data type, service request carrying is needed wait delete Except the mark of data, after data base handling system receives the service request, the data to be deleted in database can be extracted, it will The data to be deleted are stored in the caching of the data base handling system, and the cache invalidation time is arranged.
Wherein, the caching in data base handling system can cache the number that the needs carried in various service requests are deleted According to.The cache invalidation time is set, caching can be occupied for a long time to avoid data to be deleted.Due to data base handling system processing Service request quantity is larger, and the processing time for being assigned to each service request is limited, if a service request failure, It then needs to discharge caching in time.The embodiment of the present application can data base handling system by data to be deleted be stored in cache when, if Set the cache invalidation time (specifically, can be by starting timer setting timing length, and start timing).The caching of setting loses Imitating time corresponding cache invalidation duration (that is, timing length) can type, the size of data to be deleted according to service request It is related.In general, data to be deleted are bigger, the cache invalidation duration of setting is longer.
Data base handling system carries out data delete operation to the data to be deleted in database.If reach cache invalidation Between before data delete operation run succeeded, data base handling system can to client return service request successfully notify to disappear Breath, when reaching the cache invalidation time, data base handling system deletes the data to be deleted in caching, so as to discharge in time Caching.When not reaching the cache invalidation time, if data delete operation executes failure, data base handling system can will be in caching Data to be deleted be newly stored into database, re-execute data delete operation;Data base handling system can also will be in caching Data to be deleted delete, and to client return service request failure notification message.
Optionally, step 305 can specifically include following steps:
(41) if the type of service request is inquiry data type or statistical data type, data base handling system extracts number According to the data to be checked or data to be counted in library;
(42) the cache invalidation time is arranged in data to be checked or data to be counted deposit caching by data base handling system;
(43) data base handling system carries out data query operation to the data to be checked in database or treats statistical number According to progress data statistics operation;
(44) slow reaching if data query operation or data statistics operation run succeeded before reaching the cache invalidation time When depositing the out-of-service time, the data to be checked or data to be counted in caching are deleted;
(45) when not reaching the cache invalidation time, if data query operation or data statistics operation execute failure, data Library processing system deletes the data to be checked or data to be counted in caching.
In the embodiment of the present application, if the type of service request is that inquiry data type or statistical data type, the service are asked The mark for carrying the mark or data to be counted that need data to be checked is sought, data base handling system receives the service request Afterwards, the data to be checked or data to be counted in database can be extracted, it should by the data to be checked or data to be counted deposit The caching of data base handling system, and the cache invalidation time is set.
Wherein, the caching in data base handling system can cache the needs inquiry carried in various service requests or needs The data of statistics.The cache invalidation time is set, caching can be occupied for a long time to avoid data to be checked or data to be counted.Due to The service request quantity of data base handling system processing is larger, and the processing time for being assigned to each service request is limited, If a service request failure, needs to discharge caching in time.The embodiment of the present application can will be in data base handling system Inquire data deposit caching when, setting the cache invalidation time (specifically, can by start timer setting timing length, and Start timing).The cache invalidation time of setting, corresponding cache invalidation duration (that is, timing length) can be according to service request Type, data to be checked or size of data to be counted are related.In general, data to be checked or data to be counted are bigger, setting Cache invalidation duration it is longer.
Data base handling system in database data to be checked carry out data query operation or treat statistical data into Line number operates according to statistics.If data query operation or data statistics operation run succeeded before reaching the cache invalidation time, data Library processing system can return to the successful notification message of service request, when reaching the cache invalidation time, database to client Processing system deletes the data to be checked or data to be counted in caching, so as to discharge caching in time.Caching is not reached When the out-of-service time, if data query operation or data statistics operation execute failure, data base handling system can be returned to client The notification message of service request failure is returned, data base handling system deletes the data to be checked or data to be counted in caching.
Optionally, Fig. 3 can also include the following steps:
(51) the identical inquiry of querying condition in received inquiry request in data base handling system statistics preset time period The quantity of request;
(52) if the quantity of the identical inquiry request of querying condition is greater than or equal to the first preset quantity, and in database Index corresponding with querying condition is not set up, data base handling system establishes index corresponding with querying condition in the database;
(53) if the quantity of the identical inquiry request of querying condition has been established less than the second preset quantity, and in database Index corresponding with querying condition, data base handling system delete index corresponding with querying condition, and the first preset quantity is greater than Second preset quantity.
In the embodiment of the present application, data base handling system needs to handle a large amount of service request, in service request Inquiry request, the querying condition carried in the available inquiry request of data base handling system, if querying condition is in database In establish corresponding index, then can directly be searched by indexing, can greatly improve data query in database Efficiency.If not establishing index, and the querying condition utilization rate is lower, then data base handling system is directly according to inquiry item Part is searched from database.
The embodiment of the present application can count in preset time period that the identical inquiry of querying condition is asked in received inquiry request The quantity asked, wherein preset time period can be the past period, for example, one month, the past three months, past six in the past A month, the past 1 year etc..Received inquiry request in preset time period, can be over a month received inquiry request, or All inquiry requests of past 1 year received inquiry request or historical reception.The embodiment of the present application is without limitation.
Data base handling system may include index module, look into received inquiry request for counting in preset time period The quantity of the identical inquiry request of inquiry condition, if the quantity of the identical inquiry request of querying condition is greater than the first preset quantity, Then think that the querying condition is that focus inquiry condition counts if not setting up index corresponding with the querying condition in database Establish index corresponding with the querying condition in the database according to library processing system;If had been established in database and the inquiry item The corresponding index of part, then data base handling system can be inquired by the index.Wherein, which can also With referred to as Data Storage And Retrieval System.
If the quantity of the identical inquiry request of querying condition is less than the second preset quantity, then it is assumed that the querying condition is cold Door querying condition, if index corresponding with querying condition has been established in database, data base handling system is deleted and inquiry The corresponding index of condition.
Wherein, the first preset quantity is greater than the second preset quantity.First preset quantity and the second preset quantity are ok It is set and is stored in the memory (for example, nonvolatile memory) of data base handling system in advance.For example, One preset quantity is 100, and the second preset quantity is 3.
In the embodiment of the present application, for no focus inquiry condition for establishing index, corresponding index can be automatically created, So as to improve the corresponding efficiency data query of focus inquiry condition in database;Unexpected winner for having built up index is inquired Condition can be automatically deleted corresponding index, and unnecessary index is avoided to occupy the index resource of database.
It is above-mentioned that mainly the scheme of the embodiment of the present application is described from the angle of method side implementation procedure.It is understood that , in order to realize the above functions, it comprises execute the corresponding hardware configuration of each function and/or software module for terminal.This Field technical staff should be readily appreciated that, unit and algorithm described in conjunction with the examples disclosed in the embodiments of the present disclosure Step, the present invention can be realized with the combining form of hardware or hardware and computer software.Some function actually with hardware also It is the mode of computer software driving hardware to execute, the specific application and design constraint depending on technical solution.Profession Technical staff can specifically realize described function to each using distinct methods, but this realization should not be recognized It is beyond the scope of this invention.
The embodiment of the present application can carry out the division of functional unit according to above method example to terminal, for example, can be right The each functional unit of each function division is answered, two or more functions can also be integrated in a processing unit. Above-mentioned integrated unit both can take the form of hardware realization, can also realize in the form of software functional units.It needs Illustrate, is schematical, only a kind of logical function partition to the division of unit in the embodiment of the present application, it is practical to realize When there may be another division manner.
Referring to Fig. 4, Fig. 4 is a kind of structural schematic diagram of data base handling system disclosed in the embodiment of the present application.The number It is applied to the micro services system of Fig. 1 according to library processing system, as shown in figure 4, the data base handling system 400 includes receiving unit 401, determination unit 402 and parameter conversion unit 403, in which:
Receiving unit 401, the service request for being directed to database for receiving client, service request carry protocol parameter;
Determination unit 402, for determining whether service request uses default transport protocol according to protocol parameter;
Parameter conversion unit 403, for will service when determination unit determines that service request does not use default transport protocol The protocol parameter of request is converted to uniform protocol parameter corresponding with default transport protocol.
Optionally, which can also include parameter processing unit 404 and database operating unit 405。
Parameter processing unit 404 is obtained for carrying out parameter extraction and parameter verification to uniform protocol parameter and other parameters To the request type of service request;
Database manipulation unit 405, for executing database corresponding with request type to database according to request type Operation.
Optionally, database manipulation unit 405 executes data corresponding with request type to database according to request type Library operation, specifically: if the type of service request is to save data type, the data that service request is carried are stored in caching, if Set the cache invalidation time;The data that service request is carried are stored in database;When not reaching the cache invalidation time, if service is asked It asks the data of carrying to be successfully stored in database, when reaching the cache invalidation time, deletes the number that the service request in caching carries According to;When not reaching the cache invalidation time, if exception occurs in the data deposit database that service request carries, delete in caching The data that service request carries.
Optionally, database manipulation unit 405 executes data corresponding with request type to database according to request type Library operation, specifically: if the type of service request is modification data type, the data that service request is carried are stored in caching, if Set the cache invalidation time;Target data to be modified is needed to hold database in the data and database carried according to service request Row data modification operation;If do not reach the cache invalidation time, if data modification operation runs succeeded, when reaching cache invalidation Between when, delete caching in service request carry data;When not reaching the cache invalidation time, if data modification operation executes The data that the service request in caching carries are deleted in failure.
Optionally, database manipulation unit 405 executes data corresponding with request type to database according to request type Library operation, specifically: if the type of service request is to delete data type, extract the data to be deleted in database;It will be wait delete It is cached except data are stored in, the cache invalidation time is set;Data delete operation is carried out to the data to be deleted in database;If reaching Data delete operation runs succeeded before the cache invalidation time, when reaching the cache invalidation time, deletes to be deleted in caching Data.
Optionally, database manipulation unit 405 executes data corresponding with request type to database according to request type Library operation, specifically: if the type of service request is inquiry data type or statistical data type, extract to be checked in database Ask data or data to be counted;By data to be checked or data to be counted deposit caching, the cache invalidation time is set;To database In data to be checked carry out data query operation or treat statistical data carry out data statistics operation;If reach cache invalidation Between before data query operation or data statistics operation run succeeded, when reaching the cache invalidation time, delete cache in Inquire data or data to be counted;When not reaching the cache invalidation time, if data query operation or data statistics operation execute Data to be checked or data to be counted in caching are deleted in failure.
Optionally, which can also include statistic unit 406, index creation unit 407, index Delete unit 408.
Statistic unit 406, for counting, the identical inquiry of querying condition is asked in received inquiry request in preset time period The quantity asked;
It is default to be greater than or equal to first for the quantity when the identical inquiry request of querying condition for index creation unit 407 Quantity, and when not setting up index corresponding with querying condition in database, it establishes in the database corresponding with querying condition Index;
Index deletes unit 408, for the quantity when the identical inquiry request of querying condition less than the second preset quantity, and And when index corresponding with querying condition having been established in database, index corresponding with querying condition, the first preset quantity are deleted Greater than the second preset quantity.
Implement data base handling system shown in Fig. 4, when service request does not use default transport protocol, can will service The protocol parameter of request is converted to uniform protocol parameter corresponding with the default transport protocol, at subsequent progress parameter Reason, can support the service request of various protocols language.
Referring to Fig. 5, Fig. 5 is a kind of structural schematic diagram of database processing device disclosed in the embodiment of the present application.Such as Fig. 5 Shown, which includes processor 501 and memory 502, wherein database processing device 500 can be with Including bus 503, processor 501 and memory 502 can be connected with each other by bus 503, and bus 503 can be external components Interconnection standards (Peripheral Component Interconnect, abbreviation PCI) bus or expanding the industrial standard structure (Extended Industry Standard Architecture, abbreviation EISA) bus etc..Bus 503 can be divided into address Bus, data/address bus, control bus etc..Only to be indicated with a thick line in Fig. 5, it is not intended that only one convenient for indicating Bus or a type of bus.Memory 502 is used to store one or more programs comprising instruction;Processor 501 is used for Call the above-mentioned Fig. 2 of the instruction execution method and step some or all of into Fig. 3 being stored in memory 502.
Implement database processing device shown in fig. 5, when service request does not use default transport protocol, can will service The protocol parameter of request is converted to uniform protocol parameter corresponding with the default transport protocol, at subsequent progress parameter Reason, can support the service request of various protocols language.
The embodiment of the present application also provides a kind of computer storage medium, wherein computer storage medium storage is for electricity The computer program of subdata exchange, it is as any in recorded in above method embodiment which execute computer A kind of some or all of data bank access method step.
The embodiment of the present application also provides a kind of computer program product, which includes storing computer The non-transient computer readable storage medium of program, the computer program are operable to execute computer as the above method is real Apply some or all of any data bank access method recorded in example step.
It should be noted that for the various method embodiments described above, for simple description, therefore, it is stated as a series of Combination of actions, but those skilled in the art should understand that, the present invention is not limited by the sequence of acts described because According to the present invention, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art should also know It knows, the embodiments described in the specification are all preferred embodiments, and related actions and modules is not necessarily of the invention It is necessary.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, there is no the portion being described in detail in some embodiment Point, reference can be made to the related descriptions of other embodiments.
In several embodiments provided herein, it should be understood that disclosed device, it can be by another way It realizes.For example, the apparatus embodiments described above are merely exemplary, such as the division of the unit, it is only a kind of Logical function partition, there may be another division manner in actual implementation, such as multiple units or components can combine or can To be integrated into another system, or some features can be ignored or not executed.Another point, shown or discussed is mutual Coupling, direct-coupling or communication connection can be through some interfaces, the indirect coupling or communication connection of device or unit, It can be electrical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme 's.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list Member both can take the form of hardware realization, can also realize in the form of software functional units.
If the integrated unit is realized in the form of SFU software functional unit and sells or use as independent product When, it can store in a computer-readable access to memory.Based on this understanding, technical solution of the present invention substantially or Person says that all or part of the part that contributes to existing technology or the technical solution can body in the form of software products Reveal and, which is stored in a memory, including some instructions are used so that a computer equipment (can be personal computer, server or network equipment etc.) executes all or part of each embodiment the method for the present invention Step.And memory above-mentioned includes: USB flash disk, read-only memory (ROM, Read-Only Memory), random access memory The various media that can store program code such as (RAM, Random Access Memory), mobile hard disk, magnetic or disk.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of above-described embodiment is can It is completed with instructing relevant hardware by program, which can store in a computer-readable memory, memory May include: flash disk, read-only memory (English: Read-Only Memory, referred to as: ROM), random access device (English: Random Access Memory, referred to as: RAM), disk or CD etc..
The embodiment of the present application is described in detail above, specific case used herein to the principle of the present invention and Embodiment is expounded, and the above description of the embodiment is only used to help understand the method for the present invention and its core ideas; At the same time, for those skilled in the art can in specific embodiments and applications according to the thought of the present invention There is change place, in conclusion the contents of this specification are not to be construed as limiting the invention.

Claims (10)

1. a kind of data bank access method, which is characterized in that the method is applied to micro services system, the micro services system packet Include client, data base handling system and database, which comprises
The data base handling system receives the service request that the client is directed to the database, and the service request carries Protocol parameter;
The data base handling system determines whether the service request uses default transport protocol according to the protocol parameter;
If the service request does not use the default transport protocol, the data base handling system is by the association of the service request View Parameter Switch is uniform protocol parameter corresponding with the default transport protocol.
2. the method according to claim 1, wherein the service request also carries other parameters, the data The protocol parameter of the service request is converted to uniform protocol parameter corresponding with the default transport protocol by library processing system Later, the method also includes:
The data base handling system carries out parameter extraction and parameter verification to the uniform protocol parameter and the other parameters, Obtain the request type of the service request;
The data base handling system executes number corresponding with the request type to the database according to the request type It is operated according to library.
3. according to the method described in claim 2, it is characterized in that, the data base handling system is according to the request type pair The database executes database manipulation corresponding with the request type, comprising:
If the type of the service request is to save data type, the data base handling system carries the service request Data deposit caching, is arranged the cache invalidation time;
The data that the data base handling system carries the service request are stored in the database;
When not reaching the cache invalidation time, if the data that the service request carries successfully are stored in the database, When reaching the cache invalidation time, the data base handling system deletes the number of the carrying of the service request in the caching According to;
When not reaching the cache invalidation time, if the data deposit database appearance that the service request carries is different Often, the data base handling system deletes the data of the carrying of the service request in the caching.
4. according to the method described in claim 2, it is characterized in that, the data base handling system is according to the request type pair The database executes database manipulation corresponding with the request type, comprising:
If the type of the service request is modification data type, the data base handling system carries the service request Data deposit caching, is arranged the cache invalidation time;
Data that the data base handling system is carried according to the service request and mesh to be modified is needed in the database It marks data and data modification operation is executed to the database;
If do not reach the cache invalidation time, if the data modification operation runs succeeded, the cache invalidation is reached When the time, the data base handling system deletes the data of the carrying of the service request in the caching;
When not reaching the cache invalidation time, if the data modification operation executes failure, the data base handling system Delete the data that the service request in the caching carries.
5. according to the method described in claim 2, it is characterized in that, the data base handling system is according to the request type pair The database executes database manipulation corresponding with the request type, comprising:
If the type of the service request be delete data type, the data base handling system extract in the database to Delete data;
The cache invalidation time is arranged in the data deposit caching to be deleted by the data base handling system;
The data base handling system carries out data delete operation to the data to be deleted in the database;
If reaching the cache invalidation time foregoing description data delete operation to run succeeded, the cache invalidation time is reached When, delete the data to be deleted in the caching.
6. according to the method described in claim 2, it is characterized in that, the data base handling system is according to the request type pair The database executes database manipulation corresponding with the request type, comprising:
If the type of the service request is inquiry data type or statistical data type, the data base handling system extracts institute State the data to be checked or data to be counted in database;
The data base handling system is by the data to be checked or the data deposit caching to be counted, when cache invalidation is arranged Between;
The data base handling system carries out data query operation or to described to the data to be checked in the database Data to be counted carry out data statistics operation;
If reaching the cache invalidation time foregoing description data query operation or data statistics operation running succeeded, arrive When up to the cache invalidation time, the data to be checked or the data to be counted in the caching are deleted;
When not reaching the cache invalidation time, if the data query operation or data statistics operation execute failure, The data base handling system deletes the data to be checked or the data to be counted in the caching.
7. described in any item methods according to claim 1~6, which is characterized in that the method also includes:
The identical inquiry request of querying condition in received inquiry request in the data base handling system statistics preset time period Quantity;
If the quantity of the identical inquiry request of the querying condition is greater than or equal to the first preset quantity, and in the database Index corresponding with the querying condition is not set up, the data base handling system is established and the inquiry in the database The corresponding index of condition;
If the quantity of the identical inquiry request of the querying condition has been established less than the second preset quantity, and in the database Index corresponding with the querying condition, the data base handling system deletes index corresponding with the querying condition, described First preset quantity is greater than second preset quantity.
8. a kind of data base handling system characterized by comprising
Receiving unit, the service request for being directed to database for receiving client, the service request carry protocol parameter;
Determination unit, for determining whether the service request uses default transport protocol according to the protocol parameter;
Parameter conversion unit, for when the determination unit determines that the service request does not use the default transport protocol, The protocol parameter of the service request is converted into uniform protocol parameter corresponding with the default transport protocol.
9. a kind of database processing device, which is characterized in that including processor and memory, the memory is for storing one A or multiple programs, one or more of programs are configured to be executed by the processor, and described program includes for executing Method as described in any one of claims 1 to 7.
10. a kind of computer readable storage medium, which is characterized in that the computer readable storage medium is for storing electron number According to the computer program of exchange, wherein the computer program executes computer as described in any one of claim 1~7 Method.
CN201811645253.9A 2018-12-29 2018-12-29 Database access method, system, device and storage medium Active CN109815214B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811645253.9A CN109815214B (en) 2018-12-29 2018-12-29 Database access method, system, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811645253.9A CN109815214B (en) 2018-12-29 2018-12-29 Database access method, system, device and storage medium

Publications (2)

Publication Number Publication Date
CN109815214A true CN109815214A (en) 2019-05-28
CN109815214B CN109815214B (en) 2022-05-17

Family

ID=66603296

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811645253.9A Active CN109815214B (en) 2018-12-29 2018-12-29 Database access method, system, device and storage medium

Country Status (1)

Country Link
CN (1) CN109815214B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111625427A (en) * 2020-07-03 2020-09-04 上海浦东发展银行股份有限公司 Real-time monitoring system and method for configuring central client connection health status
CN112055039A (en) * 2019-06-06 2020-12-08 阿里巴巴集团控股有限公司 Data access method, device and system and computing equipment
CN112822237A (en) * 2020-12-28 2021-05-18 北京奇艺世纪科技有限公司 Network request transmission method and device
CN112989078A (en) * 2021-03-26 2021-06-18 北京市商汤科技开发有限公司 Data processing method and device, computer equipment and storage medium
CN115062092A (en) * 2022-08-10 2022-09-16 阿里云计算有限公司 Database access method, device, system and storage medium
CN115314423A (en) * 2022-07-19 2022-11-08 杭州安恒信息技术股份有限公司 Traffic data statistical method, device and storage medium
CN116708579A (en) * 2023-08-04 2023-09-05 浪潮电子信息产业股份有限公司 Data access method, device, electronic device, and computer-readable storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6601065B1 (en) * 2000-12-21 2003-07-29 Cisco Technology, Inc. Method and apparatus for accessing a database through a network
CN1494022A (en) * 2002-10-30 2004-05-05 华为技术有限公司 A Method of Accessing Database Through Protocol Proxy
CN101695169A (en) * 2009-10-22 2010-04-14 中兴通讯股份有限公司 Remote-end maintaining method of operation support system data as well as system and remote-end account opening proxy
US20100146206A1 (en) * 2008-08-21 2010-06-10 Xsignnet Ltd. Grid storage system and method of operating thereof
CN102316129A (en) * 2010-07-01 2012-01-11 江苏大学 Method of data exchange between embedded device and remote database
CN104125208A (en) * 2013-10-15 2014-10-29 腾讯科技(深圳)有限公司 Data transmission method and data transmission device
US20150317340A1 (en) * 2014-04-30 2015-11-05 Wal-Mart Stores, Inc. Pattern for integrating primary and secondary data stores in a sharded data domain
CN105608197A (en) * 2015-12-25 2016-05-25 Tcl集团股份有限公司 Method and system for obtaining Memcache data under high concurrency
CN106202403A (en) * 2016-07-11 2016-12-07 浪潮通用软件有限公司 Method for creating database index through dynamic analysis
CN106484713A (en) * 2015-08-27 2017-03-08 中国石油化工股份有限公司 A kind of based on service-oriented Distributed Request Processing system
CN108989356A (en) * 2018-09-10 2018-12-11 四川长虹电器股份有限公司 A kind of method that API gateway realizes protocol conversion

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6601065B1 (en) * 2000-12-21 2003-07-29 Cisco Technology, Inc. Method and apparatus for accessing a database through a network
CN1494022A (en) * 2002-10-30 2004-05-05 华为技术有限公司 A Method of Accessing Database Through Protocol Proxy
US20100146206A1 (en) * 2008-08-21 2010-06-10 Xsignnet Ltd. Grid storage system and method of operating thereof
CN101695169A (en) * 2009-10-22 2010-04-14 中兴通讯股份有限公司 Remote-end maintaining method of operation support system data as well as system and remote-end account opening proxy
CN102316129A (en) * 2010-07-01 2012-01-11 江苏大学 Method of data exchange between embedded device and remote database
CN104125208A (en) * 2013-10-15 2014-10-29 腾讯科技(深圳)有限公司 Data transmission method and data transmission device
US20150317340A1 (en) * 2014-04-30 2015-11-05 Wal-Mart Stores, Inc. Pattern for integrating primary and secondary data stores in a sharded data domain
CN106484713A (en) * 2015-08-27 2017-03-08 中国石油化工股份有限公司 A kind of based on service-oriented Distributed Request Processing system
CN105608197A (en) * 2015-12-25 2016-05-25 Tcl集团股份有限公司 Method and system for obtaining Memcache data under high concurrency
CN106202403A (en) * 2016-07-11 2016-12-07 浪潮通用软件有限公司 Method for creating database index through dynamic analysis
CN108989356A (en) * 2018-09-10 2018-12-11 四川长虹电器股份有限公司 A kind of method that API gateway realizes protocol conversion

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
汪源等: "工程数据库管理系统OSCAR中的联机增量备份", 《计算机辅助设计与图形学学报》 *

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112055039A (en) * 2019-06-06 2020-12-08 阿里巴巴集团控股有限公司 Data access method, device and system and computing equipment
CN111625427A (en) * 2020-07-03 2020-09-04 上海浦东发展银行股份有限公司 Real-time monitoring system and method for configuring central client connection health status
CN111625427B (en) * 2020-07-03 2023-09-01 上海浦东发展银行股份有限公司 Real-time monitoring system and method for configuring connection health status of central client
CN112822237A (en) * 2020-12-28 2021-05-18 北京奇艺世纪科技有限公司 Network request transmission method and device
CN112989078A (en) * 2021-03-26 2021-06-18 北京市商汤科技开发有限公司 Data processing method and device, computer equipment and storage medium
CN115314423A (en) * 2022-07-19 2022-11-08 杭州安恒信息技术股份有限公司 Traffic data statistical method, device and storage medium
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
CN116708579A (en) * 2023-08-04 2023-09-05 浪潮电子信息产业股份有限公司 Data access method, device, electronic device, and computer-readable storage medium
CN116708579B (en) * 2023-08-04 2024-01-12 浪潮电子信息产业股份有限公司 Data access method, device, electronic equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN109815214B (en) 2022-05-17

Similar Documents

Publication Publication Date Title
CN109815214A (en) Database access method, system, device and storage medium
CN103516585B (en) Method and system for distributing messages according to priorities
CN102780768B (en) A processing method and processing system for a large amount of concurrent requests
CN107943951A (en) A kind of search method and system of block chain business information
CN103095819A (en) Data information pushing method and data information pushing system
CN103139157B (en) A kind of based on the network communication method of socket, Apparatus and system
WO2012139474A1 (en) Data acquisition method, device and system
CN103384274B (en) Public network based on http agreement connects the communication means of inner net computer
CN104866528B (en) Multi-platform data acquisition method and system
CN104009894A (en) Method, system and device for automatic acquisition of service information in local area network
CN105025063A (en) Online data transmission method for large-scale terminal equipment
CN109547524A (en) User behavior storage method, device, equipment and storage medium based on Physical Network
CN109561165A (en) domain name system configuration method and related device
CN110674172A (en) Data query method and device
WO2016110070A1 (en) Data acquiring method and device, and storage medium
CN114371935B (en) Gateway processing method, gateway, device and medium
CN108334549A (en) A kind of device data storage method, extracting method, storage platform and extraction platform
CN106572135A (en) Network request processing method and device
CN107968798B (en) Network management resource label obtaining method, cache synchronization method, device and system
CN102902593A (en) Protocol distribution processing system based on cache mechanism
EP2406713A1 (en) Synchronized relay messaging and coordinated network processing using snmp
CN113269590B (en) Data processing method, device and system for resource subsidy
CN104615784B (en) A kind of method for accessing data
CN107784006B (en) Data processing method and device
CN112463748A (en) Storage system file lock identification method, system, terminal and storage medium

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