Re: java.lang.ArrayIndexOutOfBoundsException

2013-02-26 Thread Noel Grandin

Need the entire exception please, this is just part of it.

On 2013-02-22 20:19, Cesar Rodriguez wrote:

Hi,

After de Recovery, still have the 
java.lang.ArrayIndexOutOfBoundsException error:


Query:

SELECT * FROM PACIENTE ORDER BY ID_PACIENTE DESC;

Response:

General error: java.lang.ArrayIndexOutOfBoundsException; SQL statement:
SELECT * FROM PACIENTE ORDER BY ID_PACIENTE DESC [5-170] 
http://192.168.1.18:8082/query.do?jsessionid=c09af2ad9bcc2c72a7a853b55d9be8e8# HY000/5 
(Help) 
http://h2database.com/javadoc/org/h2/constant/ErrorCode.html#c5
org.h2.jdbc.JdbcSQLException: General error: 
java.lang.ArrayIndexOutOfBoundsException; SQL statement:

SELECT * FROM PACIENTE ORDER BY ID_PACIENTE DESC [5-170]
at 
org.h2.message.DbException.getJdbcSQLException(DbException.java:329 
http://h2database.com/html/source.html?file=org/h2/message/DbException.javaline=329build=170)
at org.h2.message.DbException.get(DbException.java:158 
http://h2database.com/html/source.html?file=org/h2/message/DbException.javaline=158build=170)
at org.h2.message.DbException.convert(DbException.java:281 
http://h2database.com/html/source.html?file=org/h2/message/DbException.javaline=281build=170)
at org.h2.command.Command.executeQuery(Command.java:195 
http://h2database.com/html/source.html?file=org/h2/command/Command.javaline=195build=170)
at 
org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:173 
http://h2database.com/html/source.html?file=org/h2/jdbc/JdbcStatement.javaline=173build=170)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:152 
http://h2database.com/html/source.html?file=org/h2/jdbc/JdbcStatement.javaline=152build=170)
at org.h2.server.web.WebApp.getResult(WebApp.java:1311 
http://h2database.com/html/source.html?file=org/h2/server/web/WebApp.javaline=1311build=170)
at org.h2.server.web.WebApp.query(WebApp.java:1001 
http://h2database.com/html/source.html?file=org/h2/server/web/WebApp.javaline=1001build=170)
at org.h2.server.web.WebApp$1.next(WebApp.java:964 
http://h2database.com/html/source.html?file=org/h2/server/web/WebApp.javaline=964build=170)
at org.h2.server.web.WebApp$1.next(WebApp.java:953 
http://h2database.com/html/source.html?file=org/h2/server/web/WebApp.javaline=953build=170)
at org.h2.server.web.WebThread.process(WebThread.java:166 
http://h2database.com/html/source.html?file=org/h2/server/web/WebThread.javaline=166build=170)
at org.h2.server.web.WebThread.run(WebThread.java:93 
http://h2database.com/html/source.html?file=org/h2/server/web/WebThread.javaline=93build=170)

at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.ArrayIndexOutOfBoundsException
--
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 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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Physical disconnection caused h2 to grow as big as possible

2013-02-26 Thread Noel Grandin
I'm sorry, but your H2 database was corrupted beyond the abilities of 
the Recover tool to deal with.


On 2013-02-22 23:45, PetitPo wrote:

I´ve been using h2 as db with OOBase as GUI for some years.
With some SQL-knowledge I can handle what I need mostly. I´m not an 
experienced programmer and I know no java.


Recently I have been testing a new database with URL: 
jdbc:h2:\F:\KULT\KULT;AUTO_SERVER=TRUE

for some days. I have the files on a USB-stick.
The db have 4 main tables and 4 forms and had around 200 rows in the 
biggest table when the problem started.


While working today I touched the USBstick unvoluntarily with the 
effect that the data I was
registrering could not be saved because of I/O-problems and I couldn´t 
close either h2 or Base
untilWindows interfered and wanted to to fix the files. I did not 
allow that since I have bad
experience of thoose actions before and afterwordsI could close the 
both softwares.


When trying to open h2 again it was impossible because the disk 
(=USBstiock) was too small.
The h2.db that earlier was smallewr than 3 MB now had grown to 3,3 GB 
which was as much as it could grow.
It had filled the USB-stick so it was impossible to open. I Copied the 
file and pasted it to C: and immediately it
filled ehat was empty of C: and had grown to 411 GB and it was still 
impossible to open.


When trying to recover the file the Recovering tool can`t find the file.

I have tried to find information in h2database.com.
I need an understanding of what have happened and if it is possible to 
rescue the data and where to find

information on how to do that. Error message below.

PetitPo

The Error message h2 produces when trying to connect is as follows:
The Swedish in the first rows says that there is not enough space on disk.

IO Exception: java.io.IOException: Det finns inte tillräckligt med 
utrymme på disken; F:\KULT\KULT.h2.db [90031-159] 
http://192.168.1.3:8082/login.do?jsessionid=704486c5d91f09e2b5cfa2e7220ff6e1# 
90031/90031 (Help) 
http://h2database.com/javadoc/org/h2/constant/ErrorCode.html#c90031
org.h2.jdbc.JdbcSQLException: IO Exception: java.io.IOException: Det 
finns inte tillräckligt med utrymme på disken; F:\KULT\KULT.h2.db 
[90031-159]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329 
http://h2database.com/html/source.html?file=org/h2/message/DbException.javaline=329build=159) 

at org.h2.message.DbException.get(DbException.java:158 
http://h2database.com/html/source.html?file=org/h2/message/DbException.javaline=158build=159) 

at org.h2.message.DbException.convertIOException(DbException.java:315 
http://h2database.com/html/source.html?file=org/h2/message/DbException.javaline=315build=159) 

at org.h2.store.FileStore.setLength(FileStore.java:401 
http://h2database.com/html/source.html?file=org/h2/store/FileStore.javaline=401build=159) 

at org.h2.store.PageStore.increaseFileSize(PageStore.java:1156 
http://h2database.com/html/source.html?file=org/h2/store/PageStore.javaline=1156build=159) 

at org.h2.store.PageStore.increaseFileSize(PageStore.java:1147 
http://h2database.com/html/source.html?file=org/h2/store/PageStore.javaline=1147build=159) 

at org.h2.store.PageStore.getFreeList(PageStore.java:1051 
http://h2database.com/html/source.html?file=org/h2/store/PageStore.javaline=1051build=159) 

at org.h2.store.PageStore.getFreeListForPage(PageStore.java:1038 
http://h2database.com/html/source.html?file=org/h2/store/PageStore.javaline=1038build=159) 

at org.h2.store.PageStore.allocatePage(PageStore.java:1078 
http://h2database.com/html/source.html?file=org/h2/store/PageStore.javaline=1078build=159) 

at 
org.h2.store.PageInputStream.allocateAllPages(PageInputStream.java:153 
http://h2database.com/html/source.html?file=org/h2/store/PageInputStream.javaline=153build=159) 

at org.h2.store.PageLog.recover(PageLog.java:259 
http://h2database.com/html/source.html?file=org/h2/store/PageLog.javaline=259build=159) 

at org.h2.store.PageStore.recover(PageStore.java:1327 
http://h2database.com/html/source.html?file=org/h2/store/PageStore.javaline=1327build=159) 

at org.h2.store.PageStore.openExisting(PageStore.java:349 
http://h2database.com/html/source.html?file=org/h2/store/PageStore.javaline=349build=159) 

at org.h2.store.PageStore.open(PageStore.java:273 
http://h2database.com/html/source.html?file=org/h2/store/PageStore.javaline=273build=159) 

at org.h2.engine.Database.getPageStore(Database.java:2049 
http://h2database.com/html/source.html?file=org/h2/engine/Database.javaline=2049build=159) 

at org.h2.engine.Database.open(Database.java:553 
http://h2database.com/html/source.html?file=org/h2/engine/Database.javaline=553build=159) 

at org.h2.engine.Database.openDatabase(Database.java:220 
http://h2database.com/html/source.html?file=org/h2/engine/Database.javaline=220build=159) 

at org.h2.engine.Database.init(Database.java:215 
http://h2database.com/html/source.html?file=org/h2/engine/Database.javaline=215build=159) 

at 

Re: h2 with Eclipselink and sequences

2013-02-26 Thread Noel Grandin


On 2013-02-22 15:55, Dries wrote:
I'm able to make that statement work on the correct tables and fields 
in h2, but h2 doesn't allow changes to meta tables, so that doesn't 
solve the problem either.

login.getPlatform().setSequenceCounterFieldName(CURRENT_VALUE);
login.getPlatform().setSequenceNameFieldName(SEQUENCE_NAME);
login.getPlatform().setSequenceTableName(INFORMATION_SCHEMA.SEQUENCES);
login.getPlatform().setSequencePreallocationSize(1);

[EL Fine]: 2013-02-22

14:52:15.602--ClientSession(1205789719)--Connection(1834774659)--Thread(Thread[main,5,main])--UPDATE
INFORMATION_SCHEMA.SEQUENCES SET CURRENT_VALUE = CURRENT_VALUE + ?
WHERE SEQUENCE_NAME = ?
bind = [1, SYSTEM_SEQUENCE_1E71BBBC_0444_4E1D_A3A5_DD4483BD30EE]



That statement is not allowed because it updates meta tables.




Why are you trying to update meta tables instead of using standard SQL 
to modify the sequence?


http://h2database.com/html/grammar.html#alter_sequence

--
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 http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: h2 with Eclipselink and sequences

2013-02-26 Thread Dries
I don't use Schema Generation by eclipselink, the tables are created in h2 
directly.  That I think is the reason h2 isn't able to link the sequence 
name to the auto_increment field.

On Tuesday, February 26, 2013 7:31:19 AM UTC+1, Christoph Läubrich wrote:

 Do you use annotations? Schema generation? 

 I use H2 with eclipse link and the following annotation for id: 

 @Id 
 @GeneratedValue(strategy = GenerationType.IDENTITY) 

 without any problem (schema is generated by eclipse link) 


-- 
*
*
*

Confidentiality Notice:  *
The information in this email is confidential and privileged.  If you are 
the intended recipient and you have a current Non-Disclosure Agreement in 
place between your entity and Security Weaver any content contained or 
implied by this email should be considered within the scope of that 
agreement.  If the recipient of this message is not the intended recipient, 
any disclosure, copying, distribution, retention or action taken or omitted 
to be taken in reliance on it is prohibited.  Please notify us immediately 
by replying to the message or by telephoning +1- 800-620-4210 and deleting 
it and any attachments from your computer system.

-- 
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 http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: h2 with Eclipselink and sequences

2013-02-26 Thread Dries
Because, once I enable my sessionCustomizer class, eclipselink no longer 
uses the correct statement (CALL NEXT VALUE FOR), but instead uses : 

[EL Fine]: 2013-02-22 
14:50:01.291--ClientSession(2052114141)--Connection(1340006540)--Thread(Thread[main,5,main])--UPDATE
 
SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?
bind = [50, SYSTEM_SEQUENCE_1E71BBBC_0444_4E1D_A3A5_DD4483BD30EE]


All I changed in the session Customizer class was setSequenceNumberName.

I came up with a workaround where I now, instead of using auto increment 
when creating the tables, I createmy own sequences and set the default 
value of the column to :
DEFAULT (NEXT VALUE FOR PUBLIC.MY_SEQUENCE_TABNAME ) NOT NULL 
NULL_TO_DEFAULT SEQUENCE PUBLIC.MY_SEQUENCE_TABNAME;

Then in my persistence entity classes, I set the sequence name.
@GeneratedValue(strategy = GenerationType.AUTO, generator=GEN_TABNAME)
@SequenceGenerator(name = GEN_TABNAME, sequenceName = 
MY_SEQUENCE_TABNAME, allocationSize = 1)


It's not ideal, I would still prefer a way where eclipselink figures out 
the sequence name of an auto_increment field and uses that correctly, but 
it works.

Thanks,

Droes

On Tuesday, February 26, 2013 10:25:01 AM UTC+1, Noel Grandin wrote:

  
 On 2013-02-22 15:55, Dries wrote:
  
 I'm able to make that statement work on the correct tables and fields in 
 h2, but h2 doesn't allow changes to meta tables, so that doesn't solve the 
 problem either. 
 login.getPlatform().setSequenceCounterFieldName(CURRENT_VALUE);
 login.getPlatform().setSequenceNameFieldName(SEQUENCE_NAME);
 login.getPlatform().setSequenceTableName(INFORMATION_SCHEMA.SEQUENCES);
 login.getPlatform().setSequencePreallocationSize(1);
  
   [EL Fine]: 2013-02-22 
 14:52:15.602--ClientSession(1205789719)--Connection(1834774659)--Thread(Thread[main,5,main])--UPDATE
  
 INFORMATION_SCHEMA.SEQUENCES SET CURRENT_VALUE = CURRENT_VALUE + ? WHERE 
 SEQUENCE_NAME = ?
   bind = [1, SYSTEM_SEQUENCE_1E71BBBC_0444_4E1D_A3A5_DD4483BD30EE]
  

  
  That statement is not allowed because it updates meta tables.

  
  
 Why are you trying to update meta tables instead of using standard SQL to 
 modify the sequence?

 http://h2database.com/html/grammar.html#alter_sequence
  

-- 
*
*
*

Confidentiality Notice:  *
The information in this email is confidential and privileged.  If you are 
the intended recipient and you have a current Non-Disclosure Agreement in 
place between your entity and Security Weaver any content contained or 
implied by this email should be considered within the scope of that 
agreement.  If the recipient of this message is not the intended recipient, 
any disclosure, copying, distribution, retention or action taken or omitted 
to be taken in reliance on it is prohibited.  Please notify us immediately 
by replying to the message or by telephoning +1- 800-620-4210 and deleting 
it and any attachments from your computer system.

-- 
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 http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Physical disconnection caused h2 to grow as big as possible

2013-02-26 Thread Riccard Montén
OK - Thank you Noel!


From: Noel Grandin 
Sent: Tuesday, February 26, 2013 11:11 AM
To: Riccard Montén ; h2-database@googlegroups.com 
Subject: Re: Physical disconnection caused h2 to grow as big as possible


Yes, it is normally handled by the transaction log. 
Normally, what happens is that all of the data does not get to the disk.
In which case we use our transaction/undo log to undo all in-progress 
modifications.

However, in your case it looks like the actual header of the DB was corrupted, 
and there is not much we can do about that.

The header now contains a bad value which makes the DB look much bigger than it 
should bes, and the RECOVER process is failing when it tries to expand the DB 
to that size.


On 2013-02-26 12:05, Riccard Montén wrote:

  Yes it seems hard to repair! I succeeded to open the db-file in MS Wordpad so 
I could save some data. 
  Just two questions: 
  Normally should not a physical diconnection be handled in by h2 minimizing 
the effect of such a crash?
  Is it possible to know what makes the size of the databasefile to grow as big 
as it can limited only by the physical diskspace?

-- 
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 http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Have composite index T(a,b): is index T(a) redundant?

2013-02-26 Thread Dan Halbert
I have a table like this:
  CREATE TABLE t (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY(a, b))

This implicitly creates an index:
  CREATE INDEX t(a, b)

To improve the efficiency of some queries, I have also created an index:
  CREATE INDEX t(b)

Is it worth also creating an non-composite index on a?
  CREATE INDEX t(a)

or is INDEX t(a) redundant and subsumed by CREATE INDEX t(a, b)?

Thanks,
Dan

-- 
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 http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Exposing some getter methods and classes for TableEngine implementors

2013-02-26 Thread Ashwin Jayaprakash
I have something to add to my previous request. For a moderately complex 
query like this:

select *a*.id, *a*.age, b.id, *c*.id, *c***.type
from *a* 
  left outer join *b* on a.id = b.id
  left outer join *c* on b.id = c.id 
where *a*.age  42 and *c*.type = 'answers'

Here, a.id, b.id, c.id are all indexed columns.

While executing this query, the database does a nested loop join of:
   a (age  42) *[* b (b.id = current a.id) *[* c (c.id = current b.id) *]* 
*]*

*Issue 1: *This seems alright except for the deepest join on c where the 
predicate (c.type = 'answers') *does not get pushed down* in the 
TableFilter.getFilterCondition() for c where it is null.

*Issue 2:* The second thing is more of an enhancement request where the *
TableFilter.fullCondition* does not have a *getter method*. It would be 
nice if we had one for that. If this were available then issue 1 could be 
somewhat alleviated if we had visibility into the overall/full condition. 
This way TableEngine implementors can do some early optimizations.

Thanks!

-- 
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 http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




MVCC=true, multi-thread and ReentrantLock

2013-02-26 Thread Noel Grandin

HI

Since we now require Java1.5, perhaps we should be using

 java.util.concurrent.locks.ReentrantLock(true/*fair*/)

  (note  the use of the fairness parameter.)

instead of using the synchronized keyword?

I suspect it would reduce the incidence of  Timeout trying to lock 
table when using MVCC mode, because we'd be executing the incoming 
queries in the order in which they arrived, instead of in semi-random order.


Personally, I don't use MVCC or MULTI_THREADED, so I'm not inclined to 
pursue this, but other people seem to be using those modes, so maybe 
they'd like to try?


Regards,
Noel Grandin

Specifically, in the code I talking about here lives in 
org.h2.command.Command


public int executeUpdate() {
Object sync = database.isMultiThreaded() ? (Object) session : 
(Object) database;


synchronized (sync) {
   
}
}

private long filterConcurrentUpdate(DbException e, long start) {
   
database.wait(sleep);
   
}


and in org.h2.table.RegularTable

private void doLock(Session session, int lockMode, boolean exclusive) {
   
database.wait(sleep);
   
}

and in org.h2.mvstore.db.MVTable#doLock(Session session, int lockMode, 
boolean exclusive)

and in org.h2.mvstore.db.MVStore.Writer#run()



--
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 http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.