Hi Thomas,

thanks for your answer! I created a linked table in my example DB on this 
management db's SESSIONS-table.

create linked table public.sessions 
('','jdbc:h2:mem:management_db_9092','','','PUBLIC.SESSIONS');

an I also connected multiple times to my local tcp server.
select * from public.sessions;
ID    URL    USER    CONNECTED
2    jdbc:h2:tcp://localhost/hu    SA    2013-02-14 21:03:49
3    jdbc:h2:tcp://localhost/hu    SA    2013-02-14 21:03:51
4    jdbc:h2:tcp://joebook/hu    SA    2013-02-14 21:06:54

Now, what I meant to see was also the IP-address of the server's client 
connection object.
And maybe some more columns, that ought to be communicated from client to 
server, like:
- Client OS
- Client OS User
- Client OS application name
- Client OS Process ID


Am Donnerstag, 14. Februar 2013 19:55:57 UTC+1 schrieb Thomas Mueller:
>
> Hi,
>
> There is an in-memory "management_db_<port>" for each TCP server. A TCP 
> server can server multiple databases. To connect to it, you need to know 
> the "managementPassword", which is the password you need to set using the 
> -tcpPassword setting. The user name is an empty string. See also 
> TcpServer.initManagementDb and TcpServer.shutdown. You can get the 
> sessions, database URLs, user names, and time of connection.
>
> Regards,
> Thomas
>
>
>
> On Thu, Feb 14, 2013 at 4:32 PM, Josef Hopfgartner 
> <[email protected]<javascript:>
> > wrote:
>
>> I would need this feature for logging.
>> It would be interesting to see as many or even more information as in 
>> V$SESSION in Oracle.
>>
>> Actually, I've created a Libreoffice Base document which is configured to 
>> use H2 tcp server with parameter "INIT=Call do_sync()"
>> This H2 has configured linked tables to query different databases.
>> Those queries are quite costly and I don't need the results to be up to 
>> date.
>>
>> So, the H2 alias "do_sync()" logs and checks, how up to date the query 
>> results are.
>> If necessery, it does some queries again.
>>
>> Best regards, 
>> Josef
>>
>> PS: Here is the alias definition:
>> void query(Connection conn) throws SQLException {
>>     java.lang.String sql = "";
>>     sql = "select count(*) from PUBLIC.LOGGER where ZEIT > 
>> CURRENT_TIMESTAMP - 0.5 and SYNCED = true";
>>       java.sql.ResultSet tmpRes = 
>> conn.createStatement().executeQuery(sql);
>>       while (tmpRes.next()) {
>>         Long i = tmpRes.getLong(1);
>>         String s = "false";
>>         if (i == 0) {
>>           sql = "create temporary table t1 as select knd_nr, knd_kurz 
>> from konz9999.knd_so"; conn.createStatement().execute(sql);
>>         sql = "merge into t1 key (knd_nr) select knd_nr, knd_kurz from 
>> mdg.kunden where length(knd_kurz) > 1"; conn.createStatement().execute(sql);
>>         sql = "merge into kontrakte.knd_so key (knd_nr) select knd_nr, 
>> knd_kurz from t1"; conn.createStatement().execute(sql);
>>         //sql = "delete from kontrakte.knd_so where knd_nr not in (select 
>> knd_nr from t1)";  conn.createStatement().execute(sql);
>>
>>         sql = "create temporary table t2 as select * from konz9999.art"; 
>> conn.createStatement().execute(sql);
>>         sql = "merge into kontrakte.art key (art_nr) SELECT * from t2"; 
>> conn.createStatement().execute(sql);
>>         //sql = "delete from kontrakte.art where art_nr not in (SELECT 
>> art_nr from t2)"; conn.createStatement().execute(sql);
>>     
>>         sql = "create temporary table t3 as select * from 
>> konz9999.mit_so"; conn.createStatement().execute(sql);
>>         sql = "merge into kontrakte.mit_so key (mit_nr) SELECT * from 
>> t3"; conn.createStatement().execute(sql);
>>         //sql = "delete from kontrakte.mit_so where mit_nr not in (SELECT 
>> mit_nr from t3)"; conn.createStatement().execute(sql);
>>
>>         sql = "create temporary table t4 as SELECT ANR, MATCH, ANRBEZ1, 
>> ANRBEZ2, cast(NETTO as decimal(65535,255)) as NETTO from m2.tklager"; 
>> conn.createStatement().execute(sql);
>>         sql = "merge into kontrakte.tklager key (anr) SELECT * from t4"; 
>> conn.createStatement().execute(sql);
>>         sql = "delete from kontrakte.tklager where anr not in (SELECT anr 
>> from t4)"; conn.createStatement().execute(sql);
>>
>>         sql = "drop table if exists t1,t2,t3,t4"; 
>> conn.createStatement().execute(sql);
>>             s = "true";
>>           }
>>         sql = "INSERT INTO PUBLIC.LOGGER VALUES (current_timestamp, 
>> session_id(), " + s + " )"; conn.createStatement().execute(sql);
>>         break;
>>       }
>> }
>>
>>
>>
>>
>> Am Dienstag, 12. Februar 2013 15:46:20 UTC+1 schrieb Noel Grandin:
>>>
>>> Not possible at the moment, I'm afraid. 
>>>
>>> Doesn't sound that hard to add. 
>>> Start with org.h2.server.TcpServerThread, propogate the information down 
>>> to org.h2.engine.Session, and then expose it from there to 
>>> org.h2.table.MetaTable. 
>>>
>>> What do you need it for? 
>>>
>>> On 2013-02-12 15:56, Josef Hopfgartner wrote: 
>>> > Hello, 
>>> > 
>>> > does anybody know if it is already possible to display the active 
>>> > session's client IP-address in an H2 TCP server? 
>>> > 
>>> > Regards, 
>>> > Josef 
>>> > -- 
>>> > You received this message because you are subscribed to the Google 
>>> > Groups "H2 Database" group. 
>>> > To unsubscribe from this group and stop receiving emails from it, send 
>>> > an email to h2-database...@**googlegroups.com. 
>>> > To post to this group, send email to [email protected]. 
>>> > Visit this group at 
>>> > http://groups.google.com/**group/h2-database?hl=en<http://groups.google.com/group/h2-database?hl=en>.
>>> >  
>>>
>>> > For more options, visit 
>>> > https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>.
>>> >  
>>>
>>> > 
>>> > 
>>>
>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "H2 Database" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/h2-database?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to