Nothing Special   »   [go: up one dir, main page]

CN107291747A - A kind of management method of database connection pool, apparatus and system - Google Patents

A kind of management method of database connection pool, apparatus and system Download PDF

Info

Publication number
CN107291747A
CN107291747A CN201610202032.9A CN201610202032A CN107291747A CN 107291747 A CN107291747 A CN 107291747A CN 201610202032 A CN201610202032 A CN 201610202032A CN 107291747 A CN107291747 A CN 107291747A
Authority
CN
China
Prior art keywords
database
application component
information
component
connection pool
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
CN201610202032.9A
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.)
BEIJING UNION VOOLE TECHNOLOGY Co Ltd
Original Assignee
BEIJING UNION VOOLE TECHNOLOGY Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BEIJING UNION VOOLE TECHNOLOGY Co Ltd filed Critical BEIJING UNION VOOLE TECHNOLOGY Co Ltd
Priority to CN201610202032.9A priority Critical patent/CN107291747A/en
Publication of CN107291747A publication Critical patent/CN107291747A/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/25Integrating or interfacing systems involving database management systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention provides a kind of management method of database connection pool, apparatus and system, and this method includes:Receive the request for the request for data storehouse connection pool that application component is sent;Judge the corresponding database connection pool of information that application component accesses database whether is preserved in shared data bank Pool Component;If it is, the corresponding database connection pool of information that application component is accessed into database distributes to application component;If not, the information of database is accessed according to application component, the corresponding database connection pool of information that application component accesses database is set up in shared data bank Pool Component, and the corresponding database connection pool of information that the application component of foundation is accessed into database distributes to application component.The present invention improves the response speed connected between the speed and application program and database that access database.

Description

