WO2004059906A1 - Procede d'administration de connexions a une base de donnees - Google Patents

Procede d'administration de connexions a une base de donnees Download PDF

Info

Publication number
WO2004059906A1
WO2004059906A1 PCT/CN2003/001016 CN0301016W WO2004059906A1 WO 2004059906 A1 WO2004059906 A1 WO 2004059906A1 CN 0301016 W CN0301016 W CN 0301016W WO 2004059906 A1 WO2004059906 A1 WO 2004059906A1
Authority
WO
WIPO (PCT)
Prior art keywords
connection
transaction
database
pool
connections
Prior art date
Application number
PCT/CN2003/001016
Other languages
English (en)
French (fr)
Inventor
Ming Sun
Original Assignee
Zte Corporation
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 Zte Corporation filed Critical Zte Corporation
Priority to BR0317733-5A priority Critical patent/BR0317733A/pt
Priority to AU2003289602A priority patent/AU2003289602A1/en
Publication of WO2004059906A1 publication Critical patent/WO2004059906A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks

Definitions

  • connection management includes the management of establishing, using, and closing connections. At the beginning, because the database is accessed infrequently, traditional connection management adopts the strategy of establishing and closing when needed, mainly divided into distributed transactions and worker threads. 2 A way of management.
  • the transaction mode only provides a method for managing distributed transactions, internalizing the application into global transactions, and transforming the application's use of connections into acquiring and closing connections through global transactions.
  • US Patent No. 333141 filed on June 14, 1999, discloses a method for supporting distributed transactions using the JDBC1.0 driver, which provides a JDBC1.0-based support The method of distributed transactions is not to allocate a new physical connection for each connection request, but to maintain a mapping table internally for global transactions and the connections they use. Because this method is transaction-based, in this method, transaction acquisition and closing connections do not have an effective use of the connection, so even if there are multiple connection requests to the database in a transaction, the same connection is still maintained. Use, causing waste of resources.
  • US Patent No. 611604 filed on July 7, 2000, discloses a method and system for managing the connection of a database management system.
  • Each database management system corresponds to a database system, and a series of working threads are built therein.
  • Distributing database requests to these worker threads for execution also includes connecting specific connections, worker threads and used database subsystems.
  • This threading method makes full use of the advantages of computer thread management, greatly improves the execution efficiency, and greatly improves the application performance.
  • this method is thread-based, and in this way, the thread acquires and closes the connection. There is no effective use of connections. Therefore, once the same worker thread calls to the same database subsystem, the same connection is still used, causing inefficiency.
  • connection management technologies has the following defects, respectively: 1) The use of the same connection by the same worker thread to the same subsystem or the same transaction to the same connection of the database is equal to the allocation of the application or sub-application A fixed connection, regardless of the actual use of the connection, does not manage the connection as a whole, making the connection use inefficient; 2) there is a connection established and closed, but there is no condition for judging the need to establish and close the connection There are no methods and strategies for establishing, distributing, using, and recycling connections, so there is no reasonable use Connections; 3) Connections cannot be reused; 4) Management of allocating and reclaiming connections is not involved.
  • the technical problem to be solved by the present invention is to provide a database connection management method that can overcome the shortcomings of the prior art.
  • the module packaging technology, connection pool design mode, connection management method, and transaction processing method are used to restore the common connection. Consistent management of application and transaction connections provides effective methods, so that connections can be reused and used reasonably, reducing the handshake overhead of connection building and improving database efficiency; ensuring the consistency of transaction connections in the method of forming transactions; reducing The coupling of the details of the database establishment link makes the module easy to maintain; it provides connection management guarantee for secure, high reliability and high performance applications.
  • the module encapsulation technology refers to encapsulating a series of strategies for connection resource allocation, reuse, and connection pool initialization in a module.
  • connection pool for storing database connections, and configure the number of connection generations and the maximum reusable number of each connection that should be placed when the connection pool is initialized;
  • connection pool for each ordinary connection request, establishment and allocation are made so that they can be reused;
  • connection pool a transaction processing method is used to establish, allocate, and use a transaction connection. To maintain its uniqueness, consistency, and support for nested transactions;
  • connection pool the used database connection is recycled so that it can be reused.
  • initialization includes the following steps:
  • the step (1.3) includes the following steps: determining whether there is an idle connection in the connection pool, and if there is an idle connection, directly assigning the connection and starting to reference the count; if not, Then it is judged whether there is a connection that can be reused, if there is a reusable connection, it is directly allocated to the connection with the smallest reference count, and the reference count of the connection is incremented; otherwise, a new connection is established and allocated, and the connection is initialized at the same time .
  • the step (1.4) includes the steps of starting a transaction to obtain a connection, and submitting and rolling back a transaction to dry the connection.
  • the step (1.5) includes the following steps: determining whether the connection pool is full, such as closing the connection if the connection pool is full; otherwise, putting the connection into the connection pool.
  • the database connection and connection management are sealed.
  • a count and Each connection is configured with a maximum reusable number, which is to increase the reference count of the connection each time an ordinary connection is used; select the connection with the smallest reference count as the available connection, and when the connection reference count is less than the maximum
  • the reusable number is judged to be a reusable connection.
  • the number of connection generations to be placed when the connection pool configuration is initialized is determined.
  • the number of connections in the connection pool is less than the above configuration number, it is determined that the connection pool is not full.
  • the step of starting a transaction includes determining whether a connection already exists in the transaction. If a connection exists, the connection is still allocated and its nesting level count is incremented; otherwise, it is determined whether there is an idle connection. If there are idle connections, allocate idle connections; otherwise, establish and allocate new connections.
  • the step of committing and rolling back the transaction includes judging whether it belongs to a nested transaction, and if it belongs, the nesting level of the connection is decremented; otherwise, the transaction is rolled back; wherein the rollback transaction includes the following steps:
  • a transaction registry is provided for each transaction connection, and the correspondence relationship between the thread number where the transaction initiator is located and the connection used by the transaction is registered in the transaction registry when it is established, and the correspondence relationship is deleted at the end. ;
  • the transaction has no correspondence in the transaction registry, and it is determined that the transaction is not connected.
  • a count of the nesting level is provided for each transaction connection. The count is started when it is established, and it is incremented every time it is used, and it is decremented every time it is used.
  • the transaction is a nested connection.
  • connection pool sets non-transaction attributes when initial connections are established, initializes connections when allocating new idle connections, maintains non-transaction attributes when recovering ordinary connections, and restores non-transaction attributes when transactions are rolled back to ensure idleness.
  • Connections are non-transactional attributes, regardless of transactional connections and ordinary connections. When allocating idle connections, both transactional connections and ordinary connections can use all idle connections.
  • the database connection management method provided by the present invention can be applied to the development of various database applications. Compared with traditional transaction and thread connection management methods, the traditional method establishes connections when needed, closes them when they are used, and directly opens and closes the database through threads and global transactions. It lacks connection management and module isolation. It cannot be reused, and the management features such as connection allocation, recycling, and transaction connection management consistency provided by the present invention can be conveniently added as separate modules to the entire system, and all interactions between the development of database business applications and the database are placed in the database.
  • the processing module provided by the invention can achieve efficient and secure connection multiplexing, and effectively solves the abuse and recovery of the connection and greatly improves the efficiency.
  • the connection management module made by the method provided by the present invention is compared with the previous connection application for efficiency testing.
  • FIG. 1 is a schematic flowchart of establishing, assigning, and using a common connection by using a database connection management method provided by the present invention
  • FIG. 2 is a schematic flowchart of starting a transaction by a transaction processing method using the method provided by the present invention
  • FIG. 3 is a schematic flow chart of a method provided by the present invention for submitting and rolling back transactions through a transaction processing method
  • FIG. 4 is a schematic flowchart of recovering connections by using the method provided by the present invention. DETAILED DESCRIPTION OF THE INVENTION The method of the present invention is further developed in conjunction with the following, and the main basic points of the method of the present invention are as follows:
  • connection pool to store management connections; the connection pool can be generated according to the specific application to provide the number of connections that should be placed when the connection pool is initialized.
  • the dynamically generated connections in the program are also placed in the connection pool.
  • the application obtains the connection pool from the connection pool to create a new connection pool. Or the connection is allocated, after the connection is used up, the connection pool recycles or puts the connection dry.
  • the connection pool lays the foundation for the overall management of the connection.
  • connection is divided into two types of transaction connection and ordinary connection, and different methods for transaction connection and ordinary connection management are adopted for different characteristics of ordinary connection and transaction connection:
  • the allocation of idle connections is a case where transaction connections and ordinary connections are not distinguished when applying for a connection, and they are treated the same to avoid when the transaction connection is applied for and the transaction connection has been used up. Although there is an idle ordinary connection, it cannot be used. Conversely, when the ordinary connection is applied for, and the ordinary connection has been used up, although there is an idle transaction connection, it cannot be used.
  • the strategy of reusing ordinary connections and effectively using connections in the inventive method is: Does not distinguish between (static connection) established during initialization and (dynamic connection) re-established when the program is run, 1. According to the specific situation, set the maximum possible Number of multiplexing, multiplexing connections that can be multiplexed. As long as it is an established connection, when the connection reference count is less than the maximum reusable number, it can be reused. The reference count is the number of times a common connection has been multiplexed; the maximum reusable number is the maximum multiplexed number of connections configured by the system. 2. According to the specific situation, set the number of initial connections in the connection pool and recycle the connections that should be recycled.
  • the configuration number of the initial connection of the connection pool may determine the frequency of using idle connections and the frequency of establishing connections in a specific application.
  • the maximum reusable number of connections and the number of initial connections in the connection pool ensure the multiplexing efficiency and usage efficiency of the connection.
  • Transaction processing methods include starting transactions, committing and rolling back transactions. For transactions, pass Through transaction processing methods, so that the transaction does not directly obtain the management of the connection, ensure that the transaction is unique to the connection used, and provide convenience for other modules to start the transaction; at the same time, you can organize the transaction in other ways, or you can call the implemented method to Organize transactions, and even call transaction methods in transactions to form nested transactions.
  • the transaction connection allocation, recycling, and consistent commit of operations on the connection, rollback, and the uniqueness of the connections that make up the transaction operation are all guaranteed by the transaction processing method. At this time, it not only meets the transaction requirements for the connection, but also does not prevent the connection reuse, and realizes the safe reuse.
  • the present invention proposes an efficient database connection multiplexing method, which is described in each step by step as follows:
  • Step 1 establish and initialize the connection pool
  • the first step is to establish a connection pool when the system (DBMS) is initialized, and the connection pool is configured according to the specific system usage to configure the number of connections that should be placed when the connection pool is initialized. At the same time, the maximum number of multiplexable connections can be configured.
  • the second step is to initialize the connection pool, that is, when the system receives the connection request for the first time, the connection request includes ordinary connection and transaction connection. The system initializes the connection pool, establishes the connection according to the configured number of connections, and puts it into the connection pool. .
  • Step 2 Use connection pool management methods to establish, allocate, and initialize and use connections.
  • the initial connection specifically refers to setting the type of the connection when assigning an idle or new connection, which is a normal connection, setting a non-transaction attribute, providing a reference count, which is a transaction connection, setting a transaction attribute, and providing a nested hierarchy of records.
  • the number also provides explicit transaction start, end (commit or rollback) statements, and a transaction registry for the transaction connection.
  • the above transaction registry registers the correspondence between the transaction initiator and the connection used by the transaction to ensure the consistency of the connection used by the transaction.
  • the table is dynamically generated at runtime based on the actual call situation. This table isolates the transaction processing part and the connection management part.
  • the connection used by the transaction in the present invention is the only one used in the running of the transaction and cannot be reused.
  • the method of the present invention is used to establish, allocate, initialize, and reuse common connections by using a connection pool management method that avoids the overhead of establishing a handshake for each connection.
  • “Start” in the figure indicates that when an application requests a common connection , Go to step 1; step 1 to check whether the connection pool has been initialized. No, initialize the connection pool first, and then go to step 2; if yes, go directly to step 2.
  • Step 2 query whether there is the call in the transaction registry Yes, it indicates that the request for the ordinary connection is part of the transaction, and the consistency of the connection should be guaranteed, so the connection registered by the caller in the transaction registry is returned; if not, the process proceeds to step 3.
  • Step 3 query whether there are unused idle connections in the connection pool.
  • Step 4 query whether there are reusable Connection, that is, whether there is a connection whose number of references does not reach the maximum reuse count. No, a new connection is established, and the connection is Start the reference count; if yes, then find a connection with the smallest reference count and not reaching the maximum reference count in the connection pool, reuse the connection and increase its reference count by 1. Multiplexing the connection means, first There is a connection that can be reused. It does not distinguish between a connection established during initialization (static connection) and a connection that is re-established when the program is run (dynamic connection).
  • connection pool As long as it is not an idle connection, whether it is a normal connection or a transactional connection, as long as If it is not occupied, it is popped from the stack (connection pool), it is judged to be a normal connection, it is judged that the reference count is the smallest, and the connection is reused.
  • connection pool management method is invoked to establish, allocate, and initialize, and only use a transaction connection by using the transaction processing modes of start, commit, and rollback.
  • the connection of transactions is consistent in the method of forming a transaction. Sex guarantees, and Set of business support.
  • step 1 checks whether the connection pool has been initialized. No, initialize the connection pool first and proceed to step 2; If yes, go directly to step 2.
  • step 2 check whether there is a connection used by the transaction initiator for registration in the transaction registry. Yes, it indicates that this is a nested transaction and returns the transaction initiator used in the transaction registry. Connect and increment the nesting level count of the transaction connection; if no, go to step 3.
  • Step 3 queries whether there are unused idle connections in the connection pool. If yes, go directly to step 4; if no, create a For a new connection, go to step 4.
  • Step 4 Register the correspondence between the thread number where the transaction initiator is located and the connection used by the transaction to the transaction registry, and at the same time start the transaction nesting level count and set the corresponding transaction connection Properties. All subsequent accesses to the database by the same transaction are done by looking up the registry and using already allocated connections, which guarantees All operations in this transaction use the same database connection.
  • commit and roll back the transaction "Start" in the figure indicates that when all tasks of the transaction are completed, the steps of calling the commit and roll back transaction are entered. First obtain the connection used by the transaction from the call value of the transaction connection, and then check the type and nesting level of the connection used by the transaction in the transaction registry.
  • connection used is Nested transactions, decreasing the nesting level of the connection; when the connection exists and the nesting level is less than or equal to 1, the use of the connection is not a nested transaction, submit all operations completed on the connection to the database, and connect from the transaction Remove the connection number from the call value pair, restore the non-transactional attributes of the connection, delete the initiator of the transaction and the used transaction connection pair from the transaction registry, and then call the connection pool management method to recover the connection.
  • Step 3 use the connection pool manager Cannot recycle connection.
  • Step 1 check whether the connection is empty or has been closed. Yes, the call returns; instead, go to step 2.
  • Step 2 Check whether the transaction consists of a series of existing database methods in the transaction connection registry, that is, whether the connection exists. Yes, the call returns; instead, go to step 3.
  • Step 3 Check whether there are other referees for the connection, that is, check whether there are registrations of recyclers for the connection in the transaction registry.
  • Step 4 Check whether the number of connections in the connection pool has reached the initial set number. No, put the connection into the connection pool; Yes, close the connection and recycle. Closing the connection means that it does not distinguish between the connection established during initialization (static connection) and the connection re-established when the program is run (dynamic connection). When the used connection is released, only the connection in the stack (connection pool) is released. The number does not reach the number of connections initially configured. Instead of closing it because it is a dynamic connection, it pushes it onto the stack for later use.
  • connection pool parent object such as defined as ConpoolClas s
  • connection child objects such as defined as ConnClas s
  • transaction registry parent object such as defined AfregClas s
  • transaction sub-objects such as AffClas s
  • connection number attributes of the connection pool object such as (Defined as lnkNum), the number of initial connections (such as beginNum), the maximum number of multiplexed ordinary connections (such as muxNum), and the create () method
  • the initialization operation using the constructor) method
  • Connection pool management methods include creating new connections (such as defined as creatComi O), obtaining ordinary connections (such as defined by getCommConn ()), releasing multiplexed ordinary connections (defined as releaseMuxConn ()), and recycling connections (such as defined as releaseConn O) method to ensure secure reuse of ordinary connections.
  • connection object Define the non-transactional attributes of the connection object (such as defined as commTrue), the reference attribute of the common connection object (such as defined as usedTrue) or the nesting level of the transaction connection (such as defined as usedN legs) and the connection initialization operation (using Constructor) method.
  • record attributes of the transaction registry object such as affRecord
  • affRecord which records the originator of the transaction
  • the transaction connection including connection, connection type, and nesting level
  • delRecord O the definition of the transaction A method of registering transactions (such as defined as regRecord O) and transaction declaring transactions of registry objects (such as defined as delRecord O).
  • connection call attributes of the transaction object such as defined as usedLink
  • the transaction processing methods include methods to start the transaction (such as defined as beginTrans 0), and commit and roll back the transaction (such as defined to endTrans O).
  • the Connpool When the system is initialized, call the Connpool.
  • CreateConn () creates the connection sub-object ConnClassN (1 ⁇ N ⁇ beginNum), set ConnClassN. usedTrue: -False, push the connection into the connection pool stack.
  • the application requests a transaction connection
  • the transaction object corresponding to the application is AffClassN (N is a natural number)
  • RegRecord ConnClassK, transaction number
  • BeginTrans thePool. ConnClassK
  • UsedLink thePool. CoimClassK.
  • EndTrans () is called, which includes obtaining the connection number from thePool.
  • the system in the specific implementation provided by the present invention refers to a database management system DBMS.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

