如何计算sqlite数据库中打开的连接数? [英] How can I count the number of open connections in an sqlite database?

查看:451
本文介绍了如何计算sqlite数据库中打开的连接数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想计算sqlite数据库中打开的连接数。有办法吗?

I would like to count the number of open connections in an sqlite database. Is there a way to do that?

推荐答案

根据这些 posts 在邮件列表上没有办法通过代码或数据库本身检查打开的连接数。没有API。

According to these posts on the mailing list there is no way to check the number of open connections through code or the database itself. There is no API.

根据此帖,如果您在POSIX类型系统上运行,您可以使用 lsof 命令来计算已打开数据库的进程数。

According to this post, if you are running on a POSIX type system you can use the lsof command to count how many processes have opened the database.

如果您使用的是Windows,则可以使用 Process Explorer < a>通过以下步骤计算连接数:

If you are on Windows you can use Process Explorer to count the number of connections with the following steps:


  1. 在Process Explorer中,单击查找 - >查找句柄或DLL。 ..

  2. 键入您的sqlite数据库的名称,然后点击搜索(或按Enter键)。

  3. 您的数据库。

  4. 返回主窗口,右键点击您的数据库文件,然后点击属性

  5. 您现在可以看到引用和句柄的数量

  1. In Process Explorer click on 'Find' -> Find Handle or DLL...
  2. Type in the name of your sqlite database and click on 'Search' (or hit Enter)
  3. In the results window, click on your database. It will become highlighted as a 'file' in the main Process Explorer window.
  4. Back in the main window, right-click on your database file and click Properties
  5. You can now see the number of References and Handles

这篇关于如何计算sqlite数据库中打开的连接数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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