Re: [h2] Hibernate cannot validate it's own created schema using h2
Le 11/03/2016 16:01, Eric Chatellier a écrit : > > Can you take a look ? Ok, he already responded that it's a features in h2. -- Éric Chatellier - www.codelutin.com - 02.40.50.29.28 -- 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] Hibernate cannot validate it's own created schema using h2
Hi, We are experiencing a bug with hibernate validating the database schema without the application schema. The problem is that hibernate can't validate a schema that it just created. The bug is reported here : https://hibernate.atlassian.net/browse/HHH-9693 but developer think this may be a bug in h2. Can you take a look ? -- Éric Chatellier - www.codelutin.com - 02.40.50.29.28 -- 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] Missing jar file in maven repository
Le 22/05/2015 15:03, Eric Chatellier a écrit : search UI bug. Or invalid pom file : http://repo1.maven.org/maven2/com/h2database/h2/1.4.187/h2-1.4.187.pom -- Éric Chatellier - www.codelutin.com - 02.40.50.29.28 -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [h2] Missing jar file in maven repository
Le 22/05/2015 13:57, Jürgen Henning a écrit : Hi, I'm trying to use the h2 database within a gradle project. Unfortunately there is no jar file into the respective repo (http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.h2database%22). Has anybody a useful hint about this error? search UI bug. jar does exists : http://repo1.maven.org/maven2/com/h2database/h2/1.4.187/ -- Éric Chatellier - www.codelutin.com - 02.40.50.29.28 -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [h2] Can't use h2 database in a thread only with Java 8
Le 19/03/2015 07:45, Thomas Mueller a écrit : Hi, The settings can be changed in any order... Does it consistently work in one case, but not the other? Yes, it consistently fails if set cluster '' is not the first instruction. In the same sql file, if i modify script just to set set cluster '' at the begining of the file, it's working fine. Could you try with the latest version of H2, and append ;mv_store=false to the database URL? I can't reproduce the problem with the latest version, and I didn't try yet with the version you use (1.3.176). Same behaviour happen with 1.3.176 and 1.4.186 with ;mv_store=false But you are right, i can't reproduce this bug with only h2 or h2 using connection pool. I'm currently able to reproduce this bug using h2 with hibernate (i attached my test file) (full maven test project is available here : https://svn.nuiton.org/sandbox/h2j8test/ ) So this is even stranger :( Please note the beginning of the trace file is missing (where the database is opened). If you change the database URL to use trace_level_file=3 then this should no occur. I attached full trace file. Regards, -- Éric Chatellier - www.codelutin.com - 02.40.50.29.28 -- 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. For more options, visit https://groups.google.com/d/optout. package org.test; import java.io.File; import java.util.Properties; import org.hibernate.SQLQuery; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.Configuration; public class H2J8Test { public static void main(String[] args) throws Exception { // set properties Configuration config = new Configuration(); config.setProperty(hibernate.connection.username, sa); config.setProperty(hibernate.connection.password, sa); config.setProperty(hibernate.dialect, org.hibernate.dialect.H2Dialect); config.setProperty(hibernate.connection.driver_class, org.h2.Driver); //config.setProperty(hibernate.current_session_context_class, thread); config.setProperty(hibernate.connection.url, jdbc:h2:file:./test_ + System.currentTimeMillis() + ;FILE_LOCK=file;DEFAULT_LOCK_TIMEOUT=1000;DB_CLOSE_DELAY=0;LOCK_MODE=3;TRACE_LEVEL_FILE=3;TRACE_LEVEL_SYSTEM_OUT=0;LOG=1;mv_store=false); // define hibernate factory Properties properties = config.getProperties(); StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder(); StandardServiceRegistry standardServiceRegistry = builder.applySettings(properties).build(); SessionFactory hibernateFactory = config.buildSessionFactory(standardServiceRegistry); // runscript final File file = new File(data-backup8.sql); String options = file.getName().endsWith(.gz) ? COMPRESSION GZIP : ; Session session = hibernateFactory.openSession(); SQLQuery query = session.createSQLQuery(RUNSCRIPT FROM ' + file.getAbsolutePath() + ' + options); query.executeUpdate(); session.close(); hibernateFactory.close(); } } 03-19 10:59:29 database: opening /tmp/h2j8test/test_1426759169560 (build 176) 03-19 10:59:29 fileLock: load {} 03-19 10:59:29 fileLock: save {id=14c317936d23f67c6aabe86040af1fbbf6dcf3fd544, method=file} 03-19 10:59:29 fileLock: load {method=file, id=14c317936d23f67c6aabe86040af1fbbf6dcf3fd544} 03-19 10:59:29 pageStore: writeVariableHeader 03-19 10:59:29 pageStore: updateRecord page[4] data leaf table:-1 PAGE_INDEX entries:0 parent:0 keys:null offsets:null 03-19 10:59:29 pageStore: updateRecord page [3] freeList 03-19 10:59:29 index: PAGE_INDEX_DATA opened rows: 0 03-19 10:59:29 pageStore: log openForWriting firstPage: 5 03-19 10:59:29 pageStore: setLogFirstPage key: 1 trunk: 5 data: 6 03-19 10:59:29 pageStore: writeVariableHeader 03-19 10:59:29 pageStore: log undo 3 03-19 10:59:29 pageStore: log undo 514 03-19 10:59:29 index: PAGE_INDEX_DATA add ( /* key:1 */ 0, 0, 0, 514, 'OFF,0,,,false', '0,1,2,3') 03-19 10:59:29 pageStore: log undo 4 03-19 10:59:29 pageStore: log + s: 1 table: -1 row: ( /* key:1 */ 0, 0, 0, 514, 'OFF,0,,,false', '0,1,2,3') 03-19 10:59:29 pageStore: updateRecord page[514] data leaf table:0 SYS entries:0 parent:0 keys:null offsets:null 03-19 10:59:29 index: SYS_DATA opened rows: 0 03-19 10:59:29 lock: 1 exclusive write lock requesting for SYS 03-19 10:59:29 lock: 1 exclusive write lock added for SYS 03-19 10:59:29 index: SYS_DATA add ( /* key:1 */ 1, 0, 6, 'SET CREATE_BUILD 176') 03-19 10:59:29 pageStore: log + s: 1
Re: [h2] Can't use h2 database in a thread only with Java 8
Le 17/03/2015 16:24, Eric Chatellier a écrit : I a modify a failing test with the java 8 file to set SET CLUSTER ''; on the first line, the test is then ok. Can you confirm that this is a possible java 8 bug with SCRIPT TO command ? I just found this : http://docs.oracle.com/javase/8/docs/technotes/guides/collections/changes8.html and I just tested that, in file src/main/org/h2/engine/Database.java, using LinkedHashMap instead of HashMap for settings attribute is a temp workarround that fixes my problem. Regards. -- Éric Chatellier - www.codelutin.com - 02.40.50.29.28 -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [h2] Can't use h2 database in a thread only with Java 8
Le 12/02/2015 12:36, Eric Chatellier a écrit : I can't isolate this bug, but i'm experiencing it 100% in my application. So, i've to idea how to fix this issue :( Hi, I think i finally find how to reproduce this bug. This may be related to SCRIPT TO command, that got a different behaviour with java 7 and 8. See, in top of sql file, first instrution are not ordered the same way. Java 7: SET CLUSTER ''; SET DEFAULT_TABLE_TYPE 0; SET LOCK_MODE 3; SET DB_CLOSE_DELAY 0; SET WRITE_DELAY 500; SET DEFAULT_LOCK_TIMEOUT 1000; SET CACHE_SIZE 16384; Java 8: SET DB_CLOSE_DELAY 0; SET CACHE_SIZE 16384; SET CLUSTER ''; SET DEFAULT_TABLE_TYPE 0; SET DEFAULT_LOCK_TIMEOUT 1000; SET WRITE_DELAY 500; SET LOCK_MODE 3; I a modify a failing test with the java 8 file to set SET CLUSTER ''; on the first line, the test is then ok. Can you confirm that this is a possible java 8 bug with SCRIPT TO command ? PS: see SCRIPT TO sql files and trace logs -- Éric Chatellier - www.codelutin.com - 02.40.50.29.28 -- 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. For more options, visit https://groups.google.com/d/optout. data-backup_java7.sql.gz Description: application/gzip data-backup_java8.sql.gz Description: application/gzip /**/PreparedStatement prep304 = conn20.prepareStatement(RUNSCRIPT FROM '/tmp/data-backup_java7.sql.gz' COMPRESSION GZIP); 03-17 15:58:42 jdbc[3]: /**/prep304.executeUpdate(); 03-17 15:58:42 lock: 1 exclusive write lock requesting for SYS 03-17 15:58:42 lock: 1 exclusive write lock added for SYS 03-17 15:58:42 index: SYS_DATA add ( /* key:17 */ 17, 0, 6, 'SET CLUSTER ') 03-17 15:58:42 pageStore: log undo 11 03-17 15:58:42 pageStore: updateRecord page[11] data leaf table:0 SYS entries:17 parent:0 keys:[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0, 0, 0] offsets:[2024, 1890, 1789, 1632, 1532, 1362, 1252, 1086, 971, 831, 723, 559, 423, 399, 380, 346, 327, 0, 0, 0, 0] 03-17 15:58:42 pageStore: log + s: 1 table: 0 row: ( /* key:17 */ 17, 0, 6, 'SET CLUSTER ') 03-17 15:58:42 pageStore: log commit s: 1 03-17 15:58:42 lock: 1 exclusive write lock unlock SYS 03-17 15:58:42 lock: 3 exclusive write lock requesting for SYS 03-17 15:58:42 lock: 3 exclusive write lock added for SYS 03-17 15:58:42 index: SYS_DATA add ( /* key:18 */ 18, 0, 6, 'SET DEFAULT_TABLE_TYPE 0') 03-17 15:58:42 pageStore: log + s: 3 table: 0 row: ( /* key:18 */ 18, 0, 6, 'SET DEFAULT_TABLE_TYPE 0') 03-17 15:58:42 index: SYS_DATA add ( /* key:19 */ 19, 0, 6, 'SET WRITE_DELAY 500') 03-17 15:58:42 pageStore: log + s: 3 table: 0 row: ( /* key:19 */ 19, 0, 6, 'SET WRITE_DELAY 500') 03-17 15:58:42 index: SYS_DATA add ( /* key:20 */ 20, 0, 6, 'SET CACHE_SIZE 16384') 03-17 15:58:42 pageStore: log + s: 3 table: 0 row: ( /* key:20 */ 20, 0, 6, 'SET CACHE_SIZE 16384') 03-17 15:58:42 pageStore: log commit s: 3 03-17 15:58:42 lock: 3 exclusive write lock unlock SYS 03-17 15:58:42 lock: 3 exclusive write lock requesting for SYS 03-17 15:58:42 lock: 3 exclusive write lock added for SYS 03-17 15:58:42 pageStore: log undo 3 03-17 15:58:42 pageStore: updateRecord page [3] freeList 03-17 15:58:42 pageStore: log undo 521 03-17 15:58:42 index: PAGE_INDEX_DATA add ( /* key:22 */ 21, 0, 21, 521, 'OFF,0,,,false', '0,1,2,3,4,5') 03-17 15:58:42 pageStore: log undo 4 03-17 15:58:42 pageStore: updateRecord page[4] data leaf table:-1 PAGE_INDEX entries:10 parent:0 keys:[1, 3, 4, 6, 7, 8, 10, 11, 12, 22, 0, 0, 0, 0] offsets:[2022, 1998, 1977, 1957, 1929, 1907, 1885, 1861, 1840, 1806, 0, 0, 0, 0] 03-17 15:58:42 pageStore: log + s: 3 table: -1 row: ( /* key:22 */ 21, 0, 21, 521, 'OFF,0,,,false', '0,1,2,3,4,5') 03-17 15:58:42 pageStore: updateRecord page[521] data leaf table:21 ACTIVERULE entries:0 parent:0 keys:null offsets:null 03-17 15:58:42 index: ACTIVERULE_DATA opened rows: 0 03-17 15:58:42 index: SYS_DATA add ( /* key:21 */ 21, 0, 0, STRINGDECODE('CREATE CACHED TABLE PUBLIC.ACTIVERULE(\nTOPIAID VARCHAR(255) NOT NULL,\nTOPIAVERSION BIGINT NOT NULL,\nTOPIACREATEDATE DATE,\n ACTIVERULESTEP INTEGER,\nNAME CLOB,\nPARAM CLOB\n)')) 03-17 15:58:42 index: SYS_DATA split 03-17 15:58:42 pageStore: log undo 522 03-17 15:58:42 pageStore: updateRecord page[522] data leaf table:0 SYS entries:1 parent:0 keys:[13, 0, 0, 0, 0] offsets:[1912, 0, 0, 0, 0] 03-17 15:58:42 pageStore: log undo 523 03-17 15:58:42 pageStore: updateRecord page[11] data node table:0 entries:1 [523, 522] 03-17 15:58:42 pageStore: log + s: 3 table: 0 row: ( /* key:21 */ 21, 0, 0, STRINGDECODE('CREATE CACHED TABLE PUBLIC.ACTIVERULE(\nTOPIAID VARCHAR(255) NOT NULL,\n
Re: [h2] Can't use h2 database in a thread only with Java 8
Le 02/02/2015 11:07, Eric Chatellier a écrit : Now that Java 8 is becoming main line, and i always experiencing this bug, i will investigate harder... I can't isolate this bug, but i'm experiencing it 100% in my application. So, i've to idea how to fix this issue :( -- Éric Chatellier - www.codelutin.com - 02.40.50.29.28 -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [h2] Missing column type in right-hand parameter in ConditionIn
Le 31/07/2014 18:04, Arnaud Thimel a écrit : Hi, ( I'm new to the mailing-list, sorry if I do not follow the expectations. ) I'm using H2 1.3.176 together with Hibernate 4.3.6.Final. I'm having a bug with a particular Hibernate query involving IN with an enum list. [1] I thought Hibernate was involved in this issue, but it seems that it comes from H2. You will find attached two tests in tests.java. The first one (testColumnMetaDataWithEquals) works fine. It creates a PreparedStatement ( SELECT ... WHERE someColumn = ? ) then uses preparedStmt.getParameterMetaData().getParameterType(1) which returns the expected value. The second one (testColumnMetaDataWithIn) is doing exactly the same thing except the WHERE clause is using IN ( SELECT ... WHERE someColumn IN ( ? , ? ) ). Then preparedStmt.getParameterMetaData().getParameterType(1) does not return the expected value. I wrote a patch for ConditionIn based on the Comparison source code. This patch proposal is attached, please let me know if it is acceptable. Best regards, Arnaud [1] Is it off topic, but the Hibernate query looks like FROM SomeEntity WHERE someColumn IN ( :enum0 , :enum1 ) Hi, Any news about this patch ? Regards. -- Éric Chatellier - www.codelutin.com - 02.40.50.29.28 -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [h2] Can't use h2 database in a thread only with Java 8
Le 09/12/2014 18:03, Thomas Mueller a écrit : Hi, It looks like you are using runscript (RunScriptCommand in the stack trace). Is this all you do in your program at that time (nothing is happening concurrently)? If yes, could you post or send me the script file please? Hi I've tried to reproduce the bug in a test case with that script, but the error doesn't happen with only h2 and that script. Seams that this bug is a little bit tricky and may invlove connection pool and/or hibernate. Now that Java 8 is becoming main line, and i always experiencing this bug, i will investigate harder... -- Éric Chatellier - www.codelutin.com - 02.40.50.29.28 -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [h2] Can't use h2 database in a thread only with Java 8
Le 08/12/2014 08:17, Noel Grandin a écrit : what does your database URL look like? I checked multiples parameters from: jdbc:h2:file:/tmp/test/test;DEFAULT_LOCK_TIMEOUT=1000;DB_CLOSE_DELAY=0;LOCK_MODE=3;TRACE_LEVEL_FILE=0;TRACE_LEVEL_SYSTEM_OUT=0;LOG=1 to basic url: jdbc:h2:file:/tmp/test/test same error always happen. -- Éric Chatellier - www.codelutin.com - 02.40.50.29.28 -- 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. For more options, visit https://groups.google.com/d/optout.
[h2] Can't use h2 database in a thread only with Java 8
Hi, I'm currently experiencing a Timeout trying to lock table SYS problem only under Java 8 JVM. With a java 7 JVM, everything is working fine. I can't make a test case on it, because i can't understand what's is involved. The exception i get is : Caused by: org.hibernate.PessimisticLockException: could not execute statement at org.hibernate.dialect.H2Dialect$2.convert(H2Dialect.java:342) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:112) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:211) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.engine.query.spi.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:211) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.internal.SessionImpl.executeNativeUpdate(SessionImpl.java:1310) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.internal.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:389) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.nuiton.topia.framework.TopiaContextImpl.restore(TopiaContextImpl.java:1202) ~[topia-persistence-2.9.3.jar:2.9.3] ... 7 more Caused by: org.h2.jdbc.JdbcSQLException: Timeout trying to lock table SYS; SQL statement: SET CLUSTER '' [50200-176] at org.h2.message.DbException.getJdbcSQLException(DbException.java:344) ~[h2-1.3.176.jar:1.3.176] at org.h2.message.DbException.get(DbException.java:178) ~[h2-1.3.176.jar:1.3.176] at org.h2.message.DbException.get(DbException.java:154) ~[h2-1.3.176.jar:1.3.176] at org.h2.table.RegularTable.doLock(RegularTable.java:530) ~[h2-1.3.176.jar:1.3.176] at org.h2.table.RegularTable.lock(RegularTable.java:464) ~[h2-1.3.176.jar:1.3.176] at org.h2.engine.Database.lockMeta(Database.java:869) ~[h2-1.3.176.jar:1.3.176] at org.h2.engine.Database.addDatabaseObject(Database.java:983) ~[h2-1.3.176.jar:1.3.176] at org.h2.command.dml.Set.addOrUpdateSetting(Set.java:524) ~[h2-1.3.176.jar:1.3.176] at org.h2.command.dml.Set.update(Set.java:111) ~[h2-1.3.176.jar:1.3.176] at org.h2.command.dml.RunScriptCommand.execute(RunScriptCommand.java:79) ~[h2-1.3.176.jar:1.3.176] at org.h2.command.dml.RunScriptCommand.update(RunScriptCommand.java:58) ~[h2-1.3.176.jar:1.3.176] at org.h2.command.CommandContainer.update(CommandContainer.java:79) ~[h2-1.3.176.jar:1.3.176] at org.h2.command.Command.executeUpdate(Command.java:254) ~[h2-1.3.176.jar:1.3.176] at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:158) ~[h2-1.3.176.jar:1.3.176] at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:144) ~[h2-1.3.176.jar:1.3.176] at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:208) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.engine.query.spi.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:211) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.internal.SessionImpl.executeNativeUpdate(SessionImpl.java:1310) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.internal.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:389) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.nuiton.topia.framework.TopiaContextImpl.restore(TopiaContextImpl.java:1202) ~[topia-persistence-2.9.3.jar:2.9.3] Do you have any clue on what can cause this error only with java 8 jvm ? Regards. -- Éric Chatellier -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [h2] Patch for translate function support
Hi, OK, I have re-implemented the translate function. But next time, don't copypaste source code, and then claim you wrote it. Regards, Thomas Ok, sorry for that. I was just thinking that apache licensed code was ok with h2 license. And a comment mentionned that the code was copied from apache commons. I will continue to contibute without making this mistake again. Thanks again for rewriting. Regards. -- Éric Chatellier -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [h2] Patch for translate function support
Le 09/04/2014 11:29, Noel Grandin a écrit : Hi Thanks for the patch. Your work looks fine, please can I get a license statement? http://h2database.com/html/build.html#providing_patches Hi, Here is another version of this patch including user documentation, grammar changes and changelog. I wrote the code, it's mine, and I'm contributing it to H2 for distribution multiple-licensed under the H2 License, version 1.0, and under the Eclipse Public License, version 1.0 (http://h2database.com/html/license.html). Regards. -- Éric Chatellier - www.codelutin.com - 02.40.50.29.28 -- 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. For more options, visit https://groups.google.com/d/optout. Index: src/docsrc/help/help.csv === --- src/docsrc/help/help.csv (revision 5595) +++ src/docsrc/help/help.csv (working copy) @@ -3361,6 +3361,14 @@ CALL TO_CHAR(TIMESTAMP '2010-01-01 00:00:00', 'DD MON, ') +Functions (String),TRANSLATE, +TRANSLATE(value , searchString, replacementString]]) +, +Oracle-compatible TRANSLATE function that replaces a sequence of characters in a string with another set of characters. +, +CALL TRANSLATE('Hello world', 'eo', 'EO') + + Functions (Time and Date),CURRENT_DATE, { CURRENT_DATE [ () ] | CURDATE() | SYSDATE | TODAY } , Index: src/docsrc/html/changelog.html === --- src/docsrc/html/changelog.html (revision 5595) +++ src/docsrc/html/changelog.html (working copy) @@ -46,6 +46,7 @@ h2Next Version (unreleased)/h2 ulliSupport the data type DATETIME2 as an alias for DATETIME, for MS SQL Server compatibility. +/liliAdd Oracle-compatible TRANSLATE function, patch by Eric Chatellier. /li/ul h2Version 1.3.176 (2014-04-05)/h2 Index: src/main/org/h2/expression/Function.java === --- src/main/org/h2/expression/Function.java (revision 5595) +++ src/main/org/h2/expression/Function.java (working copy) @@ -7,6 +7,7 @@ package org.h2.expression; import static org.h2.util.ToChar.toChar; + import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -94,7 +95,7 @@ STRINGDECODE = 80, STRINGTOUTF8 = 81, UTF8TOSTRING = 82, XMLATTR = 83, XMLNODE = 84, XMLCOMMENT = 85, XMLCDATA = 86, XMLSTARTDOC = 87, XMLTEXT = 88, REGEXP_REPLACE = 89, RPAD = 90, -LPAD = 91, CONCAT_WS = 92, TO_CHAR = 93; +LPAD = 91, CONCAT_WS = 92, TO_CHAR = 93, TRANSLATE = 94; public static final int CURDATE = 100, CURTIME = 101, DATE_ADD = 102, DATE_DIFF = 103, DAY_NAME = 104, DAY_OF_MONTH = 105, @@ -299,6 +300,7 @@ addFunction(RPAD, RPAD, VAR_ARGS, Value.STRING); addFunction(LPAD, LPAD, VAR_ARGS, Value.STRING); addFunction(TO_CHAR, TO_CHAR, VAR_ARGS, Value.STRING); +addFunction(TRANSLATE, TRANSLATE, 3, Value.STRING); // date addFunctionNotDeterministic(CURRENT_DATE, CURRENT_DATE, @@ -1401,6 +1403,14 @@ database.getMode().treatEmptyStringsAsNull); } break; +case TRANSLATE: { +String matching = v1.getString(); +String replacement = v2.getString(); +result = ValueString.get( +translate(v0.getString(), matching, replacement), +database.getMode().treatEmptyStringsAsNull); +break; +} case H2VERSION: result = ValueString.get(Constants.getVersion(), database.getMode().treatEmptyStringsAsNull); @@ -1910,6 +1920,38 @@ return e; } +// this is the org.apache.commons.lang3.StringUtils +// #replaceChars(String, String, String) implementation +private static String translate(String str, String searchChars, String replaceChars) { + +if (str == null || str.length() == 0 || searchChars == null || searchChars.length() == 0) { +return str; +} +if (replaceChars == null) { +replaceChars = ; // EMPTY +} +boolean modified = false; +int replaceCharsLength = replaceChars.length(); +int strLength = str.length(); +StringBuilder buf = new StringBuilder(strLength); +for (int i = 0; i strLength; i++) { +char ch = str.charAt(i); +int index = searchChars.indexOf(ch); +if (index = 0) { +modified = true; +if (index replaceCharsLength) { +buf.append(replaceChars.charAt(index
[h2] Patch for translate function support
Hi, I would like to add translate(String, String, String) function into h2. The patch file is attached. This function is the same as : - postgresql : http://www.postgresql.org/docs/9.3/static/functions-string.html - oracle : http://www.techonthenet.com/oracle/functions/translate.php Do i have to fill an issue ? Regards -- Éric Chatellier - www.codelutin.com - 02.40.50.29.28 -- 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. For more options, visit https://groups.google.com/d/optout. Index: src/main/org/h2/expression/Function.java === --- src/main/org/h2/expression/Function.java (revision 5595) +++ src/main/org/h2/expression/Function.java (working copy) @@ -7,6 +7,7 @@ package org.h2.expression; import static org.h2.util.ToChar.toChar; + import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -94,7 +95,7 @@ STRINGDECODE = 80, STRINGTOUTF8 = 81, UTF8TOSTRING = 82, XMLATTR = 83, XMLNODE = 84, XMLCOMMENT = 85, XMLCDATA = 86, XMLSTARTDOC = 87, XMLTEXT = 88, REGEXP_REPLACE = 89, RPAD = 90, -LPAD = 91, CONCAT_WS = 92, TO_CHAR = 93; +LPAD = 91, CONCAT_WS = 92, TO_CHAR = 93, TRANSLATE = 94; public static final int CURDATE = 100, CURTIME = 101, DATE_ADD = 102, DATE_DIFF = 103, DAY_NAME = 104, DAY_OF_MONTH = 105, @@ -299,6 +300,7 @@ addFunction(RPAD, RPAD, VAR_ARGS, Value.STRING); addFunction(LPAD, LPAD, VAR_ARGS, Value.STRING); addFunction(TO_CHAR, TO_CHAR, VAR_ARGS, Value.STRING); +addFunction(TRANSLATE, TRANSLATE, 3, Value.STRING); // date addFunctionNotDeterministic(CURRENT_DATE, CURRENT_DATE, @@ -1401,6 +1403,14 @@ database.getMode().treatEmptyStringsAsNull); } break; +case TRANSLATE: { +String matching = v1.getString(); +String replacement = v2.getString(); +result = ValueString.get( +translate(v0.getString(), matching, replacement), +database.getMode().treatEmptyStringsAsNull); +break; +} case H2VERSION: result = ValueString.get(Constants.getVersion(), database.getMode().treatEmptyStringsAsNull); @@ -1910,6 +1920,38 @@ return e; } +// this is the org.apache.commons.lang3.StringUtils +// #replaceChars(String, String, String) implementation +private static String translate(String str, String searchChars, String replaceChars) { + +if (str == null || str.length() == 0 || searchChars == null || searchChars.length() == 0) { +return str; +} +if (replaceChars == null) { +replaceChars = ; // EMPTY +} +boolean modified = false; +int replaceCharsLength = replaceChars.length(); +int strLength = str.length(); +StringBuilder buf = new StringBuilder(strLength); +for (int i = 0; i strLength; i++) { +char ch = str.charAt(i); +int index = searchChars.indexOf(ch); +if (index = 0) { +modified = true; +if (index replaceCharsLength) { +buf.append(replaceChars.charAt(index)); +} +} else { +buf.append(ch); +} +} +if (modified) { +return buf.toString(); +} +return str; +} + private static double roundmagic(double d) { if ((d 0.1) (d -0.1)) { return 0.0; Index: src/test/org/h2/test/db/TestFunctions.java === --- src/test/org/h2/test/db/TestFunctions.java (revision 5595) +++ src/test/org/h2/test/db/TestFunctions.java (working copy) @@ -92,6 +92,7 @@ testToCharFromDateTime(); testToCharFromNumber(); testToCharFromText(); +testTranslate(); // TODO // testCachingOfDeterministicFunctionAlias(); @@ -1162,6 +1163,47 @@ conn.close(); } +private void testTranslate() throws SQLException { +Connection conn = getConnection(functions); +Statement stat = conn.createStatement(); + +String createSQL = CREATE TABLE testTranslate(id BIGINT, + +txt1 varchar);; +stat.execute(createSQL); +stat.execute(insert into testTranslate(id, txt1) + +values(1, 'test1')); +stat.execute(insert into testTranslate(id, txt1) + +
Re: Timeout trying to lock table SYS with runscript
Le 10/10/2011 10:52, Eric Chatellier a écrit : Le 07/10/2011 00:00, Eric Chatellier a écrit : I'm trying to restore a database from runscript command using query: RUNSCRIPT FROM 'xxx/data-backup.sql.gz' COMPRESSION GZIP Caused by: org.h2.jdbc.JdbcSQLException: Timeout trying to lock table SYS; SQL statement: This happen only with runscript, and set LOCK_MODE=0 just for runscript is a temporary workaround. I found the problem. This only happen with the attached database : very very very old 'script to' backup, 5 years old ;) I will migrate it, so not really a problem. -- Éric Chatellier chatell...@codelutin.com Tel: 02.40.50.29.28 http://www.codelutin.com -- You received this message because you are subscribed to the Google Groups H2 Database group. To post to this group, send email to h2-database@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en. data-backup.sql.gz Description: GNU Zip compressed data
Re: Timeout trying to lock table SYS with runscript
Le 07/10/2011 00:00, Eric Chatellier a écrit : I'm trying to restore a database from runscript command using query: RUNSCRIPT FROM 'xxx/data-backup.sql.gz' COMPRESSION GZIP Caused by: org.h2.jdbc.JdbcSQLException: Timeout trying to lock table SYS; SQL statement: This happen only with runscript, and set LOCK_MODE=0 just for runscript is a temporary workaround. -- Éric Chatellier chatell...@codelutin.com Tel: 02.40.50.29.28 http://www.codelutin.com -- You received this message because you are subscribed to the Google Groups H2 Database group. To post to this group, send email to h2-database@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
Timeout trying to lock table SYS with runscript
Hi, In my application running h2 for years, i just updated : - h2 from 1.2.128 to 1.3.160 - hibernate from 3.3.2 to 3.6.5 I'm trying to restore a database from runscript command using query: RUNSCRIPT FROM 'xxx/data-backup.sql.gz' COMPRESSION GZIP Execution fails with error : Caused by: org.hibernate.exception.GenericJDBCException: could not execute native bulk manipulation query at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:219) at org.hibernate.impl.SessionImpl.executeNativeUpdate(SessionImpl.java:1300) at org.hibernate.impl.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:365) at org.nuiton.topia.framework.TopiaContextImpl.restore(TopiaContextImpl.java:1338) ... 3 more Caused by: org.h2.jdbc.JdbcSQLException: Timeout trying to lock table SYS; SQL statement: SET CLUSTER '' [50200-160] at org.h2.message.DbException.getJdbcSQLException(DbException.java:329) at org.h2.message.DbException.get(DbException.java:169) at org.h2.message.DbException.get(DbException.java:146) at org.h2.table.RegularTable.doLock(RegularTable.java:500) at org.h2.table.RegularTable.lock(RegularTable.java:434) at org.h2.engine.Database.lockMeta(Database.java:748) at org.h2.engine.Database.addDatabaseObject(Database.java:862) at org.h2.command.dml.Set.addOrUpdateSetting(Set.java:401) at org.h2.command.dml.Set.update(Set.java:101) at org.h2.command.dml.RunScriptCommand.execute(RunScriptCommand.java:66) at org.h2.command.dml.RunScriptCommand.update(RunScriptCommand.java:45) at org.h2.command.CommandContainer.update(CommandContainer.java:73) at org.h2.command.Command.executeUpdate(Command.java:219) at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:143) at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:129) at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:210) ... 6 more But, running the same query in h2 web server works well. Database is has beean tested with url : - jdbc:h2:file:/xxx/DemoRegion/data/data;FILE_LOCK=file;LOG=1;DEFAULT_LOCK_TIMEOUT=1000;DB_CLOSE_DELAY=0;LOCK_MODE=3;TRACE_LEVEL_FILE=0;TRACE_LEVEL_SYSTEM_OUT=0 - jdbc:h2:file:/xxx/DemoRegion/data/data;FILE_LOCK=no;LOG=1;DEFAULT_LOCK_TIMEOUT=1000;DB_CLOSE_DELAY=0;LOCK_MODE=3;TRACE_LEVEL_FILE=0;TRACE_LEVEL_SYSTEM_OUT=0 - jdbc:h2:file:/xxx/DemoRegion/data/data - jdbc:h2:file:/xxx/DemoRegion/data/data;MVCC=1 without success. I thinks the problem may be related to hibernate update, but i can't find any clue on this. Any idea ? Regards. -- Éric Chatellier -- You received this message because you are subscribed to the Google Groups H2 Database group. To post to this group, send email to h2-database@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en. data-backup.sql.gz Description: GNU Zip compressed data
Re: At what versions does the database format change?
On 05/05/2010 14:27, Soupdragon wrote: When we updated to 1.1.107 it was clear that there was no going back (not sure, now, what the version number of the previous had been, but it was from 2007). A database once opened with the new system won't open on the old. If we upgrade to the latest stable now, will the same thing apply? At what versions does the database format stop being backward compatible? 1.1.107 is starting to look like a bad choice, because a btree bug (when ordered by corresponds to the primary key, has started to trip us up. I think this should have been fixed about 1.1.112 or there abouts (the change history doesn't quite go back far enough). I had the same problem. I think that the new page store format was introduced in h2-1.2.120 and used for new created databases. The old storage format as been deleted in h2-1.2.129. So h2-1.2.129+ can't read database created before 1.2.120. -- Éricchatell...@codelutin.com Tel: 02 40 50 29 28 http://www.codelutin.com -- You received this message because you are subscribed to the Google Groups H2 Database group. To post to this group, send email to h2-datab...@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
Re: Unsupported database file version or invalid file header exception since 1.2.129
Le 22/02/2010 18:56, Thomas Mueller a écrit : Hi, As described in the change log at http://www.h2database.com/html/changelog.html version 1.2.129 does not support databases created by earlier versions of H2 (the old database file format). See also the error message: Old database: ... please convert the database to a SQL script and re-create it. I wrote a a tool to migrate an old database from the non-page store format to the newest version: http://h2database.googlecode.com/svn/trunk/h2/src/tools/org/h2/dev/util/Migrate.java Ok, thank you for your response. I didn't noticed the change. Last question. I need to do this migration automatically. Is there a way to known if migration is needed before opening database ? Or catching this exception is the only way ? Thanks Regards. Regards, Thomas -- Éric chatell...@codelutin.com Tel: 02 40 50 29 28 http://www.codelutin.com -- You received this message because you are subscribed to the Google Groups H2 Database group. To post to this group, send email to h2-datab...@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.