一种数据库连接的管理方法 技术领域 本发明涉及数据库应用开发, 具体涉及一种核心思想是连接复用的 数据库连接管理方法, 更具体地说, 涉及一种数据库连接的高效管理方 法。 背景技术 在数据库应用开发中, 连接的管理是一个难点, 它是决定该应用性 能的一个重要因素。 连接管理包括对建立、 使用和关闭连接的管理, 刚 开始由于对数据库的访问不是很频繁,传统连接管理采用需要时就建立、 用完就关闭的策略, 主要分为分布式事务和工作线程 2种管理方式。 其 中, 建立连接是指应用开始访问 DB前向 DBMS提出连接申请并由 DBMS 建立相应的连接; 使用连接是指应用占用连接来访问和使用数据库; 回 收连接是指在应用访问结束后, 根据情况释放或者回收该应用所使用的 连接。
事务方式仅仅提供了对分布式事务的管理方法, 将应用内化为全局 事务,将应用对连接的使用,转化为通过全局事务获取和关闭连接。 1999 年 6 月 14 日提交的申请号为 333141 的美国专利, 公开了一种使用 JDBC1. 0驱动支持分布式事务的方法, 它提供了一种基于 JDBC1. 0支持 分布式事务的方法, 不是为每一个连接请求分配一个新的物理连接, 而 是在内部为全局事务和它们使用的连接维护一张映射表。 由于这种方式 是基于事务的, 而在这种方式中, 事务获取和关闭连接不具备对连接的 有效利用, 因此即使在一个事务中对数据库有多个连接请求, 仍然保持 对同一条连接的使用, 造成了资源浪费。
另一种管理是用线程方式将对应用内化为工作线程, 从而将应用对 连接的使用, 转化为通过工作线程获取和关闭连接。 2000年 7月 7 日提 交的申请号为 611604的美国专利,公开了一种对数据库管理系统的连接 进行管理的方法和系统, 每个数据库管理系统对应一个数据库系统, 其 中建有一系列的工作线程, 将对数据库的请求分配到这些工作线程上去 执行, 也包括将特定的连接, 工作线程和已用过的数据库子系统连接起 来。 这种线程方式充分利用了计算机线程管理的优势, 大大提高了执行 效率, 也很大程度提高了应用性能, 但由于这种方式是基于线程的, 而 在这种方式中线程获取和关闭连接也不具备对连接的有效利用, 因此, 一旦出现同一工作线程对同一数据库子系统的调用, 就仍然使用同一连 接, 造成了效率低下。
对上述两种连接管理技术进行分析, 分别存在如下缺陷: 1 )同一工 作线程对同一子系统的同一连接的使用或同一事务对数据库同一条连接 的使用, 都等于是为该应用或子应用分配固定连接, 而不管该连接的真 正的使用情况, 没有从整体上对连接进行管理, 使得连接的使用效率不 高; 2 )有建立和关闭连接,但没有用于判断需要建立和关闭连接的条件, 没有建立、 分配、 使用和回收连接的方法以及策略, 从而没有合理使用 连接; 3 ) 不能复用连接; 4 ) 没有涉及对分配和回收连接的管理。 发明内容 本发明要解决的技术问题是提供一种可以克服上述现有技术缺点的 数据库连接的管理方法, 采用模块封装技术、 连接池设计模式、 连接管 理方法和事务处理方法, 为普通连接的复用及事务连接的一致性管理提 供了有效方法, 从而能复用和合理使用连接, 减少连接建链的握手开销, 提高数据库使用效率; 保证事务的连接在组成事务的方法中的一致性; 减少数据库建立链接的细节产生的耦合,使模块便于维护; 为得到安全, 高可靠性, 高性能的应用提供连接管理保证。 所述的模块封装技术是指 将对连接资源的按策略回收分配 , 复用以及连接池初始化等一系列策略 封装在模块内部。
本发明上述技术问题可以这样解决, 构造一种数据库连接的管理方法, 包括以下步骤:
1. 1)建立用于存放数据库连接的连接池, 配置该连接池初始化时应放 置的连接生成数目和每个连接的最大可复用数;
1. 2)对建立的连接池进行初始化, 按所配置的所述连接生成数目建立 连接、 设置非事务属性并放入所述连接池中;
1. 3)在所述连接池中, 对每一个普通连接请求, 建立及分配使之能被 复用;
1. 4)在所述连接池中, 利用事务处理方法来建立、 分配并使用事务连 接, 保持其唯一性、 一致性并且支持嵌套事务;
1. 5)在所述连接池中, 回收使用完的数据库连接使之可被再使用。 在上述按照本发明提供的方法中, 对新建连接进行初始化, 其中, 所 述初始化包括以下步骤:
2. 1) 设置该连接的非事务属性;
2. 2 )为普通连接提供一个引用的记数, 为事务连接提供嵌套层次的记 数;
2. 3 )为事务连接提供显式的事务开始、 结束声明和以及一个事务注册 表。
在上述按照本发明提供的方法中, 所述步驟(1. 3)包括以下步骤: 判断 连接池是否存在空闲连接, 如有空闲连接, 则直接分配该连接, 开始引用 记数; 如不存在, 则判断是否有可被复用的连接, 如有可复用连接则直接 分配到引用记数最小的连接, 同时递增该连接的引用记数; 否则, 建立和 分配新的连接, 同时初始化该连接。
在上述按照本发明提供的方法中, 根据步骤(1. 4)包括启动事务使之获 得连接, 以及提交和回退事务使之幹放连接的步骤。
在上述按照本发明提供的方法中, 所述步骤(1. 5)包括以下步骤: 判断 连接池是否是满的, 如连接池已满关闭该连接; 否则, 将该连接放入连接 池。
在上述按照本发明提供的方法中, 对数据库的连接和连接管理进行封 装。
在上述按照本发明提供的方法中, 为每个连接提供一个弓 I用记数和为 每个连接配置一个的最大可复用数, 是在每次使用普通连接时都递增该连 接的引用记数; 选择所述引用记数最小的连接作为可用连接, 当该连接引 用记数小于最大可复用数, 判断为可复用的连接; 复用连接时, 不区分初 始化时建立的连接和程序运行时被重新建立出来的连接, 最大效用地复用 已经被建立出来的连接。
在上述按照本发明提供的方法中, 为连接池配置初始化时应放置的连 接生成数目, 当连接池中连接的数小于上述配置数目时, 判断连接池未满。
在上述按照本发明提供的方法中, 所述启动事务步骤包括判断该事务 是否已存在有连接, 如存在连接, 仍然分配该连接并递增其嵌套层次记数; 否则, 判断是否有空闲连接, 如有空闲连接, 分配空闲连接; 否则, 建立 和分配新连接。
在上述按照本发明提供的方法中, 所述提交和回退事务步驟包括判断 是否属于嵌套事务, 如属于则递减连接的嵌套层次; 否则回退事务; 其中 回退事务包括以下步骤:
10. 1 ) 恢复连接的非事务属性;
10. 2 ) 删除事务注册表中该事务的发起者和使用的事务连接对应关 系的记录;
10. 3 ) 回收该连接。
在上述按照本发明提供的方法中, 为每个事务连接提供一个事务注册 表, 建立时将事务发起者所在的线程号和事务使用的连接的对应关系登记 到事务注册表, 结束时删除对应关系; 事务在事务注册表中无对应关系, 判断该事务没有连接。 在上述按照本发明提供的方法中, 为每个事务连接提供嵌套层次的记 数, 建立时开始记数, 每使用一次递增, 每用完一次递减; 嵌套层次的记 数大于 1 , 判断该事务为嵌套连接。
在上述按照本发明提供的方法中, 连接池建立初始连接时设置非事务 属性、 分配新的空闲连接时初始化连接, 回收普通连接时保持非事务属性 和事务回退时恢复非事务属性, 保证空闲连接都是非事务属性, 不分事务 连接和普通连接, 使分配空闲连接时, 事务连接和普通连接都能使用所有 空闲连接。
实施本发明提供的数据库连接的管理方法, 可应用于各种数据库应用 开发中。 与传统的事务和线程的连接管理方法相比, 传统方法对连接需要 时就建立, 用完就关闭的方式和通过线程和全局事务直接对数据库打开关 闭操作的方式, 缺乏连接管理和模块隔离, 不能复用, 而本发明提供的对 连接的分配, 回收, 以及事务连接管理一致性等管理特性可以方便地作为 单独的模块加入到整个系统中, 将开发数据库业务应用对数据库的交互全 都放在该发明提供的处理模块内部, 能够做到高效, 安全的连接复用, 并 且有效地解决了连接的滥用及回收, 极大地提高了效率。 对该发明提供的 方法作成的连接管理模块和以往对连接的应用做过效率上的测试比对, 发 现在连接管理的安全, 可靠性及效率方面, 都比以往有了很大的提高, 实 用性强。 附图说明 图 1是利用本发明提供的数据库连接的管理方法, 建立、 分配和使 用普通连接的流程示意图;
图 2是利用本发明提供方法, 通过事务处理方法启动事务的流程示 意图;
图 3是本发明提供方法, 通过事务处理方法提交和回退事务的流程 示意图;
图 4是利用本发明提供方法, 回收连接的流程示意图。 具体实施方式 结合下面对本发明方法进一步展开, 说明发明方法的主要基础点如 下:
1 ) 建立连接池存放管理连接;该连接池可以根据具体应用提供该 连接池初始化时应放置的连接数目生成, 程序中动态生成的连接也放入 连接池, 应用从连接池中获取连接池新建或分配的连接, 连接使用完, 由连接池回收或幹放连接 , 连接池为连接整体管理奠定基础。
2 ) 把连接分为事务连接和普通连接二类,并针对普通连接和事务 连接不同特点对事务连接和普通连接管理采取不同的方法:
3 ) 建立、 分配和使用普通连接, 复用已有的普通连接;
4 ) 通过事务处理方法来建立、 分配和使用事务连接, 保证事务数 据库连接的一致和支持嵌套事务, 最后回收连接,使连接能被重复利用, 从而能安全地复用、 整体地管理和有效地使用连接, 既复用普通连接, 又保证事务数据库连接的一致和支持嵌套事务,提高了数据库使用效率。
5 ) 封装数据库原始连接和连接管理,即把连接和连接管理封装在 该发明提供的数据库模块内部, 隔离应用的本身的处理逻辑和具体数据 库访问逻辑, 减小和其他模块之间的耦合性, 为应用本身的复用奠定基 础; 同时方便了应用对于连接尤其是对于事务连接的使用, 提高了开发 效率。 '
6 ) 配空闲连接是申请连接时不区分事务连接和普通连接, 而将其 一致对待, 避免当事务连接被申请, 而事务连接已被用空, 虽有空闲的 普通连接, 却不能使用的情况; 反之当普通连接被申请, 而普通连接已 被用空, 虽有空闲的事务连接, 却不能使用的情况。
7 ) 发明方法中复用普通连接和有效使用连接的策略是: 不区分初 始化时建立的(静态连接)和程序运行时被重新建立出来的(动态连接), 一、 根据具体情况, 设置最大可复用数, 复用可被复用的连接。 只要是 已被建立的连接, 当连接引用记数小于最大可复用数, 就可以被复用。 所述引用记数是普通连接已被复用的次数; 最大可复用数是系统配置的 连接最大复用数。 二、 根据具体情况, 设置连接池初始连接的配置数, 回收应该被回收的连接。 当被用完的连接被释放时, 只要连接池中的连 接数未达到该配置, 就将该连接回收, 以备后用。 所述连接池初始连接 的配置数在一个具体应用上可以决定使用空闲连接的频率和建立连接的 频率。 通过连接的最大可复用数和连接池初始连接的配置数, 保证了连 接的复用效率和使用效率。
8 ) 事务处理方法包括启动事务, 提交和回退事务。 对于事务, 通 过事务处理方法来处理, 使事务不直接获得对连接的管理, 保证事务对 所用连接的唯一性, 为其他模块启动事务提供方便; 同时可以按其他方 式组织事务, 也可以调用已实现的方法来组织事务, 甚至可以在事务中 调用事务方法组成嵌套事务。 事务连接的分配, 回收以及连接上操作的 一致提交, 回退和组成事务操作使用的连接的唯一性都由事务处理方法 保证。 这时既满足了事务对连接的要求又不防碍连接复用, 实现了安全 复用。
本发明提出了一种高效的数据库连接复用方法, 分各个步骤逐个说 明如下:
步骤 1 : 建立和初始化连接池
第 1步在系统 (DBMS ) 初始化时建立一个连接池, 该连接池根据具 体系统使用用配置该连接池初始化时应放置的连接生成数目, 同时配置 每个连接可达的最大复用数。 第 2步初始化连接池, 即系统在第一次得 到连接请求时, 连接请求包括普通连接的和事务连接的, 系统会对连接 池进行初始化, 按照配置的连接数目建立连接并放入连接池中。
步骤 2 : 用连接池管理方法建立、 分配和初始化以及使用连接。 初 始化连接具体是指, 在分配空闲或新连接时, 设置该连接的类型, 是普 通连接, 设置非事务属性, 提供一个引用的记数, 是事务连接, 设置事 务属性,提供嵌套层次的记数同时为该事务连接提供了显式的事务开始、 结束(commi t或者 rol lback )声明和以及一个事务注册表。 上述事务注 册表, 登记了事务发起者和事务使用的连接的对应关系, 保证了事务使 用连接的一致性。 该表是在运行时根据实际的调用情况动态生成的, 通 过该表隔离了处理事务的部分和连接管理部分。 本发明中事务使用的连 接在该事务运行中唯一使用、 不能被复用的。
如图 1所示, 利用本发明的方法, 用避免每个连接建链握手开销的 连接池管理方法建立、 分配和初始化以及复用普通连接: 图中 "开始,, 表示当应用请求普通连接时, 进入第 1步; 第 1步查看连接池是否已经 初始化。 否, 先初始化连接池, 再进入第 2步; 是, 则直接进入第 2步。 第 2步查询事务注册表中是否有该调用者的记录。 是, 说明对普通连接 的请求是组成事务的一部分, 应该保证该连接的一致性, 所以返回在该 事务注册表中该调用者登记的连接; 否, 则进入第 3步。 第 3步查询连 接池中是否有未被使用的空闲连接。 是, 返回其中的一个空闲连接并开 始该连接的引用记数; 否, 则进入第 4步。 第 4步查询是否有可复用的 连接, 即是否有连接引用的记数没有达到最大复用记数的连接。 否, 建 立一个新的连接, 并且对这个连接开始引用记数; 是, 则在连接池中找 出一个引用记数最小并且没有达到最大引用记数的连接, 复用该连接并 将它的引用记数加一。 复用连接是指, 首先有可被复用的连接, 不区分 初始化时建立的连接 (静态连接) 和程序运行时被重新建立出来的连接 (动态连接), 只要不是空闲的连接, 不管他是普通连接还是事务连接, 只要未被占用, 就将它弹出堆栈(连接池), 判断是普通连接, 判断引用 记数最小, 复用该连接。
进一步, 如图 2、 图 3所示, 利用启动、 提交和回退的事务处理方 式调用连接池管理方法建立、 分配和初始化以及唯一使用事务连接, 对 事务的连接在组成事务的方法中的一致性给予了保证, 并且提供了对嵌 套事务的支持。
如图 2所示, 启动事务: 图中 "开始,,表示当应用请求事务连接时, 进入第 1步; 第 1步查看连接池是否已经初始化。 否, 先初始化连接池, 进入第 2步; 是, 则直接进入第 2步。 第 2步查看事务注册表中是否有 该事务发起者的注册使用的连接。 是, 说明这是一个嵌套事务, 返回事 务注册表中该事务发起者使用的连接并将事务连接的嵌套层次记数递 增; 否, 则进入第 3步。 第 3步查询连接池中是否有未被使用的空闲连 接。 是, 直接进入第 4步; 否, 则建立一个新的连接, 再进入第 4步。 第 4步登记事务发起者所在的线程号和事务使用的连接的对应关系到事 务注册表,同时开始事务的嵌套层次记数和设置该事务连接的相应属性。 后面的同一事务对数据库的所有访问都是通过查找该注册表, 使用已经 分配的连接来完成的, 这样就保证了该事务中所有操作使用同一个数据 库连接。
如图 3所示, 提交和回退事务: 图中 "开始" 表示当事务的所有任 务完成后, 进入调用提交和回退事务步驟。 首先从事务连接调用值获得 该事务使用的连接, 再查看事务注册表中该事务使用的连接的类型和嵌 套层次, 当该连接为 NULL或者其嵌套层次大于 1, 则使用该连接的是嵌 套事务, 将该连接的嵌套层次递减; 当该连接存在且嵌套层次小于等于 1 , 则使用该连接的不是嵌套事务,提交在该连接上完成的所有操作到数 据库,从事务连接调用值对中去除该连接号, 恢复该连接的非事务属性, 同时将该事务的发起者和使用的事务连接对从事务注册表中删除, 然后 调用连接池回收连接的管理方法回收该连接。 步骤 3: 用连接池管理方 法回收连接。
如图 4所示, 提交和回退事务: 图中 "开始" 表示连接使用完后, 进入第 1步; 第 1步查看连接是否为空或者已经被关闭。 是, 调用返回; 不是进入第 2步。 第 2步查看事务连接注册表中, 事务是否由一系列已 有的数据库方法构成即是否存在该连接。 是, 调用返回; 不是进入第 3 步。 第 3步查看该连接是否存在其他的引用者, 即查看事务注册表中, 是否有该连接的回收者的登记。 是, 说明该数据库方法被一个事务所调 用, 而事务的结束由事务提交或事务回退完成, 所以此时除递减引用记 数外不做其他处理, 调用返回; 否, 检查该连接的引用记数, 大于等于 1 , 则说明还有引用者, 调用失败返回。 小于 1, 则从当前被使用的结构 中取出, 准备回收, 进入第 4步。 第 4步查看连接池中的连接数目是否 已经达到初始设定的数目。 否, 将该连接放入连接池中; 是, 将该连接 关闭, 回收。 关闭连接是指, 不区分初始化时建立的连接 (静态连接) 和程序运行时被重新建立出来的连接(动态连接), 当被用完的连接被释 放时, 只要堆栈 (连接池) 中的连接数未达到初始配置的连接数目, 而 不由于它是动态连接, 就将它关闭, 而是将它推入堆栈, 以备后用。
下面用 JAVA语言实现的一个例子来说明本发明。一利用 JAVA提供 的面向对象的设计方法定义本发明的对象层次结构: 建立连接池父对象 (比如定义为 ConpoolClas s ) 和连接子对象 (比如定义为 ConnClas s ), 事务注册表父对象(比如定义为 AfregClas s )和事务子对象(比如定义 为 AffClas s )。 二利用这种面向对象设计方法和 JAVA语言定义、 描述本 发明对象提供的功能和属性: 定义连接池对象的所含连接数属性 (比如 定义为 lnkNum )、 初始化连接数(比如定义为 beginNum )、 普通连接最大 复用数 (比如定义为 muxNum )和建立( create () )方法、 初始化操作(利 用构造函数)方法以及使用 synchronized关键字定义连接池管理方法包 括新建连接 (比如定义为 creatComi O )、 获取普通连接 (比如定义为 getCommConn () )、释放复用的普通连接( 匕^口定义为 releaseMuxConn () ) 和回收连接(比如定义为 releaseConn O ) 的方法, 保证安全复用普通 连接。定义连接对象的非事务属性(比如定义为 commTrue )、占用属性(比 如定义为 usedTrue)普通连接对象的引用记数属性或事务连接的嵌套层 次 (比如定义为 usedN腿) 和连接初始化操作(利用构造函数)方法。 定 义事务注册表对象 (比如定义为 affRecord ) 的记录属性, 该记录属性 是记录了事务的发起者、 使用的事务连接 (含连接、 连接类型及嵌套层 次) 以及它们间对应关系; 以及定义事务注册表对象的事务开始的登记 事务(比如定义为 regRecord O ) 和事务结束声明的注销事务(比如定 义为 delRecord O ) 的方法。 定义事务对象的连接调用属性 (比如定义 为 usedLink )、事务处理方法包括启动事务(比如定义为 beginTrans 0 )、 提交和回退事务(比如定义为 endTrans O )的方法。 三通过以上用面向 对象方法建立的对象和方法, 按以下步骤实现本发明:
系统初始化时调用 Connpool. create (thePool)方法为一个数据库 创 建一个连接池对 象 thePool , 设置 thePool. beginNum 和 thePool. muxNum, 并设置数据库对象的连接池存在标示 pool l: =Fal se, 同时调用 AffRecord. Create (theRecord) 创建一个事务注册表对象; 当 系统第一次得到该数据库的连接请求(见下),调用构造函数初试化该连 接池 thePool,并设置数据库对象的连接池存在标示 pooll: =Tr.ue; 其中 在这个方 法 中 调 用 连接池方 法 , thePool. createConn () 按 thePool. beginNum数目创建连接子对象 ConnClassN (1< N < beginNum) , 设置 ConnClassN. usedTrue: -False, 连接压入连接池堆栈。
进一步, 普通连接请求管理: 应用请求普通连接, 判断 poolI=False , 调用构造函数初试化 thePool; poolI= True , 查询 theRecord有该应用, 应用调用 thePool. getCommConn 0返回 theRecord 记录的连接号的连接; 没有,判断 thePool. ConnClassM. usedTrue=Flase (1 <M< InkNum) , 应用调用 thePool. getCommConn (thePool. ConnClassM) 选用它;所有连接 usedTrue都为 True,选用最小的 thePool. ConnClassM. usedNum, 判断 thePool. ConnClassM. usedNum<thePool. muxNum, 调用 thePool. getCommConn (thePool. ConnClassM) 选 用 它 ; 若 最 小 的 thePool. ConnClassM. usedNum > thePool. muxNum, thePool. Create (ConnClassK) , ( InkNum: = InkNum +1, K: -InkNum ) 建立新连接, 再调 用 thePool. getCommConn (thePool. ConnClassK)。
进一步, 启动事务: 应用请求事务连接, 该应用对应的事务对象为 AffClassN(N 为自然数), 判断 poolI=False, 调用构造函数初试化 thePool; pooll: = True, 查询 theRecord有该应用, 找到连接号, 调用 AffClassN. beginTrans () 返回 theRecord记录的连接号的连接; 没有, 判断 thePool. ConnClassM. usedTrue=Flase(l M< InkNum) , 应用调用 AffClassN. beginTrans (thePool. ConnClassM) 选用 它 ; 所有 连接 usedTrue都为 True, thePool. Create (ConnClassK) , ( InkNum: = InkNum +1, K: =lnkNum)建立新连接, 调用 theRecord. regRecord (ConnClassK, 事务号)登记, 调用 AffClassN. beginTrans (thePool. ConnClassK)选用, 设置 AffClassN. usedLink: = thePool. CoimClassK。
进一步, 提交、 回退事务: 事务所有任务完成, 调用 AffClassN. endTrans () , 其中包括从该事务 AffClassN. beginTrans 0的 thePool. ConnClass 参数获得连接号, 根据连接号查询 theRecord 中的连接 ConnClassX, 是嵌套事务调用 AffClassN. endTrans 0; 不是, 设置 AffClassN. usedLink: =NULL, ConnClass. commTrue: =True,调用 theRecord. delRecord (AffClassN)取消登记, 调用 thePool. ReleaseConn (ConnClassX) 回收连接。
进一步, 回收连接: 连接 ConnClassX使用完后, 调用 thePool. releaseConn (ConnClassX)方法。 ReleaseConn ( ) 包括: 判断连接占用 ConnClassX. usedTrue=True, 返回; ConnClassX. usedTrue=False,判断 连接类型, 一种事务由一系列已有的数据库方法构成情况即 theRecord 中有该连接, 返回; 一种是事务调用的连接, 调用该事务 AffClassX. endTrans (); 一种 ConnClassX. commTrue: =True, 判断 ConnClass. usedNum>l, 调用 thePool. releaseMuxConn (ConnClassX); 判断 ConnClass. usedNum < 1, 判断 thePool. InkN腿〉 thePool. beginNum, 调用释构函数释放该连 接 ConnClassX; 否贝' J, 设置 ConnClassX. usedTrue: =False。
本发明提供的具体实现方式中所述系统是指数据库管理系统 DBMS。