A kind of management method of database connection pool, apparatus and system
Technical field
The present invention relates to database application technical field, more particularly to a kind of management method of database connection pool, apparatus and system.
Background technology
Database connection pool is used to distributing, manage and discharging database connection, the database that the releasing idling time exceedes maximum idle time connects to avoid because omitting without connecting caused by release database connection, and this technology can significantly improve the performance to database manipulation.
Usually, multiple database connections are initialized in database connection pool, to wait application call.One application program transfers a database connection from database connection pool every time, the database connection now transferred can not be transferred by other application program, after application program is connected using its database transferred that is over, database connection pool is given back by database connection.When the database connection in database connection pool is all transferred, database connection pool creates new database connection, until the database connection number of establishment reaches that the maximum data storehouse of permission connects number.
At present, database is provided frequently with the mode that database connection pool is shared for application program to connect, as shown in Figure 1, for the schematic diagram of existing multiple one database connection pool of Application sharing, now database connection pool is referred to as shared data bank connection pool, shared data bank connection pool is arranged on a JVM (java virtual machines), each application program is separately mounted to different JVM, each application program is separately mounted to from shared database connection pool in different JVM, now, when any application program transfers the database connection in shared data bank connection pool, need by specific agreement and interface, communicated with shared database connection pool.
But, application program is connected by way of agreement or interface to be set up with shared database connection pool, so as to reach the purpose for accessing database, this will certainly influence the response speed connected between application program and database.
The content of the invention
The present invention provides a kind of management method of database connection pool, apparatus and system, be connected to solve application program of the prior art by way of agreement or interface to be set up with shared database connection pool, and connected between the influence application program and database brought response speed the problem of.
A kind of management method of database connection pool, including:
Receive the request of request for data storehouse connection pool from shared data bank Pool Component that application component is sent, the information that the application component accesses database is carried in the request of request for data storehouse connection pool, the application component and the shared data bank Pool Component are previously deployed in same OSGI frameworks in the form of open service gateway initiative promoter's OSGI components respectively;
Judge the corresponding database connection pool of information that the application component accesses database whether is preserved in the shared data bank Pool Component;
If it is, the corresponding database connection pool of information that the application component is accessed into database distributes to the application component;
If not, the information of database is accessed according to the application component, the corresponding database connection pool of information that the application component accesses database is set up in the shared data bank Pool Component, and the corresponding database connection pool of information that the application component of foundation is accessed into database distributes to the application component.
In methods described, the information of database is accessed according to the application component, the corresponding database connection pool of information that the application component accesses database is set up in the shared data bank Pool Component, is specifically included:
The information registering that the application component is accessed into database obtains the corresponding database connection pool of information that the application component accesses database into the registration table of the shared data bank Pool Component;And
The obtained application component is accessed to the reference number of times of the corresponding database connection pool of information of database, the information of database is accessed with the application component, correspondence storage is into the registration table of the shared data bank Pool Component, and the reference number of times of the database connection pool refers to that the database connection pool is assigned to the number of times of application component after program assembly application is employed.
The embodiment of the present invention, the information realization that database is accessed by being registered in registration table sets up database connection pool, and the database connection pool can be recorded in real time be assigned to the number of times of application component, consequently facilitating safeguarding the database connection pool in shared data bank Pool Component.
In methods described, the mark of the application component is also carried in the request of request for data storehouse connection pool, then, it is determined that the corresponding database connection pool of information that the application component is accessed into database is distributed to after the application component, this method further comprises:
The mark of the application component is accessed into the information of database with the application component, correspondence storage is into the linkage record table of the shared data bank Pool Component.
The storage corresponding with the information for accessing database of the mark of application component is arrived linkage record table by the embodiment of the present invention, can provide premise for the maintenance of shared data bank Pool Component.
Methods described, further comprises:
It is determined that after the corresponding database connection pool of information that the application component of foundation is accessed into database distributes to the application component, the reference number of times that the application component is accessed to the corresponding database connection pool of information of database adds 1, and the initial value that the application component accesses the reference number of times of the corresponding database connection pool of information of database is 0.
The embodiment of the present invention, database connection pool is often allocated once, and the reference number of times of the database connection pool just adds one.
Methods described, in addition to:
When listening to the message for the corresponding database connection pool of information that the application component discharges the application component access database, the reference number of times that the application component is accessed to the corresponding database connection pool of information of database subtracts 1;
Judge whether the reference number of times that application component described in the registration table accesses the corresponding database connection pool of information of database is 0;
If, the mark and the application component for deleting the application component of correspondence storage in the linkage record table access the information of database, and delete the reference number of times that the information and the application component that the corresponding application component stored accesses database in the registration table access the corresponding database connection pool of information of database;
If not, deleting in the linkage record table, the mark of the application component of correspondence storage accesses the information of database with the application component.
The embodiment of the present invention, can either save the resource of shared data bank Pool Component, additionally it is possible to reach the purpose of real-time update registration table and linkage record table, so as to realize the maintenance to shared data bank Pool Component.
In methods described, the mark of the application component is carried in the message for the corresponding database connection pool of information that the release application component accesses database, the reference number of times that the application component is then accessed to the corresponding database connection pool of information of database subtracts 1, specifically includes:
According to the mark of the application component, the corresponding information for accessing database of mark of the application component is inquired about from the linkage record table;
According to the information of the access database inquired, the corresponding reference number of times of information of the access database is inquired about from the registration table, and the reference number of times inquired is subtracted 1.
The embodiment of the present invention, by discharging the mark of the application component in database connection pool message, linkage record table and registration table, realizes the renewal to the database connection pool in database Pool Component.
In methods described, judge the corresponding database connection pool of information that the application component accesses database whether is preserved in the shared data bank Pool Component, specifically include:
Whether information that the application component access database is preserved in the registration table or linkage record table of inquiring about the shared data bank Pool Component;
If it is, determining to preserve the corresponding database connection pool of information that the application component accesses database in the shared data bank Pool Component;
If not, determining not preserving the corresponding database connection pool of information that the application component accesses database in the shared data bank Pool Component.
The embodiment of the present invention can determine the corresponding database connection pool of information that application component accesses database whether is preserved in shared data bank Pool Component by judging the information that application component accesses database whether is preserved in registration table or linkage record table.
The present invention also provides a kind of managing device of database connection pool, including:
Receiving unit, the request of request for data storehouse connection pool from shared data bank Pool Component for receiving application component transmission, the information that the application component accesses database is carried in the request of request for data storehouse connection pool, the application component and the shared data bank Pool Component are previously deployed in same OSGI frameworks in the form of open service gateway initiative promoter's OSGI components respectively;
Judging unit, for judging the corresponding database connection pool of information that the application component accesses database whether is preserved in the shared data bank Pool Component;
Allocation unit, in the case of judging to be in the judging unit, the corresponding database connection pool of information that the application component is accessed into database distributes to the application component;
Set up unit, for the judging unit judge it is no in the case of, the information of database is accessed according to the application component, the corresponding database connection pool of information that the application component accesses database is set up in the shared data bank Pool Component, and the corresponding database connection pool of information that the application component of foundation is accessed into database distributes to the application component.
In described device, the unit of setting up is accessing the information of database according to the application component, when the application component is set up in the shared data bank Pool Component accessing the corresponding database connection pool of information of database, specifically for:
The information registering that the application component is accessed into database obtains the corresponding database connection pool of information that the application component accesses database into the registration table of the shared data bank Pool Component;And
The obtained application component is accessed to the reference number of times of the corresponding database connection pool of information of database, the information of database is accessed with the application component, correspondence storage is into the registration table of the shared data bank Pool Component, and the reference number of times of the database connection pool refers to that the database connection pool is assigned to the number of times of application component after program assembly application is employed.
Described device, in addition to:
Memory cell, mark for also carrying the application component in the request of request for data storehouse connection pool, and determine to distribute to the information corresponding database connection pool that the application component accesses database after the application component, the mark of the application component is accessed into the information of database with the application component, correspondence storage is into the linkage record table of the shared data bank Pool Component.
Described device, further comprises:
Monitoring unit, for determining after the information correspondence database connection pool that the application component of foundation accesses database distributed into the application component, the reference number of times that the application component is accessed to the corresponding database connection pool of information of database adds 1, and the initial value that the application component accesses the reference number of times of the corresponding database connection pool of information of database is 0;
When listening to the message for the corresponding database connection pool of information that the application component discharges the application component access database, the reference number of times that the application component is accessed to the corresponding database connection pool of information of database subtracts 1;
Judge whether the reference number of times that application component described in the registration table accesses the corresponding database connection pool of information of database is 0;
If, the mark and the application component for deleting the application component stored in the linkage record table access the information of database, and delete the information and the reference number of times of the corresponding database connection pool of the application component of the application component access database stored in the registration table;
If not, deleting in the linkage record table, the mark of the application component accesses the information of database with the application component.
Described device, the mark of the application component is carried in the message for the corresponding database connection pool of information that the release application component accesses database, then the monitoring unit is when the reference number of times of the corresponding database connection pool of information that the application component is accessed to database subtracts 1, specifically for:
According to the mark of the application component, the corresponding information for accessing database of mark of the application component is inquired about from the linkage record table;
According to the information of the access database inquired, the corresponding reference number of times of information of the access database is inquired about from the registration table, and the reference number of times inquired is subtracted 1.
In described device, the judging unit specifically for:
Whether information that the application component access database is preserved in the registration table or linkage record table of inquiring about the shared data bank Pool Component;
If it is, determining to preserve the corresponding database connection pool of information that the application component accesses database in the shared data bank Pool Component;
If not, determining not preserving the corresponding database connection pool of information that the application component accesses database in the shared data bank Pool Component.
The present invention also provides a kind of management system of database connection pool, including:
Application component, request for sending from request for data storehouse connection pool to shared data bank Pool Component, the information that the application component accesses database is carried in the request of request for data storehouse connection pool, the application component and the shared data bank Pool Component are previously deployed in same OSGI frameworks in the form of open service gateway initiative promoter's OSGI components respectively;
Shared data bank Pool Component, the request of request for data storehouse connection pool from shared data bank Pool Component for receiving application component transmission, judges the corresponding database connection pool of information that the application component accesses database whether is preserved in the shared data bank Pool Component;If it is, the corresponding database connection pool of information that the application component is accessed into database distributes to the application component;If not, the information of database is accessed according to the application component, the corresponding database connection pool of information that the application component accesses database is set up in the shared data bank Pool Component, and the corresponding database connection pool of information that the application component of foundation is accessed into database distributes to the application component.
Using the management method of database connection pool provided in an embodiment of the present invention, apparatus and system, have the advantages that:
By building OSGI frameworks in same JVM, by application program to be deployed in the form of OSGI components in OSGI frameworks, and affix one's name to shared data bank Pool Component in OSGI frame mid portions, in the shared data bank Pool Component, database connection pool is set up according to the information that application component accesses database, when the information of different application component accesses database is identical, the shared of cdr database connection pool can be achieved, it is possible to prevente effectively from the waste of database connection pool resource, all it is the OSGI components in OSGI frameworks due to application component and shared data bank Pool Component, interacted between application component and shared data bank Pool Component by way of service, exploited natural resources so as to effective saving.In addition, the embodiment of the present invention to communicate by way of service between shared data bank Pool Component and each application component, so as to the shared database Pool Component of each application component in same JVM, compared to mode of the application program by way of agreement or interface to be communicated with the shared data bank connection pool under another JVM being located in different JVM of prior art, application program is improved to a certain extent sets up the speed being connected with database connection pool, so as to improve the speed that application program accesses database to a certain extent, and improve the response speed connected between application program and database.
Brief description of the drawings
The schematic diagram for multiple Application sharing database connection pools that Fig. 1 provides for prior art;
Fig. 2 is the management method flow chart of database connection pool provided in an embodiment of the present invention;
Fig. 3 is the connection diagram of multiple application components provided in an embodiment of the present invention and shared database connection pool component;
The method flow diagram that Fig. 4 is safeguarded for the database connection pool in the Pool Component provided in an embodiment of the present invention to shared data bank;
The method flow diagram that Fig. 5 subtracts 1 for the reference number of times of the information corresponding database connection pool provided in an embodiment of the present invention that will access database;
Fig. 6 is the method flow diagram provided in an embodiment of the present invention for judging whether to preserve the corresponding database connection pool of information for accessing database in shared data bank Pool Component;
Fig. 7 is the implementation process flow chart of embodiment one provided in an embodiment of the present invention;
Fig. 8 is the implementation process flow chart of embodiment two provided in an embodiment of the present invention;
Fig. 9 is the connection diagram of application component provided in an embodiment of the present invention and shared database connection pool component;
Figure 10 is the implementation process flow chart of embodiment three provided in an embodiment of the present invention;
Figure 11 is one of managing device schematic diagram of database connection pool provided in an embodiment of the present invention;
Figure 12 is the two of the managing device schematic diagram of database connection pool provided in an embodiment of the present invention;
Figure 13 is the three of the managing device schematic diagram of database connection pool provided in an embodiment of the present invention.
Figure 14 is the management system schematic diagram of database connection pool provided in an embodiment of the present invention.
Embodiment
The management method of the database connection pool provided with reference to the accompanying drawings and examples the present invention, apparatus and system are described in more detail.
The embodiment of the present invention provides a kind of management method of database connection pool, as shown in Fig. 2 including:
Step 101, receive the request of request for data storehouse connection pool from shared data bank Pool Component that application component is sent, the information that the application component accesses database is carried in the request of request for data storehouse connection pool, the application component and the shared data bank Pool Component in the form of OSGI components respectively to be previously deployed in same OSGI frameworks.
Specifically, carrying the information that application component accesses database in the request of request for data storehouse connection pool, accessing the information of database includes:Need the information such as driving class mark, URL addresses, the username and password of database of access.Application component in the embodiment of the present invention database to be accessed is preferably adduction relationship type database, or other types of database.Adduction relationship type database include oracle, mysql and other.Specifically, each adduction relationship type database can correspond to the driving class mark of a database.
Multiple database connection pools can be included in one shared data bank Pool Component, receive application component transmission from shared data bank Pool Component during the request of request for data storehouse connection pool, the request of this application database connection pool is parsed, so as to obtain the information that the application component carried in the request of request for data storehouse connection pool accesses database.
OSGI English full name is Open Services Gateway Initiative, and Chinese full name is open service gateway initiative promoter.OSGI frameworks are built in a JVM in advance, such as ServiceMix platforms, and in advance by each application program to be deployed in the form of OSGI components in the OSGI frameworks, i.e., application component and shared data bank Pool Component in the embodiment of the present invention are the different OSGI components in same OSGI frameworks, and, the different OSGI components of different application program correspondences, shared data Pool Component in the embodiment of the present invention is an OSGI component, may include multiple database connection pools in the shared Pool Component.Each application component in the OSGI frameworks can send the request of request for data storehouse connection pool to shared data bank Pool Component, also, multiple application components can send the request of request for data storehouse connection pool to shared data bank Pool Component simultaneously.
In OSGI frameworks, it is in communication with each other between OSGI components by way of service, service, which is divided into issuing service and quoted, to be serviced, the request of application component request for data storehouse connection pool can be understood as issuing the service of request for data storehouse connection pool in the embodiment of the present invention, you can be interpreted as application component by way of issuing service with shared database connection pool assembly communication;Shared data bank Pool Component quotes the service of the request for data storehouse connection pool of application component issue, you can communicated with being interpreted as shared data bank Pool Component by way of the service of quoting with application component.It is illustrated in figure 3 connection diagram of the multiple application components provided in an embodiment of the present invention with shared database connection pool component in the way of servicing, wherein, the corresponding database connection pool of information that application component accesses database by the application component accesses the database in Fig. 3.
Step 102, judge the corresponding database connection pool of information that the application component accesses database whether is preserved in the shared data bank Pool Component, if it is, performing step 103, otherwise, perform step 104.
Specifically, the corresponding database connection pool of information that the application component accesses database is the database connection pool of the application component application.If the saved application component accesses the corresponding database connection pool of information of database in shared data bank Pool Component, the database connection pool is distributed into the application component.
The information of access database in the embodiment of the present invention is corresponded with the database connection pool in shared database connection pool component, specifically, if the information that two application components access database is identical, the database connection pool of the two application component applications is identical.
Wherein, for each application component, when determining that the application component is preserved in shared data bank Pool Component accesses the information of database, determine to preserve the corresponding database connection pool of information that the application component accesses database in the shared data bank Pool Component, that is, determine to preserve the database connection pool of the application component application in shared data bank Pool Component;Otherwise, it determines the corresponding database connection pool of information that the application component accesses database is not preserved in the shared data bank Pool Component.
Preferably, shared data bank of embodiment of the present invention Pool Component is sky in original state, i.e., when not receiving the request for the request for data storehouse connection pool that any application component is sent, any database connection pool is not preserved in the shared data bank Pool Component, certainly, shared data bank Pool Component initially can also pre-save the corresponding database connection pool of information of more common application component accesses database, not limit here.
Step 103, the corresponding database connection pool of information for the application component being accessed into database distributes to the application component.
Step 104, the information of database is accessed according to the application component, the corresponding database connection pool of information that the application component accesses database is set up in the shared data bank Pool Component, and the corresponding database connection pool of information that the application component of foundation is accessed into database distributes to the application component.
Specifically, one application component can be by the different database connection pool of the information applications of different access databases, and accesses the corresponding database of the database connection pool by the database connection pool of application, wherein, information one database connection pool of correspondence of an access database.After a database connection pool is distributed for application component, if the application component needs to access the database connection pool again, it is not required to send the request of request for data storehouse connection pool to shared data bank Pool Component again, but database is directly accessed by allocated database connection pool;If the application component has discharged the database connection pool that it has been applied, when then the application component accesses the corresponding database of the database connection pool again, the request to shared data bank Pool Component transmission request for data storehouse connection pool is needed, to obtain Data Connection Pool.I.e., the embodiment of the present invention, for each application component, after the connection pool of application component success request for data storehouse, during discharging the database connection pool of its application to the application component, the application component will not send the request of request for data storehouse connection pool to shared data bank Pool Component again.After application component allocation database connection pool, application component can access database by the database connection pool, and concrete application program assembly can be found in existing mode by way of the database connection pool accesses database, be not detailed here.
The executive agent of the embodiment of the present invention can be shared data bank Pool Component, can be the module in shared data bank Pool Component, or independently of the third party device or module of shared data bank Pool Component.When determining not preserve the application component in shared data bank Pool Component and accessing the corresponding database connection pool of information of database, the application component is set up in shared data bank Pool Component and accesses the corresponding database connection pool of information of database, and the newly-built database connection pool is distributed into the application component.
The embodiment of the present invention, by building OSGI frameworks in same JVM, by application program to be deployed in the form of OSGI components in OSGI frameworks, and affix one's name to shared data bank Pool Component in OSGI frame mid portions, in the shared data bank Pool Component, database connection pool is set up according to the information that application component accesses database, when the information of different application component accesses database is identical, the shared of database connection pool can be achieved, it is possible to prevente effectively from the waste of database connection pool resource, all it is the OSGI components in OSGI frameworks due to application component and shared data bank Pool Component, interacted between application component and shared data bank Pool Component by way of service, exploited natural resources so as to effective saving.In addition, the embodiment of the present invention to communicate by way of service between shared data bank Pool Component and each application component, so as to the shared database Pool Component of each application component in same JVM, compared to mode of the application program by way of agreement or interface to be communicated with the shared data bank connection pool under another JVM being located in different JVM of prior art, application program is improved to a certain extent sets up the speed being connected with database connection pool, general speed can lift more than ten times, so as to improve the speed that application program accesses database to a certain extent, and improve the response speed connected between application program and database.
The embodiment of the present invention OSGI frame mid portions affix one's name to shared data bank Pool Component mode be:The 1st, the shared data bank Pool Component of OSGI forms is copied directly to the deployment that shared data bank Pool Component is completed under a kind of heat deployment catalogue of ServiceMix platforms (OSGI frameworks);2nd, by the Features orders of ServiceMix platforms, the heat deployment of shared data bank Pool Component is completed.The mode for affixing one's name to application component in OSGI frame mid portions is identical with the mode that shared data bank Pool Component is affixed one's name in OSGI frame mid portions, does not repeat here.
Preferably, in step 104, the information of database is accessed according to the application component, the corresponding database connection pool of information that the application component accesses database is set up in the shared data bank Pool Component, is specifically included:
The information registering that the application component is accessed into database obtains the corresponding database connection pool of information that the application component accesses database into the registration table of the shared data bank Pool Component;And
The obtained application component is accessed to the reference number of times of the corresponding database connection pool of information of database, the information of database is accessed with the application component, correspondence storage is into the registration table of the shared data bank Pool Component, and the reference number of times of the database connection pool refers to that the database connection pool is assigned to the number of times of application program after program assembly application is employed.
Specifically, application component is accessed into the information registering of database into the registration table of the shared data bank Pool Component, as set up the process of database connection pool, stored especially by the information that application component is accessed to database into any idle list item of registration table, realize and application component is accessed into the information registering of database into the registration table of the shared data bank Pool Component.
The program assembly that is applied is accessed after the corresponding database connection pool of information of database, the database connection pool is quoted into number of times storage corresponding with the information of application component access database, and the reference number of times of database connection pool now is defined as initial value, i.e., when initially setting up database connection pool, reference number of times is initial value, and initial value is preferably set as 0 by the embodiment of the present invention, it can also be other values, not limit here.
The embodiment of the present invention is by the reference number of times of obtained database connection pool, after storage corresponding with the information that the application component accesses database is into the registration table of the shared data bank Pool Component, the program assembly that is applied accesses the corresponding relation of the reference number of times of the information database connection pool corresponding with the information that application component accesses database of database.After application component allocation database connection pool, the reference number of times of the database connection pool adds 1.If the information that multiple application components access database is identical, then this multiple application component corresponds to same database connection pool, now, same in multiple application component correspondence registration tablies accesses the corresponding relation of the reference number of times of the information and date storehouse connection pool of database, i.e., in the embodiment of the present invention, the information and date storehouse connection pool of the access database in registration table is corresponded.
The embodiment of the present invention, when receiving the request of request for data storehouse connection pool of application component transmission, parse the request of request for data storehouse connection pool, obtain the information of application component access database carried in the request, information registering by the way that application component to be accessed to database realizes the establishment of database connection pool into the registration table of shared data bank Pool Component.After database connection pool is set up, the reference number of times of the database connection pool of the foundation is stored into registration table, maintenance of the later stage to the shared data bank connection pool in shared data bank Pool Component can be easy to.
Further preferably, the mark of the application component is also carried in the request of request for data storehouse connection pool, then determine to distribute to the information corresponding database connection pool that the application component accesses database after the application component, further comprise:
The mark of the application component is accessed into the information of database with the application component, correspondence storage is into the linkage record table of the shared data bank Pool Component.
Specifically, the mark of application component can be the mark of application program itself, or the mark of the corresponding OSGI components of the application component, do not limit here.
The embodiment of the present invention, after the corresponding database connection pool of application component is set up, the mark of the application component carried in further being asked according to request for data storehouse connection pool and the information for accessing database, linkage record table is arrived into the storage corresponding with the information for accessing database of the mark of application component, premise can be provided for the maintenance of shared data bank Pool Component.The embodiment of the present invention is not preserved in shared data bank Pool Component under the scene for the corresponding database connection pool of information that application component accesses database, is implemented it is determined that establishing after the corresponding database connection pool of application component.
The corresponding database connection pool of information that application component accesses database is preserved in shared data bank Pool Component, and, when determining the application component for its apllied database connection pool of first application, the reference number of times of the database connection pool adds 1, and the mark of the application component is accessed into the information of database with the application component, correspondence storage is into the linkage record table of shared data bank Pool Component.
Specifically, the number of times that each database connection pool is assigned to application component after program assembly application is employed is recorded in real time, preferably, it is determined that after the corresponding database connection pool of information that the application component of foundation is accessed into database distributes to the application component, further comprising:
The reference number of times that the application component is accessed to the corresponding database connection pool of information of database adds 1, and the initial value that the application component accesses the reference number of times of the corresponding database connection pool of information of database is 0.
Specifically, after the corresponding database connection pool of information of application component access database is set up for application component, the database connection pool set up is distributed for the application component, and the reference number of times of the database connection pool is added 1, i.e. database connection pool is often allocated once, the reference number of times of the database connection pool just adds one, when implementing, can for each database connection pool set a counter, using the value of the counter as the database connection pool reference number of times.For each application component, the application component sends the request of request for data storehouse connection pool to database connection pool component, and, distributed for the application component after corresponding database connection pool, the reference number of times for being assigned to the database connection pool of application component plus 1, also, the application component will not send the request that the database connection pool of the application component has been distributed in application to shared data bank Pool Component again;After the database connection pool of the application component has been distributed in application component release, the application component can send the request for applying for the database connection pool being released to shared data bank connection pool again.
Preferably, the management method of database connection pool provided in an embodiment of the present invention, as shown in figure 4, also including:
Step 201, when listening to the message for the corresponding database connection pool of information that the application component discharges the application component access database, the reference number of times that the application component is accessed to the corresponding database connection pool of information of database subtracts 1.
Specifically, when application component is unloaded from OSGI frameworks, or during application component closing, or when listening to application component and being not carried out any operation in certain time length, application component can send the message of its database connection pool applied of release, whether the application component that the embodiment of the present invention monitors request for data storehouse connection pool in real time sends the message for discharging database connection pool, if it is, the reference number of times that the application component is accessed to the corresponding database connection pool of information of database subtracts 1.Wherein it is preferred to, when setting application component is unloaded from OSGI frameworks, send the message of its database connection pool applied of release.
Step 202, judge whether the reference number of times that application component described in the registration table accesses the corresponding database connection pool of information of database is 0, if it is, performing step 203, otherwise, perform step 204.
Step 203, the mark and the application component for deleting the application component of correspondence storage in the linkage record table access the information of database, and delete the reference number of times that the information and the application component that the corresponding application component stored accesses database in the registration table access the corresponding database connection pool of information of database.
Specifically, when the reference number of times of database connection pool is 0 (initial value), illustrate that no application component is being used the database connection pool, now, the information for quoting number of times and the corresponding access database of the database connection pool of the database connection pool of correspondence storage in registration table can be deleted, so as to reach the purpose that the database connection pool is deleted from shared data bank Pool Component, and then save the resource of shared data bank Pool Component.After application component discharges the database connection pool of its application, the mark and the application component that the application component is deleted from linkage record table access the information of database, so as to save the resource of shared data bank Pool Component.
Step 204, delete in the linkage record table, the mark of the application component of correspondence storage accesses the information of database with the application component.
Specifically, when the reference number of times of the apllied database connection pool of application component is not 0, the mark and the application component for only deleting the application component of correspondence storage in linkage record table access the information of database, so as to save the resource of shared data bank Pool Component.
The embodiment of the present invention, can either save the resource of shared data bank Pool Component, additionally it is possible to reach the purpose of real-time update registration table and linkage record table, so as to realize the maintenance to shared data bank Pool Component.
When application component is unloaded from OSGI frameworks, under the scene for the message for sending the database connection pool for discharging its application, preferably, the mark of the application component is carried in the message for the corresponding database connection pool of information that the release application component accesses database, then in step 201, the reference number of times that the application component is accessed to the corresponding database connection pool of information of database subtracts 1, as shown in figure 5, specifically including:
Step 301, according to the mark of the application component, the corresponding information for accessing database of mark of the application component is inquired about from the linkage record table.
Step 302, according to the information of the access database inquired, the corresponding reference number of times of information of the access database is inquired about from the registration table, and the reference number of times inquired is subtracted 1.
Due to have recorded the mark of the application component of allocated database connection pool in linkage record table, therefore, when carrying the mark of application component in the message for discharging database connection pool, the mark of the application component in the message can be obtained by parsing, so that it is determined that the application component of release database connection pool.According to the mark of the application component of the release database connection pool, this is inquired about from linkage record table and identifies the corresponding essential information for accessing database using application component;Further according to the information of the access database, inquire about in registration table, the reference number of times of the corresponding database connection pool of information of the access database, and the reference number of times of the database connection pool inquired is subtracted 1.
The embodiment of the present invention, by discharging the mark of the application component in database connection pool message, linkage record table and registration table, realizes the renewal to the database connection pool in shared data bank Pool Component.
The information that the application component accesses database can also be carried in the message of application component release database connection pool in the embodiment of the present invention, now, the reference number of times that the application component carried in the message accesses the corresponding database connection pool of information of database is inquired about from registration table, and the number of times inquired is subtracted 1.
Preferably, step 102, judge the corresponding database connection pool of information that the application component accesses database whether is preserved in the shared data bank Pool Component, as shown in fig. 6, specifically including:
Step 401, the information that the application component accesses database whether is preserved in the registration table or linkage record table of inquiring about the shared data bank Pool Component, if it is, performing step 402, otherwise, step 403 is performed.
Step 402, determine to preserve the corresponding database connection pool of information that the application component accesses database in the shared data bank Pool Component.
Step 403, determine not preserving the corresponding database connection pool of information that the application component accesses database in the shared data bank Pool Component.
Specifically, the embodiment of the present invention can determine the corresponding database connection pool of information that application component accesses database whether is preserved in shared data bank Pool Component by judging the information that application component accesses database whether is preserved in registration table or linkage record table.
Illustrate the management method of database connection pool provided in an embodiment of the present invention with reference to specific embodiment.
Embodiment one
As shown in fig. 7, one of specific embodiment of the management method of database connection pool provided in an embodiment of the present invention, including:
Step 501, shared data bank Pool Component receives the request for the request for data storehouse connection that the application component in OSGI frameworks is sent in the way of servicing, and the information that the application component accesses database is carried in the request.
Step 502, shared data bank Pool Component judges the corresponding database connection pool of information that the application component accesses database whether is preserved in the registration table of shared data bank Pool Component, if it is, performing step 503, otherwise, performs step 504.
Step 503, shared data bank Pool Component determines that saving the application component accesses the corresponding database connection pool of information of database, and the database connection pool is distributed into the application component.
Step 504, shared data bank Pool Component determines not preserving the corresponding database connection pool of information that the application component accesses database, and the application component is accessed into the information registering of database into the registration table of the shared data bank Pool Component, obtain the corresponding database connection pool of information that the application component accesses database, and, by the reference number of times of obtained database connection pool, the information of database is accessed with the application component, correspondence storage is into the registration table of shared data bank Pool Component.
Step 505, the corresponding database connection pool of information that the obtained application component accesses database is distributed to the application component by shared data bank Pool Component.
Step 506, the reference number of times of the corresponding database connection pool of information of application component access database is added 1 by shared data bank Pool Component.
Embodiment two
As shown in figure 8, one of specific embodiment of the management method of database connection pool provided in an embodiment of the present invention, including:
Step 601, shared data bank Pool Component receives the request for the request for data storehouse connection that the application component in OSGI frameworks is sent in the way of servicing, and the mark and the application component that the application component is carried in the request access the information of database.
Step 602, shared data bank Pool Component judges the corresponding database connection pool of information that the application component accesses database whether is preserved in the registration table of shared data bank Pool Component, if it is, performing step 603, otherwise, performs step 604.
Step 603, shared data bank Pool Component determines that saving the application component accesses the corresponding database connection pool of information of database, and the database connection pool is distributed into the application component.
Step 604, shared data bank Pool Component determines not preserving the corresponding database connection pool of information that the application component accesses database, and the application component is accessed into the information registering of database into the registration table of the shared data bank Pool Component, obtain the corresponding database connection pool of information that the application component accesses database, and by the reference number of times of obtained database connection pool, the information of database is accessed with the application component, correspondence storage is into the registration table of shared data bank Pool Component.
Step 605, the corresponding database connection pool of information that the application component of foundation accesses database is distributed to the application component by shared data bank Pool Component.
Step 606, the reference number of times that shared data bank Pool Component accesses the application component the corresponding database connection pool of information of database adds 1, the mark of the application component is accessed into the information of database with the application component, correspondence storage is into the linkage record table of shared data bank Pool Component.
Fig. 9 is the connection diagram of application component provided in an embodiment of the present invention and shared database connection pool component, Fig. 9 is a kind of example, the connection diagram of an application component and shared database connection pool component is only enumerated, the embodiment of the present invention can be multiple application components request for data storehouse connection pool from Fig. 9 shared data bank Pool Component simultaneously.
Embodiment three
As shown in Figure 10, be database connection pool provided in an embodiment of the present invention management method in the method safeguarded to shared data bank Pool Component, including:
Step 701, shared data bank Pool Component judges whether that listening to application component discharges the message that the application component accesses the corresponding database connection pool of information of database, if it is, performing step 702, otherwise, performs step 701.
Step 702, the mark of the application component carried in the message that the parsing of shared data bank Pool Component is listened to.
Step 703, shared data bank Pool Component inquires about the corresponding information for accessing database of mark of the application component according to the mark for the application component being resolved to from linkage record table.
Step 704, shared data bank Pool Component is according to the information for accessing database inquired, the reference number of times of the corresponding database connection pool of information of the access database is inquired about from registration table, and the reference number of times of the corresponding database connection pool of information of the access database inquired is subtracted 1, the reference number of times after being updated.
Step 705, shared data bank Pool Component judges to quote whether number of times is 0 after updating, if it is, performing step 706, otherwise, performs step 707.
Step 706, the mark of the application component of correspondence storage and the information of application component access database in linkage record table are deleted, and deletes the application component of correspondence storage in registration table and accesses the information of database and the reference number of times of the corresponding database connection pool of the application component.
Step 707, delete in linkage record table, the mark of the application component of correspondence storage accesses the information of database with the application component.
The connection diagram of application component and shared database connection pool component can be found in Fig. 9.
Specifically, for each database connection pool, when the reference number of times for determining the database connection pool is 0, all information corresponding with the database connection pool is deleted from shared data bank Pool Component, so as to save the resource of shared data bank Pool Component.
Based on the inventive concept same with the management method of database connection pool provided in an embodiment of the present invention, the embodiment of the present invention also provides a kind of managing device of database connection pool, as shown in figure 11, including:
Receiving unit 801, the request of request for data storehouse connection pool from shared data bank Pool Component for receiving application component transmission, the information that the application component accesses database is carried in the request of request for data storehouse connection pool, the application component and the shared data bank Pool Component are previously deployed in same OSGI frameworks in the form of open service gateway initiative promoter's OSGI components respectively;
Judging unit 802, for judging the corresponding database connection pool of information that the application component accesses database whether is preserved in the shared data bank Pool Component;
Allocation unit 803, in the case of judging to be in the judging unit, the corresponding database connection pool of information that the application component is accessed into database distributes to the application component;
Set up unit 804, for the judging unit judge it is no in the case of, the information of database is accessed according to the application component, the corresponding database connection pool of information that the application component accesses database is set up in the shared data bank Pool Component, and the corresponding database connection pool of information that the application component of foundation is accessed into database distributes to the application component.
Preferably, in described device, the unit of setting up is accessing the information of database according to the application component, when the application component is set up in the shared data bank Pool Component accessing the corresponding database connection pool of information of database, specifically for:
The information registering that the application component is accessed into database obtains the corresponding database connection pool of information that the application component accesses database into the registration table of the shared data bank Pool Component;And
The obtained application component is accessed to the reference number of times of the corresponding database connection pool of information of database, the information of database is accessed with the application component, correspondence storage is into the registration table of the shared data bank Pool Component, and the reference number of times of the database connection pool refers to that the database connection pool is assigned to the number of times of application component after program assembly application is employed.
Preferably, as shown in figure 12, described device, in addition to:
Memory cell 805, mark for also carrying the application component in the request of request for data storehouse connection pool, and determine to distribute to the information corresponding database connection pool that the application component accesses database after the application component, the mark of the application component is accessed into the information of database with the application component, correspondence storage is into the linkage record table of the shared data bank Pool Component.
Preferably, as shown in figure 13, described device, further comprises:
Monitoring unit 806, for determining after the information correspondence database connection pool that the application component of foundation accesses database distributed into the application component, the reference number of times that the application component is accessed to the corresponding database connection pool of information of database adds 1, and the initial value that the application component accesses the reference number of times of the corresponding database connection pool of information of database is 0;
When listening to the message for the corresponding database connection pool of information that the application component discharges the application component access database, the reference number of times that the application component is accessed to the corresponding database connection pool of information of database subtracts 1;
Judge whether the reference number of times that application component described in the registration table accesses the corresponding database connection pool of information of database is 0;
If, the mark and the application component for deleting the application component of correspondence storage in the linkage record table access the information of database, and delete the reference number of times that the information and the application component that the corresponding application component stored accesses database in the registration table access the corresponding database connection pool of information of database;
If not, deleting in the linkage record table, the mark of the application component of correspondence storage accesses the information of database with the application component.
Preferably, the mark of the application component is carried in the message for the corresponding database connection pool of information that the release application component accesses database, then the monitoring unit is when the reference number of times of the corresponding database connection pool of information that the application component is accessed to database subtracts 1, specifically for:
According to the mark of the application component, the corresponding information for accessing database of mark of the application component is inquired about from the linkage record table;
According to the information of the access database inquired, the corresponding reference number of times of information of the access database is inquired about from the registration table, and the reference number of times inquired is subtracted 1.
Preferably, in described device, the judging unit specifically for:
Whether information that the application component access database is preserved in the registration table or linkage record table of inquiring about the shared data bank Pool Component;
If it is, determining to preserve the corresponding database connection pool of information that the application component accesses database in the shared data bank Pool Component;
If not, determining not preserving the corresponding database connection pool of information that the application component accesses database in the shared data bank Pool Component.
Based on the inventive concept same with the management method of database connection pool provided in an embodiment of the present invention, the embodiment of the present invention also provides a kind of management system of database connection pool, as shown in figure 14, including:
Application component 901, request for sending from request for data storehouse connection pool to shared data bank Pool Component, the information that the application component accesses database is carried in the request of request for data storehouse connection pool, the application component and the shared data bank Pool Component are previously deployed in same OSGI frameworks in the form of open service gateway initiative promoter's OSGI components respectively;
Shared data bank Pool Component 902, the request of request for data storehouse connection pool from shared data bank Pool Component for receiving application component transmission, judges the corresponding database connection pool of information that the application component accesses database whether is preserved in the shared data bank Pool Component;If it is, the corresponding database connection pool of information that the application component is accessed into database distributes to the application component;If not, the information of database is accessed according to the application component, the corresponding database connection pool of information that the application component accesses database is set up in the shared data bank Pool Component, and the corresponding database connection pool of information that the application component of foundation is accessed into database distributes to the application component.
Preferably, in the system, the shared data bank Pool Component is accessing the information of database according to the application component, when the application component is set up in the shared data bank Pool Component accessing the corresponding database connection pool of information of database, specifically for:
The information registering that the application component is accessed into database obtains the corresponding database connection pool of information that the application component accesses database into the registration table of the shared data bank Pool Component;And
The obtained application component is accessed to the reference number of times of the corresponding database connection pool of information of database, the information of database is accessed with the application component, correspondence storage is into the registration table of the shared data bank Pool Component, and the reference number of times of the database connection pool refers to that the database connection pool is employed to be assigned to the number of times of application component after program assembly application.
Preferably, in the system, the shared data bank Pool Component is additionally operable to:
The mark of the application component is also carried in the request of request for data storehouse connection pool, and determine to distribute to the information corresponding database connection pool that the application component accesses database after the application component, the mark of the application component is accessed into the information of database with the application component, correspondence storage is into the linkage record table of the shared data bank Pool Component.
Preferably, in the system, the shared data bank Pool Component is further used for:
It is determined that after the corresponding database connection pool of information that the application component of foundation is accessed into database distributes to the application component, the reference number of times that the application component is accessed to the corresponding database connection pool of information of database adds 1, and the initial value that the application component accesses the reference number of times of the corresponding database connection pool of information of database is 0.
Preferably, in the system, the shared data bank Pool Component is additionally operable to:
When listening to the message for the corresponding database connection pool of information that the application component discharges the application component access database, the reference number of times that the application component is accessed to the corresponding database connection pool of information of database subtracts 1;
Judge whether the reference number of times that application component described in the registration table accesses the corresponding database connection pool of information of database is 0;
If, the mark and the application component for deleting the application component of correspondence storage in the linkage record table access the information of database, and delete the reference number of times that the information and the application component that the corresponding application component stored accesses database in the registration table access the corresponding database connection pool of information of database;
If not, deleting in the linkage record table, the mark of the application component of correspondence storage accesses the information of database with the application component.
Preferably, the mark of the application component is carried in the message for the corresponding database connection pool of information that the release application component accesses database, then the shared data bank Pool Component is when the reference number of times of the corresponding database connection pool of information that the application component is accessed to database subtracts 1, specifically for:
According to the mark of the application component, the corresponding information for accessing database of mark of the application component is inquired about from the linkage record table;
According to the information of the access database inquired, the corresponding reference number of times of information of the access database is inquired about from the registration table, and the reference number of times inquired is subtracted 1.
Preferably, in the system, the shared data bank Pool Component when whether preserving the application component in judging the shared data bank Pool Component and accessing the corresponding database connection pool of information of database, specifically for:
Whether information that the application component access database is preserved in the registration table or linkage record table of inquiring about the shared data bank Pool Component;
If it is, determining to preserve the corresponding database connection pool of information that the application component accesses database in the shared data bank Pool Component;
If not, determining not preserving the corresponding database connection pool of information that the application component accesses database in the shared data bank Pool Component.
Using the management method of database connection pool provided in an embodiment of the present invention, apparatus and system, have the advantages that:By building OSGI frameworks in same JVM, by application program to be deployed in the form of OSGI components in OSGI frameworks, and affix one's name to shared data bank Pool Component in OSGI frame mid portions, in the shared data bank Pool Component, database connection pool is set up according to the information that application component accesses database, when the information of different application component accesses database is identical, the shared of cdr database connection pool can be achieved, it is possible to prevente effectively from the waste of database connection pool resource, all it is the OSGI components in OSGI frameworks due to application component and shared data bank Pool Component, interacted between application component and shared data bank Pool Component by way of service, exploited natural resources so as to effective saving.In addition, the embodiment of the present invention to communicate by way of service between shared data bank Pool Component and each application component, so as to the shared database Pool Component of each application component in same JVM, compared to mode of the application program by way of agreement or interface to be communicated with the shared data bank connection pool under another JVM being located in different JVM of prior art, application program is improved to a certain extent sets up the speed being connected with database connection pool, so as to improve the speed that application program accesses database to a certain extent, and improve the response speed connected between application program and database.
The present invention is flow chart and/or block diagram with reference to method according to embodiments of the present invention, equipment (system) and computer program product to describe.It should be understood that can by the flow in each flow and/or square frame and flow chart and/or block diagram in computer program instructions implementation process figure and/or block diagram and/or square frame combination.These computer program instructions can be provided to the processor of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices to produce a machine so that produce the device for being used for realizing the function of specifying in one flow of flow chart or multiple flows and/or one square frame of block diagram or multiple square frames by the instruction of the computing device of computer or other programmable data processing devices.
These computer program instructions may be alternatively stored in the computer-readable memory that computer or other programmable data processing devices can be guided to work in a specific way, so that the instruction being stored in the computer-readable memory, which is produced, includes the manufacture of command device, the command device realizes the function of being specified in one flow of flow chart or multiple flows and/or one square frame of block diagram or multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices, so that series of operation steps is performed on computer or other programmable devices to produce computer implemented processing, so that the instruction performed on computer or other programmable devices provides the step of being used to realize the function of specifying in one flow of flow chart or multiple flows and/or one square frame of block diagram or multiple square frames.
Although preferred embodiments of the present invention have been described, but those skilled in the art once know basic creative concept, then other change and modification can be made to these embodiments.So, appended claims are intended to be construed to include preferred embodiment and fall into having altered and changing for the scope of the invention.
Obviously, those skilled in the art can carry out various changes and modification to the present invention without departing from the spirit and scope of the present invention.So, if these modifications and variations of the present invention belong within the scope of the claims in the present invention and its equivalent technologies, then the present invention is also intended to comprising including these changes and modification.

