How to check the number of connections to MySQL DB

Hi,

Is there some way to check the number of applications connected to a mysql database?

I have two different Java applications that will be using the same instance of MySQL.

My requirement is that, I want to close the MySQL instance while closing the Java application.

But before doing so, I want to make sure the other application is not connected to it.

Is there some way I can achieve this?

Your suggestions will be of great help.

Thanks,

Sandeep

[505 byte] By [Sandeep009a] at [2007-11-27 11:53:13]
# 1

It sounds like you are doing something very convoluted and possibly wrongly.

But to answer your question directly I believe the query you are looking for is

SHOW PROCESSLIST

Consult the MySQL docs for what is returned by this query. But I believe you will have one row for each connection.

cotton.ma at 2007-7-29 18:49:02 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...