CN105138693A - Method and device for having access to databases - Google Patents

Method and device for having access to databases Download PDF

Info

Publication number
CN105138693A
CN105138693A CN201510601310.3A CN201510601310A CN105138693A CN 105138693 A CN105138693 A CN 105138693A CN 201510601310 A CN201510601310 A CN 201510601310A CN 105138693 A CN105138693 A CN 105138693A
Authority
CN
China
Prior art keywords
database
physical
connection pool
application system
shared data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201510601310.3A
Other languages
Chinese (zh)
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.)
Union Mobile Pay Co Ltd
Original Assignee
Union Mobile Pay 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 Union Mobile Pay Co Ltd filed Critical Union Mobile Pay Co Ltd
Priority to CN201510601310.3A priority Critical patent/CN105138693A/en
Publication of CN105138693A publication Critical patent/CN105138693A/en
Pending legal-status Critical Current

Links

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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Abstract

The invention discloses a method and device for having access to databases. A shared database connection pool receives a database operation request of an application system and then performs operation processing on the databases through physical database connection, between the databases, corresponding to the database operation request; the shared database connection pool receives operation results fed back by the databases through the physical database connection and then notifies the application system of the operation results according to a notification address in the database operation request. Because the shared database connection pool notifies the application system of the operation results according to the notification address in the database operation request, in the operation process of the databases, the application system does not need to wait for the operation results of the databases synchronously, then database operation asynchronization between the application system and the databases is achieved, service resources of the application system are saved, and the service throughput of the application system is increased.

Description

