Re: org.h2.jdbc.JdbcSQLException: Cannot parse "DATE" constant

2012-10-22 Thread priyanka
hello sir, i want to change date format in h2 database i used this query SELECT * FROM pet WHERE parsedatetime(birth, 'dd-mm-') > DATE '21-02-2002'; Iam getting this exception Cannot parse "DATE" constant "21-02-2002"; SQL statement: SELECT * FROM pet WHERE parsedatetime(birth, 'dd-mm-

Re: Re: Re: Insert if row does not already exist, cache PreparedStatement in a function

2012-10-22 Thread vrotaru...@gmail.com
On Tue, Oct 23, 2012 at 3:10 AM, wrote: > merge into File (filepath, filesize, datemodified) key (filepath) values > (?,?,?) I've just created a table and tried this from the H2 console merge into File (filepath, filesize, datemodified) key (filepath) values ('foo',,889) No exception. And

Re: Re: Re: Insert if row does not already exist, cache PreparedStatement in a function

2012-10-22 Thread brent . ellwein
I don't know what to think about the merge exception, my unit test has a database with only a single row in it when the exception is thrown. Maybe I am not using the merge statement in the correct way? Here is the SQL of my test case CREATE TABLE File ( dbid bigint identity PRIMARY KEY NOT

Re: Re: Insert if row does not already exist, cache PreparedStatement in a function

2012-10-22 Thread vrotaru...@gmail.com
On Tue, Oct 23, 2012 at 1:26 AM, wrote: > The string case is only one instance of this conditional insert pattern. > Some other cases have more complex unique pairs of keys, where a generated > ID is used to identify the row. I have not been able to get the merge to > return anything, but rather

Re: Re: Insert if row does not already exist, cache PreparedStatement in a function

2012-10-22 Thread brent . ellwein
The string case is only one instance of this conditional insert pattern. Some other cases have more complex unique pairs of keys, where a generated ID is used to identify the row. I have not been able to get the merge to return anything, but rather throw exceptions with my test cases thus far

Re: Insert if row does not already exist, cache PreparedStatement in a function

2012-10-22 Thread vrotaru...@gmail.com
>From the merge documention "MERGE INTO [ ..] Updates existing rows, and insert rows that don't exist. If no key column is specified, the primary key columns are used to find the row. If more than one row per new row is affected, an exception is thrown. If the table contains an auto-incremented ke

Re: Insert if row does not already exist, cache PreparedStatement in a function

2012-10-22 Thread Brent Ellwein
varchar is a nicer solution than text, thank you for that suggestion, however merge doesn't really work for my application. If the inset fails, then the merge will throw an exception rather than return the generated row ID. What I need is to get the ID for the row back if it already exists. I

Re: Insert if row does not already exist, cache PreparedStatement in a function

2012-10-22 Thread vrotaru...@gmail.com
On Tue, Oct 23, 2012 at 12:15 AM, Rami Ojares wrote: > What is the difference between varchar and text. H2 specifically rejects >> using unique or primarykey for text fields. >> > > I am looking at the list of types supported by h2 > http://www.h2database.com/**html/datatypes.html

Re: Insert if row does not already exist, cache PreparedStatement in a function

2012-10-22 Thread Rami Ojares
What is the difference between varchar and text. H2 specifically rejects using unique or primarykey for text fields. I am looking at the list of types supported by h2 http://www.h2database.com/html/datatypes.html I don't see type text mentioned. I remember that type from mysql though. Anyway,

Re: Insert if row does not already exist, cache PreparedStatement in a function

2012-10-22 Thread Brent Ellwein
What is the difference between varchar and text. H2 specifically rejects using unique or primarykey for text fields. Also, this does not solve the problem of caching the preparedStatement in the function. Any suggestions there? On Monday, October 22, 2012 12:37:51 PM UTC-6, Vasile Rotaru wrot

Debugging H2

2012-10-22 Thread Rami Ojares
Hi, Currently, it seems to me, the only way to generate full debugging information into H2 is to change line 175 in org.h2.build.Build.java One needs to add -g argument to compiler. args = args.plus("-Xlint:unchecked", "-g", "-d", "temp", "-sourcepath", "src/main", "-classpath", classpath);

Re: Insert if row does not already exist, cache PreparedStatement in a function

2012-10-22 Thread vrotaru...@gmail.com
So what's wroing with: create table unique_names (id identity, name varchar not null unique) You can even make the a column of type varchar the primary key. I did. On Mon, Oct 22, 2012 at 7:18 PM, Brent Ellwein wrote: Hello, > > I am trying to have a unique String column for my H2 databa

Insert if row does not already exist, cache PreparedStatement in a function

2012-10-22 Thread Brent Ellwein
Hello, I am trying to have a unique String column for my H2 database implementation. As this is not natively supported, I'm walking around in the weeds a little bit, and store the hash of the string in an indexed column in the table. For insert, I have a two-part check. 1) see if a row exis

build script errors

2012-10-22 Thread Rami Ojares
Hi, I get errors with some targets. Tried with java7 (oracle) and java6 (openjdk). Using head of trunk. ./build.sh docs Running org.h2.build.doc.XMLChecker ERROR in file ./src/docsrc/html/changelog.html java.lang.Exception: Unclosed element li at PostgreSQL compatibility: support for EXTRACT(

Re: Errors when parsing DATE and TIME.

2012-10-22 Thread priyanka priya
hello sir, I tried this example but getting error SELECT * FROM pet WHERE parsedatetime(birth, 'dd/mm/') Error parsing "2012-02-21"; SQL statement: SELECT * FROM pet WHERE parsedatetime(birth, 'dd/mm/') [90014-169]

Re: Errors when parsing DATE and TIME.

2012-10-22 Thread priyanka
hello sir, h2 date format is this DATE '2004-12-31' how to parse in dd/mm/ Iam getting this exception Cannot parse "DATE" constant "21/01/2012"; SQL statement: I saw the document but unable to understand ho

Re: Out Of Memory Error: Java heap space

2012-10-22 Thread Noel Grandin
Your best bet at debugging out of memory problems is to (1) add the -XX:+HeapDumpOnOutOfMemoryError option to your command line (2) run the program. when it crashes, it will produce a file with a name like java_1305.hprof (3) analyze the dump with something like Eclipse MAT: http://blog.bosc