Claims

权 利 要 求
1. 一种数据库连接的管理方法, 其特征在于, 包括以下步骤: 1. 1 ) 建立用于存放数据库连接的连接池,配置该连接池初始化时 应放置的连接生成数目和每个连接的最大可复用数;
1. 2 ) 对建立的连接池进行初始化,按所配置的所述连接生成数目 建立连接、 设置非事务属性并放入所述连接池中;
1. 3 ) 在所述连接池中, 对每一个普通连接请求, 建立及分配使之 能被复用;
1. 4 ) 在所述连接池中, 利用事务处理方法来建立、 分配并使用事 务连接, 保持其唯一性、 一致性并且支持嵌套事务;
1. 5 ) 在所述连接池中, 回收使用完的数据库连接使之可被再使 用。
2. 根据权利要求 1所述数据库连接的管理方法, 其特征在于, 对新 建连接进行初始化, 其中, 所述初始化包括以下步骤:
2. 1) 设置该连接的非事务属性;
2. 2) 为普通连接提供一个引用的记数, 为事务连接提供嵌套层次 的记数;
2. 3) 为事务连接提供显式的事务开始、 结束声明和以及一个事务 注册表。
3. 根据权利要求 1所述数据库连接的管理方法, 其特征在于, 所述 步驟(1. 3)包括以下步骤:判断连接池是否存在空闲连接,如有空闲连接, 则直接分配该连接, 开始引用记数; 如不存在, 则判断是否有可被复用 的连接, 如有可复用连接则直接分配到引用记数最小的连接, 同时递增 该连接的引用记数; 否则, 建立和分配新的连接, 同时初始化该连接。
4、 根据权利要求 1所述数据库连接的管理方法, 其特征在于, 根 据步骤(1 , 4)包括启动事务使之获得连接,以及提交和回退事务使之释放 连接的步骤。
5、 根据权利要求 1所述数据库连接的管理方法, 其特征在于, 所 述步骤(1. 5)包括以下步骤: 判断连接池是否是满的, 如连接池已满关闭 该连接; 否则, 将该连接放入连接池。
6、 根据权利要求 1-5中任何一项所述数据库连接的管理方法, 其 特征在于, 对数据库的连接和连接管理进行封装。
7、 根据权利要求 1或 2或 3所述数据库连接的管理方法, 其特征 在于, 为每个连接提供一个引用记数和为每个连接配置一个的最大可复 用数, 是在每次使用普通连接时都递增该连接的引用记数; 选择所述引 用记数最小的连接作为可用连接,当该连接引用记数小于最大可复用数, 判断有可复用的连接; 复用连接时, 不区分初始化时建立的连接和程序 运行时被重新建立出来的连接,最大效用地复用已经被建立出来的连接。
8、 根据权利要求 1或 5所述数据库连接的管理方法, 其特征在于, 为连接池配置初始化时应放置的连接生成数目, 当连接池中连接的数小 于上述配置数目时, 判断连接池未满。
9、 根据权利要求 4所述数据库连接的管理方法, 其特征在于, 所 述启动事务步驟包括判断该事务是否已存在有连接, 如存在连接, 仍然 分配该连接并递增其嵌套层次记数; 否则, 判断是否有空闲连接, 如有 空闲连接, 分配空闲连接; 否则, 建立和分配新连接。
10、 根据权利要求 4所述数据库连接的管理方法, 其特征在于, 所 述提交和回退事务步骤包括判断是否属于嵌套事务, 如属于则递减连接 的嵌套层次; 否则回退事务; 其中回退事务包括以下步驟:
10. 1 ) 恢复连接的非事务属性;
10. 2 ) 删除事务注册表中该事务的发起者和使用的事务连接对应 关系的记录;
10、 3 ) 回收该连接。
11、根据权利要求 2、 9、 10中任何一项所述数据库连接的管理方法, 其特征在于, 为每个事务连接提供一个事务注册表, 建立时将事务发起 者所在的线程号和事务使用的连接的对应关系登记到事务注册表, 结束 时删除对应关系; 事务在事务注册表中无对应关系, 判断该事务没有连 接。
12、 根据权利要求 11所述数据库连接的管理方法, 其特征在于, 为 每个事务连接提供嵌套层次的记数, 建立时开始记数,每使用一次递增, 每用完一次递减; 嵌套层次的记数大于 1, 判断该事务为嵌套连接。 .
13、根据权利要求 1、 2、 10中任何一项所述数据库连接的管理方法, 其特征在于, 连接池建立初始连接时设置非事务属性、 分配新的空闲连 接时初始化连接, 回收普通连接时保持非事务属性和事务回退时恢复非 事务属性, 保证空闲连接都是非事务属性, 不分事务连接和普通连接, 使分配空闲连接时, 事务连接和普通连接都能使用所有空闲连接。
PCT/CN2003/001016 2002-12-25 2003-11-28 Procede d'administration de connexions a une base de donnees WO2004059906A1 (fr)