Claims (13)

1. a kind of management method of database connection pool, it is characterised in that including:
Receive the request for data storehouse connection pool from shared data bank Pool Component that application component is sent Request, the application component is carried in the request of request for data storehouse connection pool and accesses database Information, the application component and the shared data bank Pool Component are respectively with open service gateway initiative The form of promoter's OSGI components is previously deployed in same OSGI frameworks;
Judge that the application component whether is preserved in the shared data bank Pool Component accesses data The corresponding database connection pool of information in storehouse;
If it is, the corresponding database connection pool of the information that the application component is accessed into database is distributed To the application component;
If not, accessing the information of database according to the application component, connect in the shared data bank Connect and the corresponding database connection pool of information that the application component accesses database is set up in the component of pond, and The corresponding database connection pool of information that the application component of foundation is accessed into database distributes to institute State application component.
2. the method as described in claim 1, it is characterised in that accessed according to the application component The information of database, the application component is set up in the shared data bank Pool Component and accesses number According to the corresponding database connection pool of the information in storehouse, specifically include:
By the information registering of application component access database to the shared data bank connection pool group In the registration table of part, the corresponding database connection of information that the application component accesses database is obtained Pond;And
By drawing for the corresponding database connection pool of information of obtained application component access database With number of times, the information of database is accessed with the application component, the shared data bank is arrived in correspondence storage In the registration table of Pool Component, the reference number of times of the database connection pool refers to that the database connection pool exists It is employed to be assigned to the number of times of application component after program assembly application.
3. method as claimed in claim 2, it is characterised in that request for data storehouse connection pool please The mark of the application component is also carried in asking, then, it is determined that the application component is accessed into data The corresponding database connection pool of information in storehouse is distributed to after the application component, and this method is further wrapped Include:
The mark of the application component is accessed into the information of database, correspondence with the application component In the linkage record table for storing the shared data bank Pool Component.
4. method as claimed in claim 3, it is characterised in that further comprise:
It is determined that the application component of foundation to be accessed to the corresponding database connection pool of information of database Distribute to after the application component, the information that the application component is accessed into database is corresponding The reference number of times of database connection pool adds 1, and the application component accesses the corresponding number of information of database It is 0 according to the initial value of the reference number of times of storehouse connection pool;
Listen to the application component and discharge the information correspondence that the application component accesses database Database connection pool message when, by the application component access database the corresponding data of information The reference number of times of storehouse connection pool subtracts 1;
Judge that application component described in the registration table accesses the corresponding database company of information of database Whether the reference number of times for connecing pond is 0;
If it is, delete in the linkage record table application component of correspondence storage mark and The application component accesses the information of database, and deletes in the registration table that the described of correspondence storage should The information and the application component for accessing database with program assembly access the information correspondence of database Database connection pool reference number of times;
If not, delete in the linkage record table, the mark of the application component of correspondence storage with The application component accesses the information of database.
5. method as claimed in claim 4, it is characterised in that the release application component The mark of the application component is carried in the message for the corresponding database connection pool of information for accessing database Know, then the application component is accessed to the reference number of times of the corresponding database connection pool of information of database Subtract 1, specifically include:
According to the mark of the application component, the set of applications is inquired about from the linkage record table The corresponding information for accessing database of mark of part;
According to the information of the access database inquired, the letter of the access database is inquired about from the registration table Corresponding reference number of times is ceased, and the reference number of times inquired is subtracted 1.
6. method as claimed in claim 3, it is characterised in that judge the shared data bank connection pool Whether information corresponding database connection pool that the application component access database is preserved in component, tool Body includes:
Whether preserved in the registration table or linkage record table of inquiring about the shared data bank Pool Component The application component accesses the information of database;
If it is, determining that the application component is preserved in the shared data bank Pool Component accesses number According to the corresponding database connection pool of the information in storehouse;
If not, determining that not preserving the application component in the shared data bank Pool Component accesses The corresponding database connection pool of information of database.
7. a kind of managing device of database connection pool, it is characterised in that including:
Receiving unit, for receiving applying from shared data bank Pool Component for application component transmission The request of database connection pool, the application component is carried in the request of request for data storehouse connection pool Access the information of database, the application component and the shared data bank Pool Component respectively with The form of open service gateway initiative promoter's OSGI components is previously deployed in same OSGI frameworks;
Judging unit, for judging whether preserve the application program in the shared data bank Pool Component The corresponding database connection pool of information of component accesses database;
Allocation unit, in the case of judging to be in the judging unit, the application component is visited Ask that the corresponding database connection pool of information of database distributes to the application component;
Set up unit, for the judging unit judge it is no in the case of, according to the application component The information of database is accessed, the application component is set up in the shared data bank Pool Component and is visited The corresponding database connection pool of information of database is asked, and the application component of foundation is accessed into data The corresponding database connection pool of information in storehouse distributes to the application component.
8. device as claimed in claim 7, it is characterised in that the unit of setting up is answered according to described The information of database is accessed with program assembly, the application is set up in the shared data bank Pool Component When program assembly accesses the information corresponding database connection pool of database, specifically for:
By the information registering of application component access database to the shared data bank connection pool group In the registration table of part, the corresponding database connection of information that the application component accesses database is obtained Pond;And
By drawing for the corresponding database connection pool of information of obtained application component access database With number of times, the information of database is accessed with the application component, the shared data bank is arrived in correspondence storage In the registration table of Pool Component, the reference number of times of the database connection pool refers to that the database connection pool exists It is employed to be assigned to the number of times of application component after program assembly application.
9. device as claimed in claim 8, it is characterised in that also include:
Memory cell, for also carrying the set of applications in the request of request for data storehouse connection pool The mark of part, and determine to access the application component into the corresponding database connection pool of information of database Distribute to after the application component, by the mark of the application component and the application component The information of database is accessed, correspondence storage is into the linkage record table of the shared data bank Pool Component.
10. device as claimed in claim 9, it is characterised in that further comprise:
Monitoring unit, the information for determining the application component of foundation accessing database is corresponding Database connection pool is distributed to after the application component, and the application component is accessed into database The reference number of times of the corresponding database connection pool of information add 1, the application component accesses database The initial value of the reference number of times of the corresponding database connection pool of information is 0;
Listen to the application component and discharge the information correspondence that the application component accesses database Database connection pool message when, by the application component access database the corresponding data of information The reference number of times of storehouse connection pool subtracts 1;
Judge that application component described in the registration table accesses the corresponding database company of information of database Whether the reference number of times for connecing pond is 0;
If it is, delete in the linkage record table application component of correspondence storage mark and The application component accesses the information of database, and deletes in the registration table that the described of correspondence storage should The information and the application component for accessing database with program assembly access the information correspondence of database Database connection pool reference number of times;
If not, delete in the linkage record table, the mark of the application component of correspondence storage with The application component accesses the information of database.
11. device as claimed in claim 10, it is characterised in that the release set of applications Part accesses in the message of the corresponding database connection pool of information of database and carries the application component Identify, then the monitoring unit is accessing the application component the corresponding database of information of database When the reference number of times of connection pool subtracts 1, specifically for:
According to the mark of the application component, the set of applications is inquired about from the linkage record table The corresponding information for accessing database of mark of part;
According to the information of the access database inquired, the letter of the access database is inquired about from the registration table Corresponding reference number of times is ceased, and the reference number of times inquired is subtracted 1.
12. device as claimed in claim 9, it is characterised in that the judging unit specifically for:
Whether preserved in the registration table or linkage record table of inquiring about the shared data bank Pool Component The application component accesses the information of database;
If it is, determining that the application component is preserved in the shared data bank Pool Component accesses number According to the corresponding database connection pool of the information in storehouse;
If not, determining that not preserving the application component in the shared data bank Pool Component accesses The corresponding database connection pool of information of database.
13. a kind of management system of database connection pool, it is characterised in that including:
Application component, for sending asking for request for data storehouse connection pool to shared data bank Pool Component Ask, the letter that the application component accesses database is carried in the request of request for data storehouse connection pool Breath, the application component and the shared data bank Pool Component are sent out with open service gateway initiative respectively The form for playing person's OSGI components is previously deployed in same OSGI frameworks;
Shared data bank Pool Component, for receiving that the application component sends from the shared number According to the request of request for data storehouse connection pool in the Pool Component of storehouse, the shared data bank Pool Component is judged In whether preserve the corresponding database connection pool of information that the application component accesses database;If It is that the corresponding database connection pool of information that the application component is accessed into database distributes to described answer Use program assembly;If not, the information of database is accessed according to the application component, described shared The corresponding database of information that the application component accesses database is set up in database connection pool component Connection pool, and the corresponding database connection pool of information of application component access database is distributed to The application component.
CN201610202032.9A 2016-03-31 2016-03-31 A kind of management method of database connection pool, apparatus and system Pending CN107291747A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610202032.9A CN107291747A (en) 2016-03-31 2016-03-31 A kind of management method of database connection pool, apparatus and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610202032.9A CN107291747A (en) 2016-03-31 2016-03-31 A kind of management method of database connection pool, apparatus and system

Publications (1)

Publication Number Publication Date
CN107291747A true CN107291747A (en) 2017-10-24

Family

ID=60087008

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610202032.9A Pending CN107291747A (en) 2016-03-31 2016-03-31 A kind of management method of database connection pool, apparatus and system

Country Status (1)

Country Link
CN (1) CN107291747A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109145061A (en) * 2018-07-26 2019-01-04 阿里巴巴集团控股有限公司 A kind of method, database and the server of database distribution session object
CN111125223A (en) * 2019-12-20 2020-05-08 北京爱奇艺科技有限公司 Database connection pool updating method and device
CN112506965A (en) * 2020-12-03 2021-03-16 北京天融信网络安全技术有限公司 Database management device and method
CN113467966A (en) * 2021-05-31 2021-10-01 珠海大横琴科技发展有限公司 Data processing method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1510575A (en) * 2002-12-25 2004-07-07 ����ͨѶ�ɷ����޹�˾ High-efficient administration method for database connection
CN101095109A (en) * 2004-12-31 2007-12-26 Bea系统公司 Multipool manager
CN103365929A (en) * 2012-04-10 2013-10-23 阿里巴巴集团控股有限公司 Management method and management system of database connection

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1510575A (en) * 2002-12-25 2004-07-07 ����ͨѶ�ɷ����޹�˾ High-efficient administration method for database connection
CN1317653C (en) * 2002-12-25 2007-05-23 中兴通讯股份有限公司 High-efficient administration method for database connection
CN101095109A (en) * 2004-12-31 2007-12-26 Bea系统公司 Multipool manager
CN103365929A (en) * 2012-04-10 2013-10-23 阿里巴巴集团控股有限公司 Management method and management system of database connection

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109145061A (en) * 2018-07-26 2019-01-04 阿里巴巴集团控股有限公司 A kind of method, database and the server of database distribution session object
CN111125223A (en) * 2019-12-20 2020-05-08 北京爱奇艺科技有限公司 Database connection pool updating method and device
CN111125223B (en) * 2019-12-20 2023-10-10 北京爱奇艺科技有限公司 Database connection pool updating method and device
CN112506965A (en) * 2020-12-03 2021-03-16 北京天融信网络安全技术有限公司 Database management device and method
CN113467966A (en) * 2021-05-31 2021-10-01 珠海大横琴科技发展有限公司 Data processing method and device