A kind of method of accessing database and device
Technical field
The present invention relates to field of computer technology, particularly relate to a kind of method and device of accessing database.
Background technology
Along with the development of Internet service, the portfolio exponential increase of transaction system.Meanwhile, Internet service often carries out advertising campaign, can cause sometime in section trading volume increase sharply, there is transaction peak.General dependency database is as the instrument of data persistence at present for transaction system, once there is the situation on transaction peak, database manipulation can become bottleneck, and traffic affecting service accepts ability.
In traditional database connection mode, the process that application system carries out database manipulation to database is synchronous operation process, in operation, application system obtains the DataBase combining corresponding with database manipulation request, by the DataBase combining corresponding with database manipulation request, the database manipulation request of application system is sent to database, application system needs synchronous wait database manipulation result simultaneously, make application system when wait database manipulation result, the database manipulation request processing other business can not be continued, cause application system service resources occupied, cause the waste of application system service resources.
Therefore, in prior art, application system needs synchronous wait database manipulation result, causes application system service resources occupied, causes the waste of application system resource.
Summary of the invention
The embodiment of the present invention provides a kind of method and device of accessing database, needs synchronous wait database manipulation result, cause application system service resources occupied, cause the problem of the waste of application system resource in order to solve application system in prior art.
To achieve these goals, embodiments provide a kind of method of accessing database, comprising:
Shared data bank connection pool, after receiving the database manipulation request from application system, is connected by the physical database between the database corresponding with described database manipulation request and carries out operational processes to described database;
Described operating result, after received the operating result that database returns by described physical database, according to the Notify Address in described database manipulation request, is informed to described application system by described shared data bank connection pool.
In the above embodiment of the present invention, shared data bank connection pool, after the database manipulation request receiving application system, is connected by the physical database between the database corresponding with described database manipulation request and carries out operational processes to described database; Described operating result, after received the operating result that database returns by described physical database, according to the Notify Address in described database manipulation request, is informed to described application system by shared data bank connection pool.Because application system is according to the Notify Address in database manipulation request, operating result is informed to application system, make in database manipulation process, application system does not need synchronously to wait for database manipulation result, thus achieve the asynchronization of the database manipulation between application system and database, save the service resources of application system, improve the business throughput of application system.
Optionally, described shared data bank connection pool, after the database manipulation request receiving application system, also comprises:
Notify Address in described database manipulation request is connected with described physical database by described shared data bank connection pool to be bound;
Described operating result, according to the Notify Address in described database manipulation request, is informed to described application system, comprises by described shared data bank connection pool:
Described shared data bank connection pool determines the Notify Address that the described physical database used with the described operating result of reception connects and binds;
Described operating result, according to described Notify Address, is informed to described application system by described shared data bank connection pool.
In the above embodiment of the present invention, Notify Address in database manipulation request is connected with physical database by shared data bank connection pool to be bound, by the physical connection of carrying out binding with Notify Address, operational processes is carried out to database, now, application system synchronously need not wait for the operating result of database, the database manipulation request processing other business can be continued, at shared data bank connection pool after receiving operating result, according to the Notify Address in operation requests, operating result is informed to application system, thus save the service resources of application system, improve the business throughput of application system.
Optionally, described shared data bank connection pool is connected by the physical database between the database corresponding with described database manipulation request and carries out operational processes to described database, comprising:
If there is unappropriated physical database between the database that described shared data bank connection pool is corresponding with described database manipulation request to connect, then connected by unappropriated physical database and operational processes is carried out to described database; Or
If there is not unappropriated physical database between the database that described shared data bank connection pool is corresponding with described database manipulation request to connect, and the quantity that the physical database set up connects does not reach setting threshold value, with newly set up a physical database between described database and be connected, and connected by newly-established physical database operational processes carried out to described database.
In the above embodiment of the present invention, Share interlinkage pond connected by the physical database between the database corresponding with database manipulation request operational processes is carried out to database time, according to shared data bank connection pool to be connected with the physical database between database whether exist unoccupied, if exist not occupied, then carry out database manipulation, connect if fruit does not exist occupied physical database, then newly set up physical database connection and operational processes is carried out to database.Can be realized occurring when application system the situation that business is increased sharply by above-described embodiment, shared data bank connection pool can tackle the database manipulation request of the application system of surge to the requirement of database access, shared data bank connection pool is utilized to be connected with the physical database between database rationally and effectively, improve the service efficiency that physical database connects, also improve the efficiency of application system to database access simultaneously.
Optionally, described shared data bank connection pool is connected by the physical database between the database corresponding with described database manipulation request and carries out operational processes to described database, comprising:
If there is not unappropriated physical database between the database that described shared data bank connection pool is corresponding with described database manipulation request to connect, and the quantity that the physical database set up connects reaches setting threshold value, after then waiting for that having unappropriated physical database to connect occurs, connected by unappropriated physical database and operational processes is carried out to described database.
In the above embodiment of the present invention, Share interlinkage pond connected by the physical database between the database corresponding with database manipulation request operational processes is carried out to database time, according to shared data bank connection pool to be connected with the physical database between database whether exist unoccupied, if exist not occupied, then carry out database manipulation, connect if fruit does not exist occupied physical database, then newly set up physical database connection and operational processes is carried out to database.If the newly-established physical database of fruit connects reach threshold value, then wait for the appearance that unappropriated physical database connects.Can be realized occurring to application system the situation that business is increased sharply by above-described embodiment, the database manipulation request of the application system that reply increases sharply is to the requirement of database access, utilize shared data bank connection pool to be connected with the physical database between database rationally and effectively, improve the efficiency of application system to database access.
Optionally, do not occupied if described shared data bank connection pool has newly-established physical database to be connected in setting duration, then discharge described newly-established physical database and connect.
In the above embodiment of the present invention, shared data bank connection pool have newly-established physical database be connected to setting duration in do not occupied, then discharge described newly-established physical database to connect, save shared data bank connection pool to be rationally and effectively connected with the physical database between database, avoid the waste of physical data base resource.
Embodiments provide a kind of method of accessing database, comprising:
Application system is after needs operate database, the database manipulation request comprising Notify Address is sent to shared data bank connection pool, to be connected by the physical database between the database corresponding with described database manipulation request to make described shared data bank connection pool and operational processes is carried out to described database, and after received the operating result that database returns by described physical database, according to the Notify Address in described database manipulation request, described operating result is informed to described application system;
Described application system receives the described operating result from described shared data bank connection pool.
In the above embodiment of the present invention, because application system is according to the Notify Address in database manipulation request, operating result is informed to application system, make in database manipulation process, application system does not need synchronously to wait for database manipulation result, thus achieve the asynchronization of the database manipulation between application system and database, save the service resources of application system, improve the business throughput of application system.
Embodiments provide a kind of device of accessing database, comprising:
Connection pool management module, for after receiving the database manipulation request from application system, is connected by the physical database between the database corresponding with described database manipulation request and carries out operational processes to described database;
Data access control module, for after received the operating result that database returns by described physical database, according to the Notify Address in described database manipulation request, informs to described application system by described operating result.
Optionally, described connection pool management module also for:
Notify Address in described database manipulation request is connected with described physical database and binds;
Shared data bank connection pool according to the Notify Address in described database manipulation request, when described operating result is informed to described application system, for the Notify Address determined with receive the described physical database that uses of described operating result and connect and bind;
According to described Notify Address, described operating result is informed to described application system.
Optionally, described connection pool management module specifically for:
If there is unappropriated physical database between the database corresponding with described database manipulation request to connect, then connected by unappropriated physical database and operational processes is carried out to described database; Or
If there is not unappropriated physical database between the database corresponding with described database manipulation request to connect, and the quantity that the physical database set up connects does not reach setting threshold value, with newly set up a physical database between described database and be connected, and connected by newly-established physical database operational processes carried out to described database.
Optionally, described connection pool management module specifically for:
If there is not unappropriated physical database between the database corresponding with described database manipulation request to connect, and the quantity that the physical database set up connects reaches setting threshold value, after then waiting for that having unappropriated physical database to connect occurs, connected by unappropriated physical database and operational processes is carried out to described database.
Optionally, described connection pool management module also for:
If have newly-established physical database to be connected in setting duration not occupied, then discharge described newly-established physical database and connect.
Embodiments provide a kind of device of accessing database, comprising:
Sending module, for when needs operate database, the database manipulation request comprising Notify Address is sent to shared data bank connection pool, to be connected by the physical database between the database corresponding with described database manipulation request to make described shared data bank connection pool and operational processes is carried out to described database, and after received the operating result that database returns by described physical database, according to the Notify Address in described database manipulation request, described operating result is informed to described application system;
Receiver module, for receiving the described operating result from described shared data bank connection pool.
In the above embodiment of the present invention, shared data bank connection pool, after the database manipulation request receiving application system, is connected by the physical database between the database corresponding with described database manipulation request and carries out operational processes to described database; Described operating result, after received the operating result that database returns by described physical database, according to the Notify Address in described database manipulation request, is informed to described application system by shared data bank connection pool.Because application system is according to the Notify Address in database manipulation request, operating result is informed to application system, make in database manipulation process, application system does not need synchronously to wait for database manipulation result, thus achieve the asynchronization of the database manipulation between application system and database, save the service resources of application system, improve the business throughput of application system.
Accompanying drawing explanation
In order to be illustrated more clearly in the technical scheme in the embodiment of the present invention, below the accompanying drawing used required in describing embodiment is briefly introduced, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 is the schematic diagram of the method for the first accessing database of the embodiment of the present invention;
Fig. 2 is the schematic diagram of the method for embodiment of the present invention the second accessing database;
Fig. 3 is the schematic diagram that the physical database of embodiment of the present invention shared data bank connection pool connects;
Fig. 4 is the method overall flow schematic diagram of a kind of accessing database of the embodiment of the present invention;
Fig. 5 is the apparatus structure schematic diagram of the first accessing database of the embodiment of the present invention;
Fig. 6 is the apparatus structure schematic diagram of embodiment of the present invention the second accessing database.
Embodiment
For making the object of the embodiment of the present invention, technical scheme and advantage clearly, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
In the embodiment of the present invention, shared data bank connection pool, after the database manipulation request receiving application system, is connected by the physical database between the database corresponding with described database manipulation request and carries out operational processes to described database; Described operating result, after received the operating result that database returns by described physical database, according to the Notify Address in described database manipulation request, is informed to described application system by shared data bank connection pool.
Because application system is according to the Notify Address in database manipulation request, operating result is informed to application system, make in database manipulation process, application system does not need synchronously to wait for database manipulation result, thus achieve the asynchronization of the database manipulation between application system and database, save the service resources of application system, improve the business throughput of application system.
The embodiment of the present invention generally as shown in Figure 1, the schematic diagram of the method for the first accessing database of the embodiment of the present invention.Application system sends to shared data bank connection pool by needing the database manipulation request carrying out database manipulation, shared data bank connection pool is according to the database manipulation request of the application system received, the physical database obtained between the database corresponding with database manipulation request connects, and carries out operational processes by described physical database connection to database; Operating result, after received the operating result that database returns by physical database, according to the Notify Address in database manipulation request, is informed to application system by shared data bank connection pool.
In order to make technical matters solved by the invention, technical scheme and beneficial effect clearly understand, below in conjunction with drawings and Examples, the present invention is described in more detail.Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
As shown in Figure 2, be a kind of method schematic diagram of accessing database provided in the embodiment of the present invention, comprise the following steps:
S201, shared data bank connection pool, after receiving the database manipulation request from application system, is connected by the physical database between the database corresponding with described database manipulation request and carries out operational processes to described database;
S202, described operating result, after received the operating result that database returns by described physical database, according to the Notify Address in described database manipulation request, is informed to described application system by shared data bank connection pool.
Optionally, in S201, the Notify Address in described database manipulation request, after the database manipulation request receiving application system, is connected with described physical database and binds by shared data bank connection pool;
Accordingly, according to the Notify Address in described database manipulation request, when described operating result is informed to described application system, determine the Notify Address that the described physical database used with the described operating result of reception connects and binds; According to described Notify Address, described operating result is informed to described application system.
In force, for different business scenarios, connect can how also can lack arranging fixing physical database in shared data bank connection pool, what the physical database being illustrated in figure 3 a kind of shared data bank connection pool provided in the embodiment of the present invention connected arranges schematic diagram.
In force, when the application system that access service trading volume is busy, shared data bank connection pool increases accordingly and arranges fixing physical database and connect, as the solid line in Fig. 3 connects, to ensure the operation of business to database of application system; When the application system that access service amount is lower, the fixing physical database that shared data bank connection pool arranges lesser amt accordingly connects, and saves the physical database connection resource of shared data bank connection pool.
In force, when the fixing physical database connection of the solid line instruction in Fig. 3 is fully occupied, shared data bank connection pool with newly can set up a physical database between database and be connected, as the dotted line in Fig. 3 connects, connected by newly-established physical database and operational processes is carried out to database, after a described newly-established complete database manipulation of physical database connection handling, free time exceed setting duration after, by newly-established physical database Connection Release.
It should be noted that, in S201 in the above-described embodiments, communication between application system and shared database connection pool can usage data storehouse JDBC (JavaDataBaseConnectivity, java DataBase combining) access mode, also standard agreement can be used, such as http agreement.
It should be noted that, the communication between application system and shared database connection pool is also not limited to above-mentioned access mode, and other can all be applicable to the embodiment of the present invention by the communication mode carried out between application system and shared database connection pool.
In order to make technical matters solved by the invention, technical scheme and beneficial effect clearly understand, below in conjunction with drawings and Examples, the present invention is described in more detail.Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
In an embodiment, the binding relationship that the Notify Address in database manipulation request is connected with physical database is as shown in table 1.
The binding relationship that Notify Address in table 1 database request is connected with physical database
Application system Notify Address Physical database connects The Notify Address of binding
Application system A {A+} L1 {L1,{A+}}
Application system B {B+} L3 {L3,{B+}}
Application system C {C+} L7 {L7,{C+}}
Such as, as shown in table 1, shared data bank connection pool is after the database manipulation request receiving application system A, by the Notify Address in database manipulation request, { A+} to be connected with physical database and to bind, if the physical database of binding connects for L1, is then { L1 with the message received in Notify Address that physical database that operating result uses connects and binds, { A+}}, according to L1, { A+}}, informs to application system A by the operating result of shared data bank connection pool; Shared data bank connection pool is after the database manipulation request receiving application system B, by the Notify Address in database manipulation request, { B+} to be connected with physical database and to bind, if the physical database of binding connects for L3, message in the Notify Address that the physical database then used with reception operating result connects and binds is { L3, { B+}}, according to L3, { B+}}, informs to application system B by the operating result of shared data bank connection pool; Shared data bank connection pool is after the database manipulation request receiving application system C, by the Notify Address in database manipulation request, { C+} to be connected with physical database and to bind, if the physical database of binding connects for L7, message in the Notify Address that the physical database then used with reception operating result connects and binds is { L7, { C+}}, according to { L7, { operating result of shared data bank connection pool is informed to application system C by C+}}.
In S201, database manipulation request comprises following parameter but is not limited to following parameter: application system numbering, sql statement, sql parameter information, Database Identification parameter, Notify Address.
In an embodiment, shared data bank connection pool can carry out authentication for the application system numbering in database manipulation request, prevent illegal application system from entering shared data bank connection pool, illegally occupy physical database to connect, the database manipulation of database connection pool could be continued by the application system of authentication.Wherein, the mode of application System Number being carried out to authentication can be bi-directional authentification mechanism AKA (AuthenticationandKeyAgreement, authentication and key agreement) authentication, also http abstract authentication can be used, but be not limited to above-mentioned authentication mode, other all can be applicable to the embodiment of the present invention to the mode that application System Number carries out authentication.
Such as, application system legal in shared data bank connection pool is application system A, application system B and application system C in table 1, and the System Number of the application system A of correspondence is that { System Number of A}, application system B is that { System Number of B} and application system C is that { C} forms the valid application System Number collection of shared data bank connection pool.When shared data bank connection pool receives from the System Number in the database manipulation request of certain application system as { during D}, by described System Number, { in D} and shared database connection pool, valid system numbering collection carries out certification to shared data bank connection pool, show that { D} does not exist in the valid system numbering collection of shared data bank connection pool described System Number, the application system that then this application system numbering is corresponding belongs to illegal application system, can not carry out database manipulation process to this application system; When shared data bank connection pool receives from the System Number in the database manipulation request of certain application system as { during B}, owing to there is System Number { B} in the valid system numbering collection of shared data bank connection pool, the application system that then this application system numbering is corresponding belongs to valid application system, and shared data bank connection pool can carry out database manipulation process to this application system.
Sql statement in database manipulation request is a kind of data base querying and programming language, and the sql parameter information in database manipulation request is with sql language inquiry, the correlation parameter information upgrading a collector reason; When Database Identification parameter in database manipulation request is for accessing multiple database, identify the connection resource that will obtain which database; Notify Address in database manipulation request is that database manipulation result is informed to corresponding application system identification address by shared data bank connection pool.
In the S201 of embodiment, shared data bank connection pool is after the database manipulation request receiving application system, and application system does not need the operating result synchronously waiting for that database returns, and now application system can continue the database manipulation request processing other.Such as, in some database manipulation, application system does not need to wait for database manipulation result, and application system can synchronously wait for database manipulation result, thus improves the execution efficiency of application system; Again such as, in some database manipulation consuming time, after application system submits database manipulation request to, synchronously need not wait for the operating result of database, the use of other business can be proceeded, thus be convenient to application system and make rational use of resources, improve the business throughput of application system; Again such as, in some database behaviour, the portfolio of application system is increased sharply, and after application system has submitted database manipulation request to, without the need to synchronously waiting for the operating result of database, can remain seized of the business of surge, thus the database access that reply increases sharply
Optionally, in S201, shared data bank connection pool by the physical database between the database corresponding with described database manipulation request connect operational processes is carried out to described database time, if there is unappropriated physical database between the database that shared data bank connection pool is corresponding with described database manipulation request to connect, then connected by unappropriated physical database and operational processes is carried out to described database; If or there is not unappropriated physical database between the shared data bank connection pool database corresponding with described database manipulation request and connect, with newly set up a physical database between described database and be connected, and connected by newly-established physical database operational processes carried out to described database.
In order to make technical matters solved by the invention, technical scheme and beneficial effect clearly understand, below in conjunction with embodiment, the present invention is described in more detail.Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
In an embodiment, such as, have 10 application systems to need accessing database to carry out database manipulation, the maximum number of connections of each application is 5, then the setting threshold value that the operable physical database of shared data bank connection pool connects is 50.Supposing between the database that shared data bank connection pool is corresponding with database manipulation request that unappropriated physical database connects is 20.
If the database manipulation number of request that shared data bank connection pool receives application system A is 15, then needing the physical database between database that shared data bank connection pool is corresponding with database manipulation request to connect is 15, connect owing to there is unappropriated physical database between the database that shared data bank connection pool is corresponding with database manipulation request, any 15 physical databases connection in shared data bank connection pool is connected by unappropriated 20 physical databases carries out operational processes to database.
If there is not unappropriated physical database between the database that shared data bank connection pool is corresponding with database manipulation request to connect, simultaneously, the database manipulation number of request that shared data bank connection pool receives application system B is 25, then need shared data bank connection pool with newly set up 25 physical databases between database and be connected, and connected by newly-established 25 physical databases operational processes carried out to database.
Optionally, in S201, shared data bank connection pool by the physical database between the database corresponding with described database manipulation request connect operational processes is carried out to described database time, if there is not unappropriated physical database between the database that shared data bank connection pool is corresponding with described database manipulation request to connect, and the quantity that newly-established physical database connects reaches setting threshold value, after then waiting for that having unappropriated physical database to connect occurs, connected by unappropriated physical database and operational processes is carried out to described database.
Such as, in the above-described embodiments, if there is not unappropriated physical database between the database that shared data bank connection pool is corresponding with database manipulation request to connect, and the quantity that newly-established physical database connects reaches setting threshold value 50, the database manipulation number of request simultaneously receiving application system C is 5, after then shared data bank connection pool waits for that having unappropriated physical database to connect occurs, connected by the unappropriated physical database occurred and described database is operated.
Optionally, in S201, do not occupied if shared data bank connection pool has newly-established physical database to be connected in setting duration, then discharge described newly-established physical database and connect.
Such as, in the above-described embodiments, if the release that newly-established 25 physical databases connect setting is not 20s by the duration occupied, if newly-established 25 physical databases connect and not occupiedly have duration more than after 25s, automatically can discharge these 25 physical databases to connect, save database connection resource.
In force, connect for newly-established physical database, the embodiment of the present invention gives multiple delivery mode, exemplifies several below:
Do not occupied by the database manipulation request access database from application system in the free time length that delivery mode one, the newly-established physical database of shared data bank connection pool are connected to setting, then discharge newly-established physical database and connect.
Such as, the free time length that newly-established physical database connects L4 setting is 20s, after newly-established physical database connection L4 receives the operating result of database, in the free time length 20s of setting, database manipulation request not from application system needs to connect L4 accessing database by newly-established physical database, then discharge newly-established physical database and connect L4.
Delivery mode two, shared data bank connection pool after receiving database manipulation result, then by newly-established physical database Connection Release.
In order to make technical matters solved by the invention, technical scheme and beneficial effect clearly understand, below in conjunction with embodiment, the present invention is described in more detail.Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
In the above-described embodiments, shared data bank connection pool arranges fixing physical database connection and carries out operational processes to database, describedly fixing physical database is set connects and be present in all the time in shared data bank connection pool and can not disconnect, connect all occupied when arranging fixing physical database, then shared data bank connection pool with newly set up a physical database between database and be connected, and by newly-established physical database connection, operational processes is carried out to database, after a described newly-established complete database manipulation of physical database connection handling, free time exceed setting duration after, by newly-established physical database Connection Release.
Above-mentioned be in embodiment, when shared data bank connection pool is application system A, application system B and application system C provides multiple database access to serve, from shared data bank connection pool, the physical database obtained between the database corresponding with database manipulation request connects and carries out operational processes to database, needs especially by the Database Identification parameter identification in database manipulation request the physical database connection resource obtaining which database.Database Identification parameter can be read storehouse to write storehouse sign, and also can be that time slicing indicates or account burst indicates, but be not limited to above-mentioned Database Identification parameter, other parameters can carrying out Database Identification be all applicable to the embodiment of the present invention.For different business scenarios, Database Identification parameter can specify different parameter types.Such as, read and write abruption scene, obtains the physical database reading still to write storehouse in storehouse connect by reading storehouse/write storehouse parameter indexing to identify; Again such as, point storehouse submeter scene, the physical database being obtained which burst table by the identification of submeter field parameter is connected.
In the above-described embodiments, shared data bank connection pool is after the database manipulation request receiving application system, connected by the physical database between the database corresponding with database manipulation request, and sql statement in database manipulation request and sql parameter, operational processes is carried out to database, and obtains database manipulation result.
Shared data bank connection pool is after database manipulation, do not occupied by the database manipulation request access database from application system in the free time length that the newly-established physical database of shared data bank connection pool is connected to setting, then discharge newly-established physical database and connect.Or, at shared data bank connection pool after database manipulation, all the time being connected by the physical database do not disconnected in shared data bank connection pool is recycled in shared data bank connection pool, the physical database that the database manipulation request dispatching proposed for other application system has reclaimed connects, thus the database manipulation that can carry out other application system propositions uses, achieve physical database and connect multiplexing by multiple application system.
In an embodiment, described operating result, after received the operating result that database returns by physical database, according to the Notify Address in database manipulation request, is informed to application system by shared data bank connection pool.
In the above embodiment of the present invention, shared data bank connection pool, after the database manipulation request receiving application system, is connected by the physical database between the database corresponding with described database manipulation request and carries out operational processes to described database; Described operating result, after received the operating result that database returns by described physical database, according to the Notify Address in described database manipulation request, is informed to described application system by shared data bank connection pool.Because application system is according to the Notify Address in database manipulation request, operating result is informed to application system, make in database manipulation process, application system does not need synchronously to wait for database manipulation result, thus achieve the asynchronization of the database manipulation between application system and database, save the service resources of application system, improve the business throughput of application system.
In order to make technical matters solved by the invention, technical scheme and beneficial effect clearly understand, below in conjunction with drawings and Examples, the present invention is described in more detail.Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
The method overall flow schematic diagram of the embodiment of the present invention a kind of accessing database as shown in Figure 4.
S401, application system sends database manipulation request to shared data bank connection pool;
S402, shared data bank connection pool receives the database manipulation request from application system;
S403, shared data bank connection pool judges Share interlinkage pond and whether there is unappropriated physical database between database and be connected, and if so, then performs S404, otherwise performs S405;
S404, the physical database that shared data bank connection pool distributes between the database corresponding with database manipulation request connects;
S405, shared data bank connection pool judges newly-established physical database connects whether reach threshold value; If so, perform S408, otherwise perform S406;
S406, newly sets up a physical database between the database that shared data bank connection pool is corresponding with database manipulation request and connects;
S407, shared data bank connection pool distributes newly-established physical database between the database corresponding with database manipulation request and connects;
S408, shared data bank connection pool is waited for that unappropriated physical database connects and is occurred;
S409, shared data bank connection pool distributes the unappropriated physical database occurred between the database corresponding with database manipulation request and connects;
S410, the Notify Address in database manipulation request and physical database connect and bind by shared data bank connection pool;
S411, shared data bank connection pool is connected by the physical database between the database corresponding with database manipulation request and carries out operational processes to database;
S412, shared data bank connection pool connects the operating result receiving database and return by physical database;
S413, operating result, according to the Notify Address in database manipulation request, is informed to application system by shared data bank connection pool.
In the above embodiment of the present invention, shared data bank connection pool, after the database manipulation request receiving application system, is connected by the physical database between the database corresponding with described database manipulation request and carries out operational processes to described database; Described operating result, after received the operating result that database returns by described physical database, according to the Notify Address in described database manipulation request, is informed to described application system by shared data bank connection pool.Because application system is according to the Notify Address in database manipulation request, operating result is informed to application system, make in database manipulation process, application system does not need synchronously to wait for database manipulation result, thus achieve the asynchronization of the database manipulation between application system and database, save the service resources of application system, improve the business throughput of application system.
Based on identical technical conceive, the embodiment of the present invention provides a kind of device of accessing database, and described device can perform said method embodiment.The device of the first accessing database of the embodiment of the present invention as shown in Figure 5.
The device of a kind of accessing database that the embodiment of the present invention provides, comprising:
Connection pool management module S501, for shared data bank connection pool after receiving the database manipulation request from application system, is connected by the physical database between the database corresponding with described database manipulation request and carries out operational processes to described database;
Data access control module S502, for shared data bank connection pool after received the operating result that database returns by described physical database, according to the Notify Address in described database manipulation request, described operating result is informed to described application system.
Optionally, connection pool management module S501, also for:
Notify Address in described database manipulation request is connected with described physical database and binds;
Accordingly, according to the Notify Address in described database manipulation request, when described operating result is informed to described application system, determine the Notify Address that the described physical database used with the described operating result of reception connects and binds; According to described Notify Address, described operating result is informed to described application system.
Optionally, connection pool management module S501, specifically for:
If there is unappropriated physical database between the database corresponding with described database manipulation request to connect, then connected by unappropriated physical database and operational processes is carried out to described database; Or
If there is not unappropriated physical database between the database corresponding with described database manipulation request to connect, with newly set up a physical database between described database and be connected, and connected by newly-established physical database operational processes carried out to described database.
Optionally, connection pool management module S501, specifically for:
If there is not unappropriated physical database between the database corresponding with described database manipulation request to connect, and the quantity that newly-established physical database connects reaches setting threshold value, after then waiting for that having unappropriated physical database to connect occurs, connected by unappropriated physical database and operational processes is carried out to described database.
Optionally, connection pool management module S501, also for:
If have newly-established physical database to be connected in setting duration not occupied, then discharge described newly-established physical database and connect.
Based on identical technical conceive, the embodiment of the present invention provides a kind of device of accessing database, and described device can perform said method embodiment.The device of embodiment of the present invention the second accessing database as shown in Figure 6.
The device of a kind of accessing database that the embodiment of the present invention provides, comprising:
Sending module S601, for application system after needs operate database, the database manipulation request comprising Notify Address is sent to shared data bank connection pool, to be connected by the physical database between the database corresponding with described database manipulation request to make described shared data bank connection pool and operational processes is carried out to described database, and after received the operating result that database returns by described physical database, according to the Notify Address in described database manipulation request, described operating result is informed to described application system;
Receiver module S602, receives the described operating result from described shared data bank connection pool for described application system.
The present invention describes with reference to according to the process flow diagram of the method for the embodiment of the present invention, equipment (system) and computer program and/or block scheme.Should understand can by the combination of the flow process in each flow process in computer program instructions realization flow figure and/or block scheme and/or square frame and process flow diagram and/or block scheme and/or square frame.These computer program instructions can being provided to the processor of multi-purpose computer, special purpose computer, Embedded Processor or other programmable data processing device to produce a machine, making the instruction performed by the processor of computing machine or other programmable data processing device produce device for realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be stored in can in the computer-readable memory that works in a specific way of vectoring computer or other programmable data processing device, the instruction making to be stored in this computer-readable memory produces the manufacture comprising command device, and this command device realizes the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be loaded in computing machine or other programmable data processing device, make on computing machine or other programmable devices, to perform sequence of operations step to produce computer implemented process, thus the instruction performed on computing machine or other programmable devices is provided for the step realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
Although describe the preferred embodiments of the present invention, those skilled in the art once obtain the basic creative concept of cicada, then can make other change and amendment to these embodiments.So claims are intended to be interpreted as comprising preferred embodiment and falling into all changes and the amendment of the scope of the invention.
Obviously, those skilled in the art can carry out various change and modification to the present invention and not depart from the spirit and scope of the present invention.Like this, if these amendments of the present invention and modification belong within the scope of the claims in the present invention and equivalent technologies thereof, then the present invention is also intended to comprise these change and modification.

Claims (12)

1. a method for accessing database, is characterized in that, comprising:
Shared data bank connection pool, after receiving the database manipulation request from application system, is connected by the physical database between the database corresponding with described database manipulation request and carries out operational processes to described database;
Described operating result, after received the operating result that database returns by described physical database, according to the Notify Address in described database manipulation request, is informed to described application system by described shared data bank connection pool.
2. the method for claim 1, is characterized in that, described shared data bank connection pool, after the database manipulation request receiving application system, also comprises:
Notify Address in described database manipulation request is connected with described physical database by described shared data bank connection pool to be bound;
Described operating result, according to the Notify Address in described database manipulation request, is informed to described application system, comprises by described shared data bank connection pool:
Described shared data bank connection pool determines the Notify Address that the described physical database used with the described operating result of reception connects and binds;
Described operating result, according to described Notify Address, is informed to described application system by described shared data bank connection pool.
3. method as claimed in claim 1 or 2, is characterized in that, described shared data bank connection pool is connected by the physical database between the database corresponding with described database manipulation request and carries out operational processes to described database, comprising:
If there is unappropriated physical database between the database that described shared data bank connection pool is corresponding with described database manipulation request to connect, then connected by unappropriated physical database and operational processes is carried out to described database; Or
If there is not unappropriated physical database between the database that described shared data bank connection pool is corresponding with described database manipulation request to connect, and the quantity that the physical database set up connects does not reach setting threshold value, with newly set up a physical database between described database and be connected, and connected by newly-established physical database operational processes carried out to described database.
4. method as claimed in claim 3, is characterized in that, described shared data bank connection pool is connected by the physical database between the database corresponding with described database manipulation request and carries out operational processes to described database, comprising:
If there is not unappropriated physical database between the database that described shared data bank connection pool is corresponding with described database manipulation request to connect, and the quantity that the physical database set up connects reaches setting threshold value, after then waiting for that having unappropriated physical database to connect occurs, connected by unappropriated physical database and operational processes is carried out to described database.
5. the method as described in claim 3 or 4, is characterized in that, the method also comprises:
Do not occupied if described shared data bank connection pool has newly-established physical database to be connected in setting duration, then discharge described newly-established physical database and connect.
6. a method for accessing database, is characterized in that, comprising:
Application system is after needs operate database, the database manipulation request comprising Notify Address is sent to shared data bank connection pool, to be connected by the physical database between the database corresponding with described database manipulation request to make described shared data bank connection pool and operational processes is carried out to described database, and after received the operating result that database returns by described physical database, according to the Notify Address in described database manipulation request, described operating result is informed to described application system;
Described application system receives the described operating result from described shared data bank connection pool.
7. a device for accessing database, is characterized in that, comprising:
Connection pool management module, for after receiving the database manipulation request from application system, is connected by the physical database between the database corresponding with described database manipulation request and carries out operational processes to described database;
Data access control module, for after received the operating result that database returns by described physical database, according to the Notify Address in described database manipulation request, informs to described application system by described operating result.
8. device as claimed in claim 7, is characterized in that, described connection pool management module also for:
Notify Address in described database manipulation request is connected with described physical database and binds;
According to the Notify Address in described database manipulation request, when described operating result is informed to described application system, for determining the Notify Address that the described physical database used with the described operating result of reception connects and binds;
According to described Notify Address, described operating result is informed to described application system.
9. as claimed in claim 7 or 8 device, is characterized in that, described connection pool management module specifically for:
If there is unappropriated physical database between the database corresponding with described database manipulation request to connect, then connected by unappropriated physical database and operational processes is carried out to described database; Or
If there is not unappropriated physical database between the database corresponding with described database manipulation request to connect, and the quantity that the physical database set up connects does not reach setting threshold value, with newly set up a physical database between described database and be connected, and connected by newly-established physical database operational processes carried out to described database.
10. device as claimed in claim 9, is characterized in that, described connection pool management module specifically for:
If there is not unappropriated physical database between the database corresponding with described database manipulation request to connect, and the quantity that the physical database set up connects reaches setting threshold value, after then waiting for that having unappropriated physical database to connect occurs, connected by unappropriated physical database and operational processes is carried out to described database.
11. devices as described in claim 9 or 10, is characterized in that, described connection pool management module also for:
If have newly-established physical database to be connected in setting duration not occupied, then discharge described newly-established physical database and connect.
The device of 12. 1 kinds of accessing databases, is characterized in that, comprising:
Sending module, for when needs operate database, the database manipulation request comprising Notify Address is sent to shared data bank connection pool, to be connected by the physical database between the database corresponding with described database manipulation request to make described shared data bank connection pool and operational processes is carried out to described database, and after received the operating result that database returns by described physical database, according to the Notify Address in described database manipulation request, described operating result is informed to described application system;
Receiver module, for receiving the described operating result from described shared data bank connection pool.
CN201510601310.3A 2015-09-18 2015-09-18 Method and device for having access to databases Pending CN105138693A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510601310.3A CN105138693A (en) 2015-09-18 2015-09-18 Method and device for having access to databases

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510601310.3A CN105138693A (en) 2015-09-18 2015-09-18 Method and device for having access to databases

