SQL Server query to show active servers connections; including the connected database name, number of connections, and login name.

select DB_NAME(dbid) as DBName,
    COUNT(dbid) as NumberOfConnections,
    loginame as LoginName
from sys.sysprocesses
where dbid > 0
group by dbid,
    loginame;