Inconsistent results from INFORMATION_SCHEMA.system_sessions

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Inconsistent results from INFORMATION_SCHEMA.system_sessions

Jeff Cadman
Hi,

I have a java program running:

String sql = "select count(*) from INFORMATION_SCHEMA.system_sessions";
ResultSet rs = st.executeQuery(sql); 
while(rs.next())
{
  String n = rs.getString(1);
  System.out.println("connections: " + n);
   TimeUnit.SECONDS.sleep(3);
         }

No matter how many instances of this program are running, it always prints out:

connections: 1

Curiously, the execution of:

select * from INFORMATION_SCHEMA.system_sessions;

in the manager GUI (DatabaseManagerSwing) displays the correct result.

Either a) What am I missing, or 
            b) How do I programmatically detect the number of sessions connected to the DB?

tnx...

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Inconsistent results from INFORMATION_SCHEMA.system_sessions

Fred Toussi-2
What happens when you execute the same query in DatabaseManager?
 
Are you running a Server and connecting to it from several instances of YOUR program?
 
Fred
 
On Mon, Jan 27, 2014, at 16:10, Jeff Cadman wrote:
Hi,
 
I have a java program running:
 
String sql = "select count(*) from INFORMATION_SCHEMA.system_sessions";
ResultSet rs = st.executeQuery(sql); 
while(rs.next())
{
  String n = rs.getString(1);
  System.out.println("connections: " + n);
   TimeUnit.SECONDS.sleep(3);
         }
 
No matter how many instances of this program are running, it always prints out:
 
connections: 1
 
Curiously, the execution of:
 
select * from INFORMATION_SCHEMA.system_sessions;
 
in the manager GUI (DatabaseManagerSwing) displays the correct result.
 
Either a) What am I missing, or 
            b) How do I programmatically detect the number of sessions connected to the DB?
 
tnx...
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
_______________________________________________
Hsqldb-user mailing list
 

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Inconsistent results from INFORMATION_SCHEMA.system_sessions

Jeff Cadman
Hi,

Executing the same query in the databasemanager (using DatabaseManagerSwing)
displays the correct result - running 4 simultaneous instances of the program
returns 4, as expected.

The issue is that each java program returns 'connections: 1' irrespective
of how many java programs are running.

I am running a server on port 9001 and connecting to it using jdbc on the same box.

Jeff

From: [hidden email]
To: [hidden email]
Date: Mon, 27 Jan 2014 18:07:59 +0000
Subject: Re: [Hsqldb-user] Inconsistent results from INFORMATION_SCHEMA.system_sessions

What happens when you execute the same query in DatabaseManager?
 
Are you running a Server and connecting to it from several instances of YOUR program?
 
Fred
 
On Mon, Jan 27, 2014, at 16:10, Jeff Cadman wrote:
Hi,
 
I have a java program running:
 
String sql = "select count(*) from INFORMATION_SCHEMA.system_sessions";
ResultSet rs = st.executeQuery(sql); 
while(rs.next())
{
  String n = rs.getString(1);
  System.out.println("connections: " + n);
   TimeUnit.SECONDS.sleep(3);
         }
 
No matter how many instances of this program are running, it always prints out:
 
connections: 1
 
Curiously, the execution of:
 
select * from INFORMATION_SCHEMA.system_sessions;
 
in the manager GUI (DatabaseManagerSwing) displays the correct result.
 
Either a) What am I missing, or 
            b) How do I programmatically detect the number of sessions connected to the DB?
 
tnx...
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
_______________________________________________
Hsqldb-user mailing list
 

------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________ Hsqldb-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/hsqldb-user

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Inconsistent results from INFORMATION_SCHEMA.system_sessions

Fred Toussi-2
Your program must be connecting with a user that has no admin privileges. Therefore the session sees only itself, not any other sessions.
 
Fred
 
On Mon, Jan 27, 2014, at 18:36, Jeff Cadman wrote:
Hi,
 
