Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 12th, 2004, 11:58 PM
Sanket_devshed Sanket_devshed is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 7 Sanket_devshed User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Query :- find Count of Active Connections

Hello all,

I am using Firebird 1.5.

1) I want to query my database to find out the current
number of Active Connections (That how many users are
connected to the database currently).

2) One more doubt :-

If i am connected to Firebird Database through JDBC ... and that program terminates abnormally after successfully obtaining the Connection.

What will happen to the Active Connection Count ... will it be decremented ?

Thanks in Advance
Sanket

Reply With Quote
  #2  
Old October 13th, 2004, 05:45 PM
mariuz's Avatar
mariuz mariuz is offline
Bug Hunter
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: Transylvania (Romania)
Posts: 274 mariuz User rank is Corporal (100 - 500 Reputation Level)mariuz User rank is Corporal (100 - 500 Reputation Level)mariuz User rank is Corporal (100 - 500 Reputation Level)mariuz User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 20 h 12 m 34 sec
Reputation Power: 9
Talking

Quote:
Originally Posted by Sanket_devshed
Hello all,

I am using Firebird 1.5.

1) I want to query my database to find out the current
number of Active Connections (That how many users are
connected to the database currently).

What language do you use ?
for example in c++ you can call the api function isc_database_info
and here is how is implemented in ibpp
Quote:
void DatabaseImpl::Users(std::vector<std::string>& users)
{
if (mHandle == 0)
throw ExceptionImpl("Database::Users", "Database is not connected.");

char items[] = {isc_info_user_names,
isc_info_end};
IBS status;
RB result(8000);

status.Reset();
(*gds.Call()->m_database_info)(status.Self(), &mHandle, sizeof(items), items,
result.Size(), result.Self());
if (status.Errors())
{
status.Reset();
throw ExceptionImpl(&status, "Database::Users", "isc_database_info failed");
}

users.clear();
char* p = result.Self();
while (*p == isc_info_user_names)
{
p += 3; // Get to the length byte (there are two undocumented bytes which we skip)
int len = (int)(*p);
++p; // Get to the first char of username
if (len != 0) users.push_back(std::string().append(p, len));
p += len; // Skip username
}
return;
}

Quote:
2) One more doubt :-

If i am connected to Firebird Database through JDBC ... and that program terminates abnormally after successfully obtaining the Connection.

What will happen to the Active Connection Count ... will it be decremented ?

Sanket

it should be decremented
ps : ok now i see that you use jdbc i guess is java what is used ?
__________________
My home page: http://www.firebirdsql.org and work place :http://www.reea.net

Last edited by mariuz : October 13th, 2004 at 05:48 PM.

Reply With Quote
  #3  
Old October 14th, 2004, 03:45 AM
Sanket_devshed Sanket_devshed is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 7 Sanket_devshed User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[QUOTE=mariuz]What language do you use ?
for example in c++ you can call the api function isc_database_info
and here is how is implemented in ibpp

Thanks for the C++ Code .... but I need the SQL Query which will return me the Current Active Connection and User Status.

Reply With Quote
  #4  
Old October 14th, 2004, 04:46 AM
fikret fikret is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: Sarajevo, Bosnia
Posts: 111 fikret User rank is Corporal (100 - 500 Reputation Level)fikret User rank is Corporal (100 - 500 Reputation Level)fikret User rank is Corporal (100 - 500 Reputation Level)fikret User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 5 h 32 m 19 sec
Reputation Power: 8
Quote:
Originally Posted by Sanket_devshed
but I need the SQL Query which will return me the Current Active Connection and User Status.

It's not possible (yet)...


--
Best regards,
Fikret Hasovic http://fikret.fbtalk.net
TAMP R&D Team
FirebirdSQL Foundation member.
- Join today at http://www.firebirdsql.org/ff/foundation
JEDI VCS contributor
http://jedivcs.sourceforge.net/

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Query :- find Count of Active Connections


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT