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 [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