Executing the same query in the databasemanager (using DatabaseManagerSwing)
displays the correct result - running 4 simultaneous instances of the program
returns 4, as expected.
 
The issue is that each java program returns 'connections: 1' irrespective
of how many java programs are running.
 
I am running a server on port 9001 and connecting to it using jdbc on the same box.
 
Jeff

From: [hidden email]
To: [hidden email]
Date: Mon, 27 Jan 2014 18:07:59 +0000
Subject: Re: [Hsqldb-user] Inconsistent results from INFORMATION_SCHEMA.system_sessions

What happens when you execute the same query in DatabaseManager?
 
Are you running a Server and connecting to it from several instances of YOUR program?
 
Fred
 
On Mon, Jan 27, 2014, at 16:10, Jeff Cadman wrote:
Hi,
 
I have a java program running:
 
String sql = "select count(*) from INFORMATION_SCHEMA.system_sessions";
ResultSet rs = st.executeQuery(sql); 
while(rs.next())
{
  String n = rs.getString(1);
  System.out.println("connections: " + n);
   TimeUnit.SECONDS.sleep(3);
         }
 
No matter how many instances of this program are running, it always prints out:
 
connections: 1
 
Curiously, the execution of:
 
select * from INFORMATION_SCHEMA.system_sessions;
 
in the manager GUI (DatabaseManagerSwing) displays the correct result.
 
Either a) What am I missing, or 
            b) How do I programmatically detect the number of sessions connected to the DB?
 
tnx...
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
_______________________________________________
Hsqldb-user mailing list
 

------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________ Hsqldb-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/hsqldb-user
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
_______________________________________________
Hsqldb-user mailing list
 

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Inconsistent results from INFORMATION_SCHEMA.system_sessions

Jeff Cadman
Absolutely correct - works fine as admin.

Nicely done, tnx...

Jeff


From: [hidden email]
To: [hidden email]
Date: Mon, 27 Jan 2014 19:36:26 +0000
Subject: Re: [Hsqldb-user] Inconsistent results from INFORMATION_SCHEMA.system_sessions

Your program must be connecting with a user that has no admin privileges. Therefore the session sees only itself, not any other sessions.
 
Fred
 
On Mon, Jan 27, 2014, at 18:36, Jeff Cadman wrote:
Hi,
 
Executing the same query in the databasemanager (using DatabaseManagerSwing)
displays the correct result - running 4 simultaneous instances of the program
returns 4, as expected.
 
The issue is that each java program returns 'connections: 1' irrespective
of how many java programs are running.
 
I am running a server on port 9001 and connecting to it using jdbc on the same box.
 
Jeff

From: [hidden email]
To: [hidden email]
Date: Mon, 27 Jan 2014 18:07:59 +0000
Subject: Re: [Hsqldb-user] Inconsistent results from INFORMATION_SCHEMA.system_sessions

What happens when you execute the same query in DatabaseManager?
 
Are you running a Server and connecting to it from several instances of YOUR program?
 
Fred
 
On Mon, Jan 27, 2014, at 16:10, Jeff Cadman wrote:
Hi,
 
I have a java program running:
 
String sql = "select count(*) from INFORMATION_SCHEMA.system_sessions";
ResultSet rs = st.executeQuery(sql); 
while(rs.next())
{
  String n = rs.getString(1);
  System.out.println("connections: " + n);
   TimeUnit.SECONDS.sleep(3);
         }
 
No matter how many instances of this program are running, it always prints out:
 
connections: 1
 
Curiously, the execution of:
 
select * from INFORMATION_SCHEMA.system_sessions;
 
in the manager GUI (DatabaseManagerSwing) displays the correct result.
 
Either a) What am I missing, or 
            b) How do I programmatically detect the number of sessions connected to the DB?
 
tnx...
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
_______________________________________________
Hsqldb-user mailing list
 

------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________ Hsqldb-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/hsqldb-user
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
_______________________________________________
Hsqldb-user mailing list
 

------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________ Hsqldb-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/hsqldb-user

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user
Loading...