Similar Documents

Publication Publication Date Title
CN1649324B (en) Method and apparatus for operating an open API network having a proxy
CN107291747A (en) A kind of management method of database connection pool, apparatus and system
CN101222374B (en) System, device and method for implementing service upgrade
CN103516759B (en) Cloud system method for managing resource, cloud call center are attended a banquet management method and cloud system
CN110677383B (en) Firewall wall opening method and device, storage medium and computer equipment
CN107426274A (en) The method and system of service application and monitoring analysis scheduling based on sequential
CN104123265A (en) Method and system for communication among multiple kernels
CN109673061A (en) A kind of method and apparatus of PDU Dialog processing
CN106330683A (en) Multimedia seating system
CN101167307A (en) Dynamically self-adaptive distributed resource management system and method
CN110297698A (en) A kind of multipriority dynamic current limiting method, apparatus, server and storage medium
CN107968895A (en) Call center and its method for a large amount of speech channel requests of processing
CN107295054A (en) The management method and device of cloud conferencing resource
CN104410511B (en) A kind of server management method and system
CN106993020A (en) Long-range video and audio-editing method based on virtualization technology multi-network oriented environment
CN106302590A (en) Cloud platform
CN106161647A (en) The method of a kind of cloud terminal unit batch discovery and cloud terminal management system
CN109104482A (en) A kind of distributed system of earth mat platform
EP4083795A1 (en) Method for deploying virtual machine, and related apparatus
CN105491253A (en) Resource distribution method and system for call center
CN110087321A (en) Method, apparatus, computer equipment and the storage medium of triggering terminal session
CN104427457B (en) Business platform interface arrangement and method towards M2M application and network
CN104935761B (en) A kind of outgoing call technical ability distribution method, device and call center system
CN101931715A (en) Customer service system and cross-platform monitoring method therein
CN113727138A (en) HLS intranet source returning method

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
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20171024

WD01 Invention patent application deemed withdrawn after publication