Priority Applications (2)

Application Number Priority Date Filing Date Title
BR0317733-5A BR0317733A (pt) 2002-12-25 2003-11-28 Processo para administração de conexão de base de dados
AU2003289602A AU2003289602A1 (en) 2002-12-25 2003-11-28 A method for administrating database connection

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CNB021399484A CN1317653C (zh) 2002-12-25 2002-12-25 一种数据库连接的高效管理方法
CN02139948.4 2002-12-25

Publications (1)

Publication Number Publication Date
WO2004059906A1 true WO2004059906A1 (fr) 2004-07-15

Family

ID=32661076

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2003/001016 WO2004059906A1 (fr) 2002-12-25 2003-11-28 Procede d'administration de connexions a une base de donnees

Country Status (4)

Country Link
CN (1) CN1317653C (zh)
AU (1) AU2003289602A1 (zh)
BR (1) BR0317733A (zh)
WO (1) WO2004059906A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11995481B2 (en) 2022-08-22 2024-05-28 Sap Se Efficient connection pooling

Families Citing this family (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8244865B2 (en) * 2004-10-08 2012-08-14 International Business Machines Corporation Method and apparatus for autonomic management of connection pools
CN1815469B (zh) * 2005-02-01 2010-04-28 华为技术有限公司 一种数据库连接资源的管理方法
JP2006228135A (ja) * 2005-02-21 2006-08-31 Brother Ind Ltd コンテンツ提供システム,出力制御装置およびプログラム
CN100395710C (zh) * 2005-05-27 2008-06-18 华为技术有限公司 一种多线程应用程序访问数据库的方法
CN100458790C (zh) * 2006-12-31 2009-02-04 中国建设银行股份有限公司 访问数据库的方法和系统
CN101447993B (zh) * 2008-12-23 2012-01-25 深圳市金蝶中间件有限公司 查找连接池中未释放的连接的方法和装置
CN101777047A (zh) * 2009-01-08 2010-07-14 国际商业机器公司 多租户环境下访问数据库的系统、设备和方法
CN102081611B (zh) * 2009-11-26 2012-12-19 中兴通讯股份有限公司 一种主、备网管系统数据库同步的实现方法及装置
CN102346767B (zh) * 2011-09-19 2013-04-17 北京金和软件股份有限公司 一种基于双连接池的数据库连接方法
CN103365929B (zh) * 2012-04-10 2016-09-28 阿里巴巴集团控股有限公司 一种数据库连接的管理方法及系统
CN103810203B (zh) * 2012-11-13 2018-02-27 深圳市腾讯计算机系统有限公司 一种数据库管理系统连接复用方法及装置
CN103064964B (zh) * 2012-12-29 2016-04-20 天津南大通用数据技术股份有限公司 一种支持分布式事务的数据库的连接方法
CN103067293B (zh) * 2012-12-31 2017-03-22 北京京东世纪贸易有限公司 负载均衡设备的连接管理和复用的方法和系统
CN103646084A (zh) * 2013-12-16 2014-03-19 浪潮电子信息产业股份有限公司 一种基于c程序连接mysql数据库的管理方法
CN105512188A (zh) * 2015-11-25 2016-04-20 用友网络科技股份有限公司 数据连接方法和数据连接系统
CN105426544B (zh) * 2015-12-25 2020-06-30 北京奇虎科技有限公司 监控数据库状态的方法及装置
CN107291747A (zh) * 2016-03-31 2017-10-24 北京优朋普乐科技有限公司 一种数据库连接池的管理方法、装置及系统
CN106446183B (zh) * 2016-09-28 2019-05-31 中国农业银行股份有限公司 数据库连接方法及装置
CN106550027B (zh) * 2016-10-25 2020-02-21 深圳中兴网信科技有限公司 设备连接方法和设备连接系统

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1999030514A2 (en) * 1997-12-12 1999-06-17 Alcatel Usa Sourcing, L.P. Network management
CN1238618A (zh) * 1998-04-06 1999-12-15 三星电子株式会社 网管系统配置网络结构时自动发现和定位网络单元的方法

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3166943B2 (ja) * 1992-12-31 2001-05-14 ソニー株式会社 データベースアクセス処理方法
US6138143A (en) * 1999-01-28 2000-10-24 Genrad, Inc. Method and apparatus for asynchronous transaction processing
US6704779B1 (en) * 1999-11-24 2004-03-09 Unisys Corporation Method and apparatus for a web application server to provide an administration system using a dual set of tiered groups of objects

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1999030514A2 (en) * 1997-12-12 1999-06-17 Alcatel Usa Sourcing, L.P. Network management
CN1238618A (zh) * 1998-04-06 1999-12-15 三星电子株式会社 网管系统配置网络结构时自动发现和定位网络单元的方法

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11995481B2 (en) 2022-08-22 2024-05-28 Sap Se Efficient connection pooling

Also Published As

Publication number Publication date
CN1317653C (zh) 2007-05-23
AU2003289602A1 (en) 2004-07-22
BR0317733A (pt) 2005-11-22
CN1510575A (zh) 2004-07-07

Similar Documents

Publication Publication Date Title
WO2004059906A1 (fr) Procede d&#39;administration de connexions a une base de donnees
US8327375B2 (en) System and method for supporting resource enlistment synchronization
US7650400B2 (en) Dynamic configuration and self-tuning on inter-nodal communication resources in a database management system
US6832238B1 (en) Local transaction management
CN104793988B (zh) 跨数据库分布式事务的实现方法和装置
Parrington et al. The design and implementation of Arjuna
US6560609B1 (en) Delegating instance management functions to underlying resource managers
US6925644B2 (en) Method, apparatus, and product for leasing of group membership in a distributed system
US7743083B2 (en) Common transaction manager interface for local and global transactions
US7353495B2 (en) Method for protection against interleaving transactions using a transaction manager
JPH1049380A (ja) スペース効率の良いオブジェクト・ロッキング・システム及び方法
US20060167999A1 (en) Ensuring a given transactional unit of work arrives at an appropriate server instance
US20090300017A1 (en) Transaction Parallel Control Method, and Database Managemet System
JP2001527244A (ja) オブジェクト・リレーショナル・マッピングにおけるクエリー実行をクライアントとサーバーとで効率的に分割する方法及び装置
JPH1063568A (ja) マルチスレッド環境におけるメモリの割り当て方法及びシステム
CN109255701B (zh) 一种网贷业务数据处理方法
CN103546440B (zh) 一种客户端发起事务的事务实现方法和系统
JP2001527242A (ja) ロックグループを用いた楽観的並行処理制御のためのきめ細やかな整合性をもたらす仕組み
KR20060108204A (ko) 네트워크를 통한 트랜잭션식 파일 동작을 위한 방법 및시스템
CN105635298B (zh) 一种基于业务隔离原理的数据采集设备统一接入系统
JP2002505471A (ja) 遠隔処理の中断および継続の方法と装置
CN102063338A (zh) 一种请求独占资源的方法及装置
US20090100082A1 (en) Replication and mapping mechanism for recreating memory durations
US9582313B2 (en) Connection resource system
JP2001056767A (ja) トランザクションサービス同期インターフェースを使用して、内部状態のクリーンアップを実施するための方法

Legal Events

Date Code Title Description
AK Designated states

Kind code of ref document: A1

Designated state(s): AE AG AL AM AT AU AZ BA BB BG BR BW BY BZ CA CH CN CO CR CU CZ DE DK DM DZ EC EE EG ES FI GB GD GE GH GM HR HU ID IL IN IS JP KE KG KP KR KZ LC LK LR LS LT LU LV MA MD MG MK MN MW MX MZ NI NO NZ OM PG PH PL PT RO RU SC SD SE SG SK SL SY TJ TM TN TR TT TZ UA UG US UZ VC VN YU ZA ZM ZW

AL Designated countries for regional patents

Kind code of ref document: A1

Designated state(s): BW GH GM KE LS MW MZ SD SL SZ TZ UG ZM ZW AM AZ BY KG KZ MD RU TJ TM AT BE BG CH CY CZ DE DK EE ES FI FR GB GR HU IE IT LU MC NL PT RO SE SI SK TR BF BJ CF CG CI CM GA GN GQ GW ML MR NE SN TD TG

121 Ep: the epo has been informed by wipo that ep was designated in this application
WWE Wipo information: entry into national phase

Ref document number: 3249/DELNP/2005

Country of ref document: IN

ENP Entry into the national phase

Ref document number: PI0317733

Country of ref document: BR

122 Ep: pct application non-entry in european phase
NENP Non-entry into the national phase

Ref country code: JP

WWW Wipo information: withdrawn in national office

Ref document number: JP