Publications (1)

Publication Number Publication Date
CN105138693A true CN105138693A (en) 2015-12-09

Family

ID=54724040

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510601310.3A Pending CN105138693A (en) 2015-09-18 2015-09-18 Method and device for having access to databases

Country Status (1)

Country Link
CN (1) CN105138693A (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106021544A (en) * 2016-05-27 2016-10-12 北京京东尚科信息技术有限公司 Distributive connection pool management method and system for databases
CN106354801A (en) * 2016-08-26 2017-01-25 广州唯品会信息科技有限公司 Distributed database connection method and device
CN106650501A (en) * 2016-12-30 2017-05-10 迈普通信技术股份有限公司 Database access control method and apparatus
CN108270719A (en) * 2016-12-30 2018-07-10 广东精点数据科技股份有限公司 A kind of data safe transmission method and device based on digital signature
CN108805095A (en) * 2018-06-19 2018-11-13 Oppo广东移动通信有限公司 image processing method, device, mobile terminal and computer readable storage medium
CN108898169A (en) * 2018-06-19 2018-11-27 Oppo广东移动通信有限公司 Image processing method, picture processing unit and terminal device
CN108898587A (en) * 2018-06-19 2018-11-27 Oppo广东移动通信有限公司 Image processing method, picture processing unit and terminal device
CN108961157A (en) * 2018-06-19 2018-12-07 Oppo广东移动通信有限公司 Image processing method, picture processing unit and terminal device
CN109241037A (en) * 2018-08-28 2019-01-18 郑州云海信息技术有限公司 A kind of method, apparatus that realizing database processing, equipment and storage medium
CN109284311A (en) * 2018-08-14 2019-01-29 四川虹美智能科技有限公司 A kind of method and apparatus obtaining database connection
CN111061759A (en) * 2018-10-17 2020-04-24 联易软件有限公司 Data query method and device
CN111930830A (en) * 2020-06-22 2020-11-13 心有灵犀科技股份有限公司 Distributed transaction data processing method and system based on shared database
CN113467966A (en) * 2021-05-31 2021-10-01 珠海大横琴科技发展有限公司 Data processing method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1448867A (en) * 2002-03-30 2003-10-15 深圳市中兴通讯股份有限公司 Method for accessing database system uniformly
CN102902779A (en) * 2012-09-28 2013-01-30 五八有限公司 Connection method and connection device of multiple databases
US20130332467A1 (en) * 2012-06-08 2013-12-12 International Business Machines Corporation Linking Data Elements Based on Similarity Data Values and Semantic Annotations
CN103810203A (en) * 2012-11-13 2014-05-21 深圳市腾讯计算机系统有限公司 Connection multiplexing method and connection multiplexing device for database management system
CN104239365A (en) * 2013-06-24 2014-12-24 北京新媒传信科技有限公司 Database connection pool and method for acquiring links in database connection pool

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1448867A (en) * 2002-03-30 2003-10-15 深圳市中兴通讯股份有限公司 Method for accessing database system uniformly
US20130332467A1 (en) * 2012-06-08 2013-12-12 International Business Machines Corporation Linking Data Elements Based on Similarity Data Values and Semantic Annotations
CN102902779A (en) * 2012-09-28 2013-01-30 五八有限公司 Connection method and connection device of multiple databases
CN103810203A (en) * 2012-11-13 2014-05-21 深圳市腾讯计算机系统有限公司 Connection multiplexing method and connection multiplexing device for database management system
CN104239365A (en) * 2013-06-24 2014-12-24 北京新媒传信科技有限公司 Database connection pool and method for acquiring links in database connection pool

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106021544A (en) * 2016-05-27 2016-10-12 北京京东尚科信息技术有限公司 Distributive connection pool management method and system for databases
CN106354801A (en) * 2016-08-26 2017-01-25 广州唯品会信息科技有限公司 Distributed database connection method and device
CN106354801B (en) * 2016-08-26 2019-12-20 广州品唯软件有限公司 Distributed database connection method and device
CN106650501A (en) * 2016-12-30 2017-05-10 迈普通信技术股份有限公司 Database access control method and apparatus
CN108270719A (en) * 2016-12-30 2018-07-10 广东精点数据科技股份有限公司 A kind of data safe transmission method and device based on digital signature
CN106650501B (en) * 2016-12-30 2019-12-06 迈普通信技术股份有限公司 Database access control method and device
CN108805095A (en) * 2018-06-19 2018-11-13 Oppo广东移动通信有限公司 image processing method, device, mobile terminal and computer readable storage medium
CN108898169A (en) * 2018-06-19 2018-11-27 Oppo广东移动通信有限公司 Image processing method, picture processing unit and terminal device
CN108898587A (en) * 2018-06-19 2018-11-27 Oppo广东移动通信有限公司 Image processing method, picture processing unit and terminal device
CN108961157A (en) * 2018-06-19 2018-12-07 Oppo广东移动通信有限公司 Image processing method, picture processing unit and terminal device
CN109284311B (en) * 2018-08-14 2020-10-23 四川虹美智能科技有限公司 Method and device for acquiring database connection
CN109284311A (en) * 2018-08-14 2019-01-29 四川虹美智能科技有限公司 A kind of method and apparatus obtaining database connection
CN109241037A (en) * 2018-08-28 2019-01-18 郑州云海信息技术有限公司 A kind of method, apparatus that realizing database processing, equipment and storage medium
CN111061759A (en) * 2018-10-17 2020-04-24 联易软件有限公司 Data query method and device
CN111930830A (en) * 2020-06-22 2020-11-13 心有灵犀科技股份有限公司 Distributed transaction data processing method and system based on shared database
CN113467966A (en) * 2021-05-31 2021-10-01 珠海大横琴科技发展有限公司 Data processing method and device

Similar Documents

Publication Publication Date Title
CN105138693A (en) Method and device for having access to databases
US20190228303A1 (en) Method and apparatus for scheduling resource for deep learning framework
CN102402548B (en) Method and system for controlling data query of application system
CN107113341B (en) System for high throughput processing of transactions in a distributed relational database management system for data partitioning
CN110427775B (en) Data query authority control method and device
CN111078436B (en) Data processing method, device, equipment and storage medium
CN104616142B (en) Data transfer method, server, mobile terminal and system
CN104126179A (en) Method, apparatus, and computer program product for inter-core communication in multi-core processors
CN107465687B (en) Method, device and terminal for realizing permission configuration
CN111796937B (en) Memory-based resource allocation method, computer equipment and storage medium
CN112306719A (en) Task scheduling method and device
CN104835004A (en) Guest room information management method and system
CN105787791B (en) Service request processing method and device
CN116016653A (en) Information pushing method and device of blockchain, electronic equipment and storage medium
CN102360312A (en) Equipment scheduling method
CN112995982B (en) Method, device, server and storage medium for scheduling cloud SIM card
CN105610596A (en) Resource directory management method and network terminal
CN110808961B (en) Data processing method and device for security verification
CN110493735B (en) Short message processing method and device
CN111842167B (en) Method and device for sorting articles
CN104640103A (en) Intelligent card MSISD (mobile subscriber international ISDN (integrated service digital network)) number configuration method and device
CN110908746A (en) Data processing method, system, readable storage medium and terminal equipment
CN110661792B (en) Service ordered calling method and device, electronic equipment and storage medium
CN108256989B (en) Data display method and system of fund preparation system
CN114936226A (en) Message association method, associated message query method, device, equipment and medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20151209