Re: [h2] Problems with DATEADD, DATEDIFF and daylight savings time

2016-03-31 Thread Noel Grandin
Could you figure out which part of the computation is returning bad data?
The DATEDIFF or the DATEADD? Should be possible by testing near the DST
switchover datetime.

Which version of H2 are you using? And are you running an up-to-date Java,
so it's DST database is current?
​

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Wrong parsing for 'SELECT SOME_SEQ.NEXTVAL as uuid FROM DUAL' query

2016-03-31 Thread Noel Grandin
yeah, that looks like a bug in our oracle mode. patches welcome.

for now, you can probably work around it with
   SELECT NEXTVAL('SOME_SEQ') AS UUID FROM DUAL

On 31 March 2016 at 17:15,  wrote:

> Hello!
>
> I have a strange exception when I try to create a prepared statement for
> 'SELECT SOME_SEQ.NEXTVAL as uuid FROM DUAL'.
> The query is executed successfully through WebServer. The connection
> is created with Oracle compatibility mode.
>
> H2 version: 1.4.191
>
> Exception:
> Caused by: org.h2.jdbc.JdbcSQLException: Column "SOME_SEQ.AS" not found;
> SQL statement:
>  SELECT SOME_SEQ.NEXTVAL as uuid FROM DUAL  [42122-191]
>  at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
>  at org.h2.message.DbException.get(DbException.java:179)
>  at org.h2.message.DbException.get(DbException.java:155)
>  at org.h2.expression.ExpressionColumn.optimize(ExpressionColumn.java:147)
>  at org.h2.expression.Alias.optimize(Alias.java:51)
>  at org.h2.command.dml.Select.prepare(Select.java:852)
>  at org.h2.command.Parser.prepareCommand(Parser.java:257)
>  at org.h2.engine.Session.prepareLocal(Session.java:560)
>  at org.h2.engine.Session.prepareCommand(Session.java:501)
>  at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1188)
>  at org.h2.jdbc.JdbcPreparedStatement.(JdbcPreparedStatement.java:73)
>  at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:276)
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to h2-database@googlegroups.com.
> Visit this group at https://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] H2 Database Auto Server mode : Accessing through web console remotely

2016-03-31 Thread Yadukrishnan K
Hi,
I have asked this question in stack overflow 
,
 
but since haven't received any response, I am asking here again. I am new 
to H2 database and having a little confusion to setup my first h2 related 
project. 

As a part of a PoC, I am using H2 database(version : 1.4.187) for mocking 
the MS SQL Server DB. I have one application, say app1 which generates the 
data and save into H2. Another application, app2, needs to read from the H2 
database and process the data it reads. I am trying to use Auto Server mode 
so that even if one of the application is down, other one is able to 
read/write to/from the database.

After reading multiple examples, i found how to build the h2 url and shown 
as below:


jdbc:h2:~/datafactory;MODE=MSSQLServer;AUTO_SERVER=TRUE;
>

With this, I am able to write to the database. Now, I want to read the data 
using the h2-web-console application. I am able to do that from my local 
machine. 

However, I am not able to understand how I can connect to this database 
remotely from another machine.

My plan is to run these two apps in an ubuntu machine and I can monitor the 
data using the web console from my machine. Is it not possible with this 
approach? How can I solve this ? 


Or do I need to use server mode and explicitly start the h2 server? Any 
help would be appreciated.


Thanks
Yadu

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Wrong parsing for 'SELECT SOME_SEQ.NEXTVAL as uuid FROM DUAL' query

2016-03-31 Thread hazehorizon
Hello!

I have a strange exception when I try to create a prepared statement for 
'SELECT SOME_SEQ.NEXTVAL as uuid FROM DUAL'.
The query is executed successfully through WebServer. The connection 
is created with Oracle compatibility mode.

H2 version: 1.4.191

Exception:
Caused by: org.h2.jdbc.JdbcSQLException: Column "SOME_SEQ.AS" not found; 
SQL statement:
 SELECT SOME_SEQ.NEXTVAL as uuid FROM DUAL  [42122-191]
 at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
 at org.h2.message.DbException.get(DbException.java:179)
 at org.h2.message.DbException.get(DbException.java:155)
 at org.h2.expression.ExpressionColumn.optimize(ExpressionColumn.java:147)
 at org.h2.expression.Alias.optimize(Alias.java:51)
 at org.h2.command.dml.Select.prepare(Select.java:852)
 at org.h2.command.Parser.prepareCommand(Parser.java:257)
 at org.h2.engine.Session.prepareLocal(Session.java:560)
 at org.h2.engine.Session.prepareCommand(Session.java:501)
 at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1188)
 at org.h2.jdbc.JdbcPreparedStatement.(JdbcPreparedStatement.java:73)
 at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:276)

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Problems with DATEADD, DATEDIFF and daylight savings time

