跨进程的数据库连接池 [英] db connection pool across processes

查看:297
本文介绍了跨进程的数据库连接池的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个包含多个EXE的客户端/服务器应用程序.数据访问层与EXE模块共享的库中的客户端位于同一物理层上. ODBC和OleDB连接池是按进程管理的;是否有跨进程共享数据库连接的技术(除了将数据访问层移动到中间层以外)?

We have a client/server application that consists of multiple EXEs. The data access layer is on the same physical tier as the client in a library shared by our EXE modules. ODBC and OleDB connection pools are managed per-process; are there techniques for sharing DB connections across processes (other than moving the data access layer to a middle tier)?

推荐答案

OLEDB和ODBC中的数据库连接本质上是进程绑定的.在最低级别上,SQL Server数据库连接使用的是IPC机制,例如命名管道,共享内存或tcp套接字.其他数据库可能仅使用网络连接.如果考虑一下,要共享一个连接池并因此共享连接,则需要将这些低级对象(套接字,命名管道,共享内存部分)复制到另一个进程,然后允许它们管理它们.即使您可以移开它们,也无法同时使用它们.

Database connections in OLEDB and ODBC are intrinsically process bound. At the lowest levels, a sql server database connection is using an IPC mechanism like named pipes, shared memory, or tcp sockets. Other databases probably use network connections exclusively. If you think about it, to share a connection pool and hence connections you would need to copy these low level objects (sockets, named pipe, shared memory section) to another process and then allow them to manage them. Even if you could hand them off you wouldn't be able to use them concurrently.

要执行您想做的事情,实际上必须将数据访问层移动到所有多个exe文件都想使用的共享空间中.通常这是一个中间层,然后每个exe都将通过某些IPC机制(.net远程处理,com服务器,RPC,网络等)与该中间层进行通信.

To do what you want to do you really have to move the data access layer into a shared space that all of your multiple exes want to use. This is usually a middle tier and each exe would then communicate with that via some IPC mechanism (.net remoting, com server, RPC, networking, etc).

这篇关于跨进程的数据库连接池的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