h2

How to find if a column name is a reserved keyword across various databases

谁说胖子不能爱 提交于 2019-12-01 17:02:32
We have a legacy schema file which has the following column names, would like to understand if any of them would cause an issue if we port our application to h2, mysql, postgres or oracle. e.g how would I know if using this would be ok across the databases listed below. Are there any good tools which can do a preliminary check on this? key when size type count from with Should be quite easy to get the list of reserved words and build a table of the reserved words. Here are some lists of reserved words: Oracle: http://download.oracle.com/docs/cd/B19306_01/em.102/b40103/app_oracle_reserved_words

Spring Boot. @DataJpaTest H2 embedded database create schema

和自甴很熟 提交于 2019-12-01 15:09:48
I have couple of entities in my data layer stored in particular schema. For example: @Entity @Table(name = "FOO", schema = "DUMMY") public class Foo {} I'm trying to setup H2 embedded database for integration testing of my data layer. I'm using @DataJpaTest annotation for my tests to get H2 embedded database configured automatically. However, the creation of tables fails because schema DUMMY is not created at DB initialization. Any ideas on how to create schema before creation of tables in test cases? I've tried to use @Sql(statements="CREATE SCHEMA IF NOT EXISTS DUMMY") but didn't succeed.

Buffer overflow issue when rows in vault is more than 200

佐手、 提交于 2019-12-01 14:38:52
We have developed an app, which creates obligations in vault in a table. If the row size of the table is less than 200, the application works fine. However, if the rows are more than 200 then during the execution it gives the following error - Please specify a PageSpecification as there are more results [201] than the default page size [200] After increasing the pagination to 400 from the default 200, I am getting java heap out of memory error. I tired to increase the heap size of node from 512m (default) to 1024m. But, still this issue is not resolved and I am getting the error in H2 DB-

Buffer overflow issue when rows in vault is more than 200

半腔热情 提交于 2019-12-01 12:42:32
问题 We have developed an app, which creates obligations in vault in a table. If the row size of the table is less than 200, the application works fine. However, if the rows are more than 200 then during the execution it gives the following error - Please specify a PageSpecification as there are more results [201] than the default page size [200] After increasing the pagination to 400 from the default 200, I am getting java heap out of memory error. I tired to increase the heap size of node from

SQL exception preparing query with ORMLite

久未见 提交于 2019-12-01 11:20:11
I am using an ORM (ORMlite) and all my calls are going well until I get the following error. Exception in thread "main" org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement " SELECT * FROM ""STORIES"" WHERE ""TITLE"" = 'Deepcut case leads 'NOT FOLLOWED[*]'' "; SQL statement: SELECT * FROM Stories WHERE title = 'Deepcut case leads 'not followed'' [42000-152] at org.h2.message.DbException.getJdbcSQLException(DbException.java:327) at org.h2.message.DbException.get(DbException.java:167) at org.h2.message.DbException.get(DbException.java:144) at org.h2.message.DbException.getSyntaxError

SQL “SCRIPT” command to backup h2 database

余生颓废 提交于 2019-12-01 11:12:23
I have an application with h2 database. I want to create .sql file using SCRIPT command in Java. If I am executing it using Prepared Statement: PreparedStatement stmt = con.prepareStatement("SCRIPT"); ResultSet rs = stmt.executeQuery(); Then how can I able to get whole result in single String. I am new to Java so unable to find the way out to get result of that query because it doesn't contains column names in it. Then I will write it in file using InputStream . If you want to backup into a file, the content of your H2 instance as a SQL script , you can directly use SCRIPT TO 'path/to/my/file

SQL one-to-many

陌路散爱 提交于 2019-12-01 08:28:11
I am trying to build an SQL schema for a system where we have channels , each with an id , and one or more fixtures . I am having difficulty finding a way to implement this one-to-many mapping. (i.e. One channel to many fixtures ). I am using the H2 database engine . I cannot have a table : id | fixture ----|---------- 1 | 1 1 | 2 2 | 3 CREATE TABLE channel( id INT NOT NULL PRIMARY KEY, fixture INT NOT NULL ); ... as the PRIMARY KEY id must be UNIQUE . Similarly, I cannot map as follows: CREATE TABLE channel( id INT NOT NULL PRIMARY KEY, f_set INT NOT NULL REFERENCES fixtures(f_set) ); CREATE

How to set the default JDBC URL value in H2 console using spring boot

為{幸葍}努か 提交于 2019-12-01 06:38:52
问题 I have enable the H2 console in spring boot. However, when I open the console connection page the default url is the one staved in the H2 console history. How can i configure the project to populate the URL to be the same as spring.datasource.url on project start? Currently I set the url in the console manually but I would like to have it setup automatically by the project itself. yaml: spring: h2: console: enabled: true path: /admin/h2 datasource: url: jdbc:h2:mem:foobar update: I know that

SQL one-to-many

大憨熊 提交于 2019-12-01 05:03:26
问题 I am trying to build an SQL schema for a system where we have channels , each with an id , and one or more fixtures . I am having difficulty finding a way to implement this one-to-many mapping. (i.e. One channel to many fixtures ). I am using the H2 database engine. I cannot have a table : id | fixture ----|---------- 1 | 1 1 | 2 2 | 3 CREATE TABLE channel( id INT NOT NULL PRIMARY KEY, fixture INT NOT NULL ); ... as the PRIMARY KEY id must be UNIQUE . Similarly, I cannot map as follows:

Resetting autoincrement in h2

梦想的初衷 提交于 2019-12-01 04:44:58
I'm testing a controller that returns a json response but the tests fail after the first time because the h2 database does not reset the auto increment id. Using fixtures or creating objects manually has a same problem. @Before public void setUp() { Fixtures.deleteAllModels(); Fixtures.loadModels("data.yaml"); } How to solve this problem? Start your play app, fire up browser with this url (if you run play app locally): http://localhost:9000/@db Enter your h2 db, and type the command below and run: ALTER TABLE <table_name> ALTER COLUMN <column_name> RESTART WITH 1 If you'd like to do this