2016-03-31 Thread 'Hedley Proctor' via H2 Database
I have a database query that truncates milliseconds off database timestamp 
values using the following logic:

DATEADD(second, DATEDIFF(second, '2000-01-01', zas.tstamp), '2000-01-01')

This has been failing since Britain switched to daylight savings time at 
the weekend. In the expression, the date '2000-01-01' is just an arbitrary 
value. The expression calculates the difference between that date and the 
database column of interest, but only to seconds precision, then creates a 
new date by adding this difference back to the same arbitrary value. This 
should have the affect of truncating the milliseconds. I chose this because 
it is recommended on stack overflow as a reasonably portable way of writing 
this logic.

However, on H2, running this now (in daylight savings time) has the affect 
of adding an hour to the time! i.e. if I run

DATEADD(second, DATEDIFF(second, '2000-01-01', '2016-03-31'), '2000-01-01')

you would expect to get back

2016-03-31 00:00:00

but in fact you get back

2016-03-31 01:00:00

By contrast, it runs as expected on SQL server.

This looks like a bug to me?

Hedley


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] When will stable version release?

2016-03-31 Thread Steve McLeod
Hi Thomas,

If keeping performance on par with the page store is an aim before removing 
the beta status, I'd say 1.4 is not ready.

I did some performance tests today with my product against 1.4 with the MV 
Store and 1.4 with the page store. The page store is still much faster for 
a large number of inserts and updates.

When building up a database that is 5 GB in size, inserts and updates seem 
to get progressively slower. 

Let me know if any specific performance analysis would be useful.

Regards,

Steve




On Wednesday, 30 March 2016 19:34:27 UTC+2, Thomas Mueller wrote:
>
> Hi,
>
> The MVStore I consider stable. What is relatively new is the table engine 
> that uses the MVStore, but even that one I would say is stable now. 
> Unfortunately I didn't have time lately to do a release, I'm sorry about 
> that.
>
> Regards,
> Thomas
>
> On Mon, Mar 28, 2016 at 9:20 AM, yone > 
> wrote:
>
>> Hi.
>>
>>
>> Now I'm measuring H2MV performance. And the result is very nice. 
>>
>> The benchmark of compaction ratio/read/write are better than LevelDB!!
>>
>> My product just use put/get/commit with synchronization.
>>
>> Is my simple operation stable or not?
>>
>>
>> If you decide the date when remove beta, please let us know.
>>
>> # There are already similar topic. I'm sorry if you feel bad
>>
>> Best regard,
>>
>> -- 
>> 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 h2-da...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/h2-database.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] When will stable version release?

2016-03-31 Thread yone
I'm glad to hear that!!
I can proceed my development of my product with newest H2.

Best Regards,

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: TransactionMap rollback() has a problem with Object[] as a value?

2016-03-31 Thread mikko

>
> Thank you, now it's perfectly clear.
>
 

> When the immutable rule is followed then everything works as expected, as 
> in the below successful test case:
>

@Test
public void testObjectVec3() {
//Create a new MVStore file
File file = new File(System.getProperty("java.io.tmpdir"), 
"testTransactionMapWithSet.dat");
if (file.exists()) {
file.delete();
}
MVStore s = new 
MVStore.Builder().fileName(file.getAbsolutePath()).open();

TransactionStore ts = new TransactionStore(s);
ts.init();
Transaction tx = ts.begin();
TransactionMap setMap = tx.openMap("testMap");
Object[] v = new Object[3];
v[0] = 1;
v[1] = "hi-1";
v[2] = 2;
setMap.put(0, v);
tx.commit();

tx = ts.begin();
TransactionMap setMap2 = tx.openMap("testMap");
Object[] vv = setMap2.get(0);
Object[] vvCopy = Arrays.copyOf(vv, vv.length);
vvCopy[2] = null;
setMap2.put(0, vvCopy);
tx.rollback();

tx = ts.begin();
TransactionMap setMap3 = tx.openMap("testMap");
Object[] vvv = setMap3.get(0);
System.out.println("vvv[0]="+vvv[0]+" vvv[1]="+vvv[1]+" vvv[2]="+vvv[2]);
tx.rollback();
//ASSERT OK!
assertNotNull(vvv[2]);

//Close all
ts.close();
s.close();
}
 

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.