CN100458790C - Method and system for access data base - Google Patents

Method and system for access data base Download PDF

Info

Publication number
CN100458790C
CN100458790C CNB2006101564295A CN200610156429A CN100458790C CN 100458790 C CN100458790 C CN 100458790C CN B2006101564295 A CNB2006101564295 A CN B2006101564295A CN 200610156429 A CN200610156429 A CN 200610156429A CN 100458790 C CN100458790 C CN 100458790C
Authority
CN
China
Prior art keywords
database
database access
interface
connection
communication interface
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.)
Active
Application number
CNB2006101564295A
Other languages
Chinese (zh)
Other versions
CN1987864A (en
Inventor
杜永健
王臻
褚宇峰
林志农
周子坚
郑炜杰
沙云
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
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 China Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CNB2006101564295A priority Critical patent/CN100458790C/en
Publication of CN1987864A publication Critical patent/CN1987864A/en
Application granted granted Critical
Publication of CN100458790C publication Critical patent/CN100458790C/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

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

Abstract

The invention has published a method to visit database, and it can be used in transaction processing in bank. The subsystem of both the database and the visit of it will be set up in advance and a group of long connection will be maintained. The following steps are contained, when the application of front end visits the database. Firstly, the application of front end sends out the order, to visit the database, to the connection for the visit to the database in the subsystem of database visit. Secondly, the joint will set up a short connection with the director of database visit in the subsystem of database visit according to the order received to send out it. Thirdly, the director of database visit will choose a free long connection and send the visit order to database. Lastly, the result of the database visit will be send back to the application of the front end by the long connection and the short connection above. The invention has also published a system to visit database. The mount of the application of the front end can be increased according this invention and the maintained long connections can also be used fully.

Description

Database Accessing Methods and system
Technical field
The present invention relates to database technology, particularly a kind of Database Accessing Methods and system.
Background technology
The front end applications of bank is that bank is when handling client trading and client's interactive interface.Finish in the process with customer interaction by front end applications, need to obtain the relevant information of transaction this time, and some contents of this transaction are carried out record, and these relevant informations and content stores are in the database of bank, therefore, in this process, front end applications will conduct interviews to the database of bank, to realize writing and reading the data library information.
In the banking system in the past, front end applications and database and other server disposition are in each site, this mode is huge to the input of equipment, safeguard very inconvenient, and when safeguarding, the maintainer's of bank technical capability is had relatively high expectations, human input is also bigger, like this, deviate from mutually with the intensive management direction of bank.For adapting to the needs of intensive management, proposed the related service system of bank is carried out centralized management.At present the mode that adopts of banking system is to go up in the data base set with the front end applications correspondence of the one-level branch site of have jurisdiction over to receive to this one-level branch, and by unified management and the maintenance in lines of this one-level, and the site has only terminal, server and the network equipment of execution front end applications.
Fig. 1 shows the network structure of this mode.As shown in the figure, under this mode, a cover front end applications is arranged on the server, front end applications is finished the client trading processing procedure.When accessing database, front end applications is set up the long database that is connected to one-level branch, carries out the writing and reading of relevant information in the database, thereby finishes transaction this time, discharges this length connection when front end applications withdraws from.
But, one-level branch a lot of sites of having had jurisdiction over, the shared database of the front end applications of these sites, and the long linking number of database support is limited.Like this, during each front end applications accessing database, all to set up independent long a connection, the site number that causes system of one-level branch can be with simultaneously is limited, site number when system of one-level branch band reaches in limited time so, can not support the database access request that new front end applications is sent again, must be when database can be set up long the connection, there is front end applications to withdraw from before promptly and when discharging long the connection, new front end applications could be utilized this length to connect and insert database, and then, system has produced performance bottleneck, concerning large bank, can not satisfy the demand of efficient processing client trading.In addition, set up with discharging at every turn and long the connection all will consume very big system resource, then much continuous accesses of front end applications and withdraw from the resource availability that has also reduced system.
Summary of the invention
The purpose of this invention is to provide a kind of Database Accessing Methods and system, to overcome the shortcoming of the limited system performance bottleneck that causes of site number that can be with simultaneously owing to system of one-level branch in the prior art.
For solving the problems of the technologies described above, the invention provides a kind of Database Accessing Methods and system and be achieved in that
A kind of Database Accessing Methods, database are pre-created and keep a group leader with the database access subsystem and be connected, and when front end application access database, comprising:
Front end applications is sent the database access interface of database access command in the database access subsystem;
Database access interface is according to the database access command received, set up with the database access subsystem in the database access controller between short the connection, by this short connection transmission database access command;
The database access controller is chosen the long of a free time and is connected, by this long connection sending database access command to database; By this long connection visiting the result to front end applications with the short return data storehouse that is connected of described foundation.
Described database and database access subsystem are pre-created and keep a group leader and be connected by following mode and realize:
Being pre-created and keeping a group leader according to the empirical value of setting in the configuration file between database and database access subsystem is connected.
Described front end applications is sent database access command and is realized by following mode to database access interface:
Front end applications is sent the database access interface of database access command in the database access subsystem;
Receive described visit order by the application interface in the database access interface, generate request message according to this visit order, and this message is sent to first communication interface, this first communication interface is arranged in database access interface.
Described database access interface foundation realized with short the connection by following mode between the database access controller:
Described first communication interface is set up with the short of second communication interface according to the request message of receiving and is connected, and by this short connection sending request message to second communication interface, described second communication interface is arranged in the database access controller.
Described database access controller is chosen the long of a free time and is connected, and connects the transmission database access command by this length and is realized by following mode to database:
Second communication interface in the database access controller is according to from the short request message of receiving that connects, and sends the database service interface of database access request in the database access controller;
The database service interface is chosen the long of a free time and is connected according to the request of access of receiving, by this long connection sending database access command to database.
Described front end applications also comprised after finishing database access by long the connection with short the connection:
Discharge described short the connection, and give back the described long connection that takies.
Described weak point is connected to UNIX territory socket.
This method also comprises:
When the front end system initialization, in the static table load data base side shared drive with correspondence; The operation that front end applications will read static table changes into reads shared drive;
Front end applications is finished visit to static table by the operation shared drive.
The shared drive district sets up deposit data district, index area and index conflict district, wherein index area and index conflict district all comprise cryptographic hash, data pointer and Next pointer, train value in the static table is a key value, described will the realization by following mode in the static table load data base side shared drive in the database:
Calculate the shared drive capacity that static table needs, and apply for the deposit data district of the shared drive of this capacity as this static table of storage;
Described static table is written into described deposit data district;
According to the key value that writes down in the static table, use hash algorithm to calculate corresponding cryptographic hash, when the existing cryptographic hash in described cryptographic hash and index area is not conflicted, the address of described cryptographic hash and this record place internal memory is written in manipulative indexing district and the data pointer; When the existing cryptographic hash in described cryptographic hash and index area is conflicted, the address of described cryptographic hash and this record place internal memory is written in manipulative indexing battleground and the data pointer, and the address in place index conflict district is inserted in the Next pointer of described index area.
It is described when the existing cryptographic hash in described cryptographic hash and index area is conflicted, the address of described cryptographic hash and this record place internal memory is written in manipulative indexing battleground and the data pointer, and described cryptographic hash and index conflict district be when taking place to clash once more, and the memory address of this record is written in the data pointer in index conflict district.
The visit that described front end applications is finished the static table of database by the operation shared drive is realized by following mode:
Utilize hash algorithm to obtain cryptographic hash by Query Value, in the index area, obtain the address in this cryptographic hash corresponding data pointer, if the key value of the record in this Query Value and the described address is identical, reading and recording then; If the key value of the record in this Query Value and the described address is inequality, reading of data pointer in the address of index area Next pointed then, reading and recording from the address that this data pointer points to.
A kind of system of accessing database, this system comprises front end applications, database access subsystem and database, wherein,
Comprise database access interface and database access controller in the database access subsystem;
Front end applications is used for initiating to access of database;
Database is used to store data;
Database access interface is used for receiving front-end and uses the database access command send, and explains this order, set up with the database access controller between short the connection, by the described database access controller of ordering of this weak point connection transmission;
The database access controller is kept a group leader and is connected in advance with between the database, is used for after receiving visit order, chooses the long of a free time and connects, by this length connected reference database and obtain the visit result that database returns.
Described database access interface comprises the application interface and first communication interface, wherein,
Application interface is used to receive and explain the database access command that front end applications is sent, and will explain that the request message that the back generates sends to first communication interface;
First communication interface be used to receive set up behind the request message with second communication interface between short the connection, by this short connection transmission request message to second communication interface.
Described database access controller comprises the database service interface and second communication interface, wherein,
Second communication interface links to each other with database access interface, and the request message that is used for receiving sends to database access interface;
The database service interface is chosen idle long the connection after being used to receive request message, by this length connected reference database and obtain visiting the result.
The shared drive that also comprises the database side is used to store static table and provides front end applications to read data on the static table.
Described shared drive comprises deposit data district, index area and index conflict district, wherein,
The deposit data district is used to store static table;
The index area is used to deposit cryptographic hash, key value, the memory address in deposit data district, data place and the memory address of manipulative indexing battleground of static table;
The index conflict district is used to deposit the key value of static table, the memory address in deposit data district, data place and the memory address of manipulative indexing battleground.
A kind of database access subsystem comprises database access interface and database access controller, wherein,
Database access interface is used for receiving front-end and uses the database access command send, and explains this order, set up with the database access controller between short the connection, by the described database access controller of ordering of this weak point connection transmission;
The database access controller is kept a group leader and is connected in advance with between the database, is used for after receiving visit order, chooses the long of a free time and connects, by this length connected reference database and obtain the visit result that database returns.
Described database access interface comprises the application interface and first communication interface, wherein,
Application interface is used to receive and explain the database access command that front end applications is sent, and will explain that the request message that the back generates sends to first communication interface;
First communication interface be used to receive set up behind the request message with second communication interface between short the connection, by this short connection transmission request message to second communication interface.
Described database access controller comprises the database service interface and second communication interface, wherein,
Second communication interface links to each other with database access interface, and the request message that is used for receiving sends to database access interface;
The database service interface is chosen idle long the connection after being used to receive request message, by this length connected reference database and obtain visiting the result.
By above technical scheme provided by the invention as seen, the present invention is pre-created and keeps a group leader and connects between database access subsystem and database, when front end application access database, front end applications is set up with lacking between the database access controller in this subsystem by the database access interface in the database access subsystem and is connected, this database access controller is chosen a long connection, realize that front end applications is by this long connection and described short connected reference database, and owing to a long connection can connect by corresponding dozens of weak point, therefore increase the quantity of the front end applications that can insert greatly, and made full use of the long connection that keeps.
Description of drawings
Fig. 1 is the schematic diagram of front end applications accessing database in the prior art;
Fig. 2 is a systematic schematic diagram of the present invention;
Fig. 3 is the process flow diagram of the inventive method;
Fig. 4 is the process flow diagram of an embodiment in the inventive method;
Fig. 5 is a system chart in the inventive method;
Fig. 6 is shared drive schematic diagram among the present invention.
Embodiment
Core of the present invention is by utilizing short the connection in conjunction with long ways of connecting to realize the front end applications accessing database.Concrete, between front end applications and database, introduce the database access sub-system, and between database access subsystem and database, be pre-created and keep a group leader and connect, when front end application access database, front end applications is set up with lacking between the database access controller in this subsystem by the database access interface in the database access subsystem and is connected, this database access controller is chosen the long of a free time and is connected, and realizes that front end applications is by this long connection and described short connected reference database.
One skilled in the art will appreciate that long the connection is that client inserts the process of setting up when database manipulation starts,, just can not disconnect long connection the between client and the database as long as process does not finish.For example, when client inserts the database manipulation startup, send Open Database order to set up process, database manipulations such as client executing select, update afterwards, when finishing the operation of this time accessing database, send the CloseDatabase order, disconnect long the connection.Also have short the connection, it is the connection of client when only needing to carry out database manipulation, for example connection of client when carrying out database manipulation such as select, update.The long number of connection that database is supported is limited, so the client of Zhi Chiing is limited simultaneously.The short connection only just connects when needs carry out database manipulation, so can support more client in a period of time.The present invention will grow just to connect with short the connection and carry out combination.
In order to make those skilled in the art person understand the present invention program better, the present invention is described in further detail below in conjunction with drawings and embodiments.
The present invention realizes that by the database server subsystem long the connection with weak point is connected combination.As shown in Figure 2, the database access subsystem comprises database access interface and database access controller.Database access interface is responsible for receiving and changing the database manipulation order that front end applications is sent, and the database access controller is realized the operation to database.
Be pre-created and keep a group leader between database access controller and the database and be connected, these long connections can constitute a database connection pool.Concrete, store in the system in the configuration file, be provided with the long linking number that can set up in this configuration file, this value can rule of thumb be disposed by the staff.During system start-up, can be according to the configuration file of storage, set up and keep long connection between database access controller and the database.
Adopt short the connection between database access interface and the database access controller.For example can adopt UNIX territory socket.Adopt UNIX territory socket can make the synchro control between process simple, and can reduce the complexity of fault-tolerant processing, thus stability and reliability that can the operation of raising system.
Because the transaction that front end applications is handled may be different, therefore, the database access command difference of sending, like this, the short type difference that connects that a plurality of front end applications are set up, even type is identical, the difference on opportunity that may set up, and a long connection can be carried out a plurality of database manipulations, and this just means that a long connection can corresponding a plurality of short connections.Concrete, can rule of thumb be worth a long number that connects corresponding short connection is arranged in the foregoing configuration file, thereby realize short the connection and the long reasonable disposition that is connected, for example this value can be 1 corresponding 15 short connection or 20 short connections of long connection, so, if 1000 long connections of the maximum support of database, the front-end access quantity that then can insert is 1000*15 or 1000*20, so both increased the quantity of the front end applications that can insert greatly, and also made full use of keep long and connected.
Fig. 3 shows an embodiment of front end applications accessing database, is realized by following steps:
Step 301: front end applications is sent database access command to database access interface.
This step is that bank handles in the client trading process, needs accessing database to write or to read information, and then front end applications is sent the database access interface of database access command in the database access subsystem, handles this visit order by database access interface.
Comprise the application interface and first communication interface in the database access interface.
Application interface is finished the explanation to the information of process, so that information is suitable for the reception of front end applications or the transmission in database subsystem.Be specially, the grammar explanation of the visit order that front end applications is sent, and send to communication interface; The response message that communication interface returns is done packet parsing, and this response message is the execution result of this database access command, and this execution result is returned to front end applications.
So, this step can be divided into following two processes:
301a: front end applications sends Structured Query Language (SQL), and (Structured Query Language, SQL) statement is to application interface.Here, database access command is specially SQL statement.
301b: after application interface carries out grammar explanation to SQL statement, generate request message, and send this request message to first communication interface.Here, database access command is specially request message.
Step 302: database access interface set up with the database access controller between short the connection, by this short connection transmission database access command.
This step is a database access interface according to the database access command of receiving, set up with the database access controller between short the connection, and by this short connection transmission database access command.
The front is mentioned database access interface and is comprised first communication interface, and this interface is received the request message that application interface is sent.In this step, concrete, be first communication interface according to the described request message, set up with the database access controller between short the connection, and the described request message sent to the database access controller by the weak point connection of setting up.
As previously mentioned, lack connection and can adopt UNIX territory socket.Adopt UNIX territory socket can make the synchro control between process simple, and can reduce the complexity of fault-tolerant processing, thus stability and reliability that can the operation of raising system.
Step 303: the database access controller is chosen the long of a free time and is connected, by this long connection sending database access command to database; By this long connection visiting the result to front end applications with the short return data storehouse that is connected of described foundation.
The front is mentioned, and is pre-created and maintains a group leader between database access controller and database and be connected, these long connection pools that connect and compose.In this step, the database access controller is received the request message of sending by short connection of setting up, according to this request message, the database access controller need be carried out the operation of accessing database, then chooses long connection of a free time and carry out this operation from connection pool.Because short connection executes the visit data library command and promptly withdraws from the long connection that takies, therefore it is very short to take the long time that connects, and therefore, a long connection can link to each other with a lot of short connections in a period of time, that is to say that short connection can be chosen the long of free time easily and connect.
Comprise second communication interface and database service interface in the database access controller.
Second communication interface is received short the connect request message sent of first communication interface by setting up, and this request message is sent to the database service interface.
The database service interface is chosen the long of a free time and is connected from connection pool, by this long database manipulation of carrying out in the request message that connects.It is as described above to choose long ways of connecting.
Database is carried out the database manipulation of request, and the response message that will comprise execution result returns to the database service interface by long the connection, connects-the first communication interface-application interface by second communication interface-weak point again and arrives front end applications.To send out database access command similar with front end applications, and different is that response message transmits according to opposite direction.
After this database access is finished in the front end application, give back take long and connect, discharge the weak point of setting up and connect.When needs carry out new database access, when perhaps other front end applications is carried out database access, repeat said process, promptly set up new short connection and choose long the connection, connect and the long database manipulation that is connected the request of finishing by short.Because a long connection can connect by corresponding dozens of weak point, compares with prior art, the front end applications number that method support of the present invention inserts has improved tens of times.
Like this, realized increasing the purpose of the front end applications quantity that inserts by short connection-length ways of connecting, and made full use of long connection.
Below be a complete embodiment.
According to configuration file, the database service interface in the database access controller is created and is kept a group leader and be connected in advance with between the database.When front end application need accessing database, may further comprise the steps:
Step 401: front end applications is sent the application interface of database access command SQL statement in the database access interface.
Step 402: application interface carries out grammar explanation to SQL statement, generates request message, and sends message to first communication interface.
Step 403: first communication interface is set up with the short of second communication interface in the database access controller and is connected, and by this weak point connection request message is sent to second communication interface in the mode of UNIX territory socket.
Step 404: second communication interface sends to the database service interface with this message.
Step 405: the database service interface is chosen the long of a free time and is connected from connection pool, connects by this length request message is sent to database.
Step 406: database is carried out the database manipulation of request, and the response message that will comprise operating result returns to the database service interface by long the connection.
Step 407: the database service interface returns to second communication interface with response message.
Step 408: second communication interface is short connect of response message by setting up, and returns to first communication interface in the mode of UNIX territory socket.
Step 409: first communication interface returns to application interface with response message.
Step 410: after application interface carries out packet parsing to response message, the execution result of resolving is returned front end applications.
Step 411: discharge short the connection, give back long the connection.
It more than is a full implementation example of the inventive method.
Fig. 5 has provided the system diagram with accessing database of the present invention.
As shown in the figure, this system comprises front end applications, database access subsystem, database.
Comprise database access interface in the database access subsystem, the database access controller.
Database access interface links to each other with the database access controller with front end applications, be used for receiving front-end and use the database access command of sending, and explain this order, set up with the database access controller between short the connection, by the described database access controller of ordering of this weak point connection transmission.
The database access controller links to each other with database with data access interface, keep a group leader and be connected in advance with between the database, after receiving visit order, choose the long of a free time and connect, by this length connected reference database and obtain the visit result that database returns.
Wherein, database access interface comprises the application interface and first communication interface, and the database access controller comprises the database service interface and second communication interface.
Application interface links to each other with first communication interface with front end applications, is used to receive and explain the database access command that front end applications is sent, and will explain that the request message that the back generates sends to first communication interface.
First communication interface links to each other with second communication interface, be used to receive set up behind the request message with second communication interface between short the connection, by this short connection transmission request message to second communication interface.
Second communication interface links to each other with database access interface, and the request message that is used for receiving sends to database access interface.
Keep a group leader to be connected in advance between database service interface and the database, choose idle long the connection after being used to receive request message, by this length connected reference database and obtain visiting the result.
The visit result arrives front end applications by described database access interface-second communication interface-first communication interface-application interface.
In fact, the content of storing in the database comprises Static and Dynamic Tables.Some information that remain unchanged such as the mechanism of bank number, mechanism's name etc. of storage in the static table, and some information relevant with transaction of storage in the dynamic table are determined by this transaction.And in the said method, front end applications is by short connection-length ways of connecting accessing database, and the content of visit comprises Static and Dynamic Tables.And front end applications is more to the access times of static table, and the just read operation that carries out.
Based on foregoing, the present invention is for realizing that obtaining static table information fast also comprises following method:
In the shared drive with the static table load data base side of this front end system correspondence during the front end system initialization; The operation that front end applications will read static table changes to reads shared drive.
Front end applications is finished visit to static table by the operation shared drive.
Below introduce the shared drive structure earlier.Fig. 4 shows the structure of shared drive.
As shown in the figure, shared drive comprises shared drive structrual description head and shared drive data field two parts.Wherein, shared drive structrual description head is deposited the address of shared drive common information and each data field, static table place.The shared drive data field is deposited each static table in order.The data field of each static table can be divided into index area, index conflict district and deposit data district three parts again.
The static table shared drive of packing into is realized by following mode:
Calculate the shared drive capacity that static table needs, and apply for the deposit data district of the shared drive of this capacity as this static table of storage.This computation process can be called the initialization function and realize.
Static table is written into the deposit data district.This process can be called and be written into function, the record in the static table is written into one by one, and index area or index conflict district are inserted in the address in cryptographic hash, key value and the place deposit data district of each bar record.
The index area is identical with the structure in index conflict district, all comprises key value, data pointer and Next pointer.
The index area is inserted in the address in cryptographic hash, key value and the place deposit data district of each bar record or the index conflict district is realized by following mode: utilize hash algorithm that the key in the static table (Key) value is calculated, obtain cryptographic hash, wherein the Key value is a certain row in the static table.The cryptographic hash that this Key value is obtained by hash algorithm is written into this static table manipulative indexing district, if the cryptographic hash of this record is not during with the existing cryptographic hash conflict in described index area (promptly identical), the memory address of this record is inserted the data pointer part of index area, and the Next pointer is changed to Null; If the cryptographic hash of this record is conflicted with the existing cryptographic hash in described index area, the memory address of this record is inserted the data pointer part in index conflict district, the Next pointer is changed to Null, and the address in place index conflict district is inserted in the aforementioned index district Next pointer, replaces Null.
Below be that example describes with the tbbranch table.Tbbranch table comprises three of Institution Code orgcode, the name orgname of mechanism and the state state of mechanism, and the structure that is written into the deposit data district is identical with the structure of this table, and is as follows:
Figure C20061015642900181
Tbbranch table in the table 1. deposit data district
This classifies the Key value as Institution Code.Record of each behavior has three records in this table, the memory address of three records is respectively Z1, Z2, Z3.
The corresponding cryptographic hash of Key value that is obtained three records by hash algorithm is respectively X1, X2, X1, and visible article one record is identical with the 3rd cryptographic hash that record obtains.
The index area is as follows:
Figure C20061015642900191
Table 2. index area table (one)
When the deposit data district is written into article one record, insert 322900001 in the Key of index area value, data pointer is inserted the address Z1 in this deposit data district, record place, and the Next pointer is filled out and is Null.Be written into the second record similarly.But, being written into the 3rd when record, cryptographic hash also is X1, inserts in the Key value in index conflict district 322900003 at this moment then, and data pointer is inserted the address Z3 of the 3rd record, and the Next pointer is filled out and is Null, and is as shown in the table:
Figure C20061015642900192
Battleground, table 3. index area table
Accordingly, the Next pointer with the address Y1 in the index conflict district inserts index area X1 covers Null.Like this, the index area is as shown in the table:
Figure C20061015642900193
Table 2. index area table (two)
The process that reads accordingly is: the relevant information that for example will read this record according to the Key value, at first utilize hash algorithm to obtain cryptographic hash by Query Value, in the index area, obtain the Key value of this cryptographic hash corresponding address, if the Key value of the record in this Query Value and the described address is identical, then according to the address in the data pointer of this index record, the record of reading of data district correspondence; If the Key value of the record in this Query Value and the described address is inequality, reading of data pointer in the address of index area Next pointed then, and then from the address that this data pointer points to reading and recording.
Be that example describes still below with the tbbranch table.
For example need to inquire about the corresponding states information of certain Institution Code, if this Query Value is 322900002, query statement is " Select state from tbbranch where orgcode=322900002 ", then utilize hash algorithm to obtain the cryptographic hash X2 of this Query Value correspondence, the Key value of searching the X2 correspondence in the index area is 322900002, consistent with the Key value 322900002 that will search, the record that record that the data pointer Z2 of X2 points to will be searched exactly is described, reads respective record in the Z2 address to get final product.
If but Query Value is 322900003, utilize hash algorithm to obtain X1, the Key value of searching the X1 address in the index area is 322900001, inconsistent with the Key value 322900003 of searching, conflict has been described, then in the Next of X1 correspondence pointer, read address Y1, reading Key from the Y1 address is 322900003, consistent with the Key value of searching, then get corresponding data pointer Z3, from the Z3 address, read this record.
When taking place to conflict once more, the Next pointer in index conflict district can point to the address in next index conflict district, and the data pointer in " next index conflict district " points to the memory address that conflicting data takes place once more.
By above embodiment as seen, the present invention is pre-created and keeps a group leader and connects between database access subsystem and database, when front end application access database, front end applications is set up with lacking between the database access controller in this subsystem by the database access interface in the database access subsystem and is connected, this database access controller is chosen the long of a free time and is connected, realize that front end applications is by this long connection and described short connected reference database, and owing to a long connection can connect by corresponding dozens of weak point, therefore increase the quantity of the front end applications that can insert greatly, and made full use of the long connection that keeps.Static table is inserted in the shared drive, can also be realized static table is visited fast and efficiently.
Though described the present invention by embodiment, one skilled in the art will appreciate that the present invention also has many distortion and variation and do not break away from spirit of the present invention, wish that appended claim comprises these distortion and variation and do not break away from spirit of the present invention.

Claims (15)

1, a kind of Database Accessing Methods is characterized in that, database is pre-created and keeps a group leader with the database access subsystem and is connected, and when front end application access database, comprising:
Front end applications is sent the database access interface of database access command in the database access subsystem;
Database access interface is according to the database access command received, set up with the database access subsystem in the database access controller between short the connection, by this short connection transmission database access command;
The database access controller is chosen the long of a free time and is connected, by this long connection sending database access command to database; By this long connection visiting the result to front end applications with the short return data storehouse that is connected of described foundation;
Described front end applications also comprised after finishing database access by long the connection with short the connection: discharges described short the connection, and give back the described length connection that takies;
This method also comprises:
When the front end system initialization, in the static table load data base side shared drive with correspondence; The operation that front end applications will read static table changes into reads shared drive;
Front end applications is finished visit to static table by the operation shared drive.
2, the method for claim 1 is characterized in that, described database and database access subsystem are pre-created and keep a group leader and be connected by following mode and realize:
Being pre-created and keeping a group leader according to the empirical value of setting in the configuration file between database and database access subsystem is connected.
3, the method for claim 1 is characterized in that, described front end applications is sent database access command and realized by following mode to database access interface:
Front end applications is sent the database access interface of database access command in the database access subsystem;
Receive described visit order by the application interface in the database access interface, generate request message according to this visit order, and this message is sent to first communication interface, this first communication interface is arranged in database access interface.
4, method as claimed in claim 3 is characterized in that, described database access interface foundation realized with short the connection by following mode between the database access controller:
Described first communication interface is set up with the short of second communication interface according to the request message of receiving and is connected, and by this short connection sending request message to second communication interface, described second communication interface is arranged in the database access controller.
5, method as claimed in claim 4 is characterized in that, described database access controller is chosen the long of a free time and connected, and connects the transmission database access command by this length and is realized by following mode to database:
Second communication interface in the database access controller is according to from the short request message of receiving that connects, and sends the database service interface of database access request in the database access controller;
The database service interface is chosen the long of a free time and is connected according to the request of access of receiving, by this long connection sending database access command to database.
As each described method in the claim 1 to 5, it is characterized in that 6, described weak point is connected to UNIX territory socket.
7, the method for claim 1, it is characterized in that, the shared drive district sets up deposit data district, index area and index conflict district, wherein the index area comprises cryptographic hash, key value, data pointer and Next pointer, the index conflict district comprises key value, data pointer and Next pointer, train value in the static table is a key value, described will the realization by following mode in the static table load data base side shared drive in the database:
Calculate the shared drive capacity that static table needs, and apply for the deposit data district of the shared drive of this capacity as this static table of storage;
Described static table is written into described deposit data district;
According to the key value that writes down in the static table, use hash algorithm to calculate corresponding cryptographic hash, when the existing cryptographic hash in described cryptographic hash and index area is not conflicted, the address of described cryptographic hash and this record place internal memory is written in the manipulative indexing district in the idle cryptographic hash and data pointer that writes down; When the existing cryptographic hash in described cryptographic hash and index area is conflicted, the address of described record place internal memory is written in the data pointer of idle record in the manipulative indexing battleground, and the address of the described idle record in place index conflict district is inserted in the Next pointer in the record of existing described cryptographic hash place, described index area.
8, method as claimed in claim 7 is characterized in that, the visit that described front end applications is finished the static table of database by the operation shared drive is realized by following mode:
Utilize hash algorithm to obtain cryptographic hash by Query Value, in the index area, obtain the address in the data pointer in the record of this cryptographic hash place, if the key value of the record in this Query Value and the described address is identical, reading and recording then; If the key value of the record in this Query Value and the described address is inequality, reading of data pointer in the address of the Next pointed in this cryptographic hash place record in the index area then, reading and recording from the address that this data pointer points to.
9, a kind of system of accessing database is characterized in that, this system comprises front end applications, database access subsystem and database, wherein,
Comprise database access interface and database access controller in the database access subsystem;
Front end applications is used for initiating to access of database;
Database is used to store data;
Database access interface is used for receiving front-end and uses the database access command send, and explains this order, set up with the database access controller between short the connection, by the described database access controller of ordering of this weak point connection transmission;
The database access controller is kept a group leader and is connected in advance with between the database, is used for after receiving visit order, chooses the long of a free time and connects, by this length connected reference database and obtain the visit result that database returns;
Described system also comprises the shared drive of database side, is used to store static table and provides front end applications to read data on the static table.
10, system as claimed in claim 9 is characterized in that, described database access interface comprises the application interface and first communication interface, wherein,
Application interface is used to receive and explain the database access command that front end applications is sent, and will explain that the request message that the back generates sends to first communication interface;
First communication interface be used to receive set up behind the request message with second communication interface between short the connection, by this short connection transmission request message.
11, system as claimed in claim 9 is characterized in that, described database access controller comprises the database service interface and second communication interface, wherein,
Second communication interface links to each other with the database service interface, and the request message that is used for receiving sends to the database service interface;
The database service interface is chosen idle long the connection after being used to receive request message, by this length connected reference database and obtain visiting the result.
12, system as claimed in claim 9 is characterized in that, described shared drive comprises deposit data district, index area and index conflict district, wherein,
The deposit data district is used to store static table;
The index area is used to deposit cryptographic hash, key value, the memory address in deposit data district, data place and the memory address of manipulative indexing battleground of static table;
The index conflict district is used to deposit the key value of static table, the memory address in deposit data district, data place and the memory address of manipulative indexing battleground.
13, a kind of database access subsystem is characterized in that, comprises database access interface and database access controller, wherein,
Database access interface is used for receiving front-end and uses the database access command send, and explains this order, set up with the database access controller between short the connection, by the described database access controller of ordering of this weak point connection transmission;
The database access controller is kept a group leader and is connected in advance with between the database, is used for after receiving visit order, chooses the long of a free time and connects, by this length connected reference database and obtain the visit result that database returns;
Described system also comprises the shared drive of database side, is used to store static table and provides front end applications to read data on the static table.
14, subsystem as claimed in claim 13 is characterized in that, described database access interface comprises the application interface and first communication interface, wherein,
Application interface is used to receive and explain the database access command that front end applications is sent, and will explain that the request message that the back generates sends to first communication interface;
First communication interface be used to receive set up behind the request message with second communication interface between short the connection, by this short connection transmission request message.
15, subsystem as claimed in claim 13 is characterized in that, described database access controller comprises the database service interface and second communication interface, wherein,
Second communication interface links to each other with the database service interface, and the request message that is used for receiving sends to the database service interface;
The database service interface is chosen idle long the connection after being used to receive request message, by this length connected reference database and obtain visiting the result.
CNB2006101564295A 2006-12-31 2006-12-31 Method and system for access data base Active CN100458790C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2006101564295A CN100458790C (en) 2006-12-31 2006-12-31 Method and system for access data base

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2006101564295A CN100458790C (en) 2006-12-31 2006-12-31 Method and system for access data base

Publications (2)

Publication Number Publication Date
CN1987864A CN1987864A (en) 2007-06-27
CN100458790C true CN100458790C (en) 2009-02-04

Family

ID=38184661

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2006101564295A Active CN100458790C (en) 2006-12-31 2006-12-31 Method and system for access data base

Country Status (1)

Country Link
CN (1) CN100458790C (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101383814B (en) * 2007-09-07 2012-04-04 华为技术有限公司 Device and method implementing data access based on connection pool
CN102006282A (en) * 2010-10-26 2011-04-06 福州星网视易信息系统有限公司 Centralized control method for database access in client/server mode
CN103634444B (en) * 2013-11-25 2018-07-17 北京搜狗信息服务有限公司 The method and system of number information are provided
CN104462200A (en) * 2014-10-31 2015-03-25 北京思特奇信息技术股份有限公司 Method and system for controlling switching between systems through third-party database
CN104468547B (en) * 2014-11-28 2019-03-15 北京奇安信科技有限公司 Establish the method, apparatus and system of long connection
CN105677397B (en) * 2015-12-30 2018-09-25 南京途牛科技有限公司 Pass through the method for local gateway program optimization PHP far calls
CN108804234B (en) * 2017-04-28 2023-05-09 腾讯科技(深圳)有限公司 Data storage system and method of operation thereof
CN110399416B (en) * 2019-07-24 2023-08-22 成都甄识科技有限公司 Distributed database operation optimization access processing method and system
CN110489474B (en) * 2019-08-05 2022-04-22 北京字节跳动网络技术有限公司 Data processing method, device, medium and electronic equipment
CN113590635A (en) * 2021-08-23 2021-11-02 中国银行股份有限公司 Data analysis system and method for overseas multiple banks

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
CN1567301A (en) * 2003-06-23 2005-01-19 华为技术有限公司 Method and apparatus for accessing database
US20060074955A1 (en) * 2004-10-01 2006-04-06 Ralf Kuersch System and method for deferred database connection configuration
CN1815469A (en) * 2005-02-01 2006-08-09 华为技术有限公司 Database connection resource management method

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
CN1567301A (en) * 2003-06-23 2005-01-19 华为技术有限公司 Method and apparatus for accessing database
US20060074955A1 (en) * 2004-10-01 2006-04-06 Ralf Kuersch System and method for deferred database connection configuration
CN1815469A (en) * 2005-02-01 2006-08-09 华为技术有限公司 Database connection resource management method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
数据库连接池技术及其在Web系统开发中的应用. 崔莹峰,王洪.铁路计算机应用,第14卷第2期. 2005
数据库连接池技术及其在Web系统开发中的应用. 崔莹峰,王洪.铁路计算机应用,第14卷第2期. 2005 *

Also Published As

Publication number Publication date
CN1987864A (en) 2007-06-27

Similar Documents

Publication Publication Date Title
CN100458790C (en) Method and system for access data base
CN108647361B (en) Data storage method, device and system based on block chain
CN100334583C (en) Smart card enabled mobile personal computing environment system
CN103116618B (en) Based on Telefile mirror method and the system of the lasting buffer memory of client
CN105190622B (en) Quick collapse for distributed data base system restores
CN105210062B (en) System scope checkpoint for distributed data base system avoids
CN100485678C (en) Distributed object-based storage system for storing virtualization maps in object attributes
US20070288587A1 (en) Transactional shared memory system and method of control
CN102541990B (en) Database redistribution method and system utilizing virtual partitions
US8555018B1 (en) Techniques for storing data
CN101170416B (en) Network data storage system and data access method
CN109167811A (en) A kind of across chain data access method and device based on block chain
CN102033912A (en) Distributed-type database access method and system
CN100452046C (en) Storage method and system for mass file
CN102982151B (en) Method for merging multiple physical files into one logic file
CN109240946A (en) The multi-level buffer method and terminal device of data
CN102937964B (en) Intelligent data service method based on distributed system
CN112559637B (en) Data processing method, device, equipment and medium based on distributed storage
CN108108476A (en) The method of work of highly reliable distributed information log system
CN101923571B (en) Method and device for managing terminal data logging
CN109684282A (en) A kind of method and device constructing metadata cache
CN102739622A (en) Expandable data storage system
CN107888666A (en) A kind of cross-region data-storage system and method for data synchronization and device
CN103595799A (en) Method for achieving distributed shared data bank
CN102722405A (en) Counting method in high concurrent and multithreaded application and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant