h2

H2 - (Quite) long INSERT failing with error 42000

扶醉桌前 提交于 2020-08-09 09:31:40
问题 H2 in-memory - INSERT - Error 42000 Tried versions 1.4.196, 1.4.197, 1.4.199. I also tried to execute INSERT on H2 server (local) : also failed The line giving the error: (sorry but for security reasons I cannot produce more) : INSERT INTO tb_ae (server, record_id, ...) SELECT ... FROM vw_ofch_prepal_delta, vw_ab_bie WHERE bie_tp IN ('S[*]') AND is_most_recent = 1; The statement is 4.004 characters long. The error is pointed by H2 as [*] (this is not part of the statement). 回答1: According to

H2 Schema initailization. Syntax error in SQL statement

最后都变了- 提交于 2020-07-29 12:23:27
问题 I have a spring boot application and I trying to initialize some data on application startup. This is my application properties: #Database connection spring.datasource.url=jdbc:h2:mem:test_db spring.datasource.username=... spring.datasource.password=... spring.datasource.driverClassName=org.h2.Driver spring.datasource.initialize=true spring.datasource.schema=schema.sql spring.datasource.data=schema.sql #Hibernate configuration #spring.jpa.hibernate.ddl-auto = none This is schema.sql: CREATE

not able to view h2 database web console and how to change the default h2 port

≡放荡痞女 提交于 2020-07-09 04:39:37
问题 I am new to H2 database. For the development purpose I would like to use H2 database and I am having trouble in configuring it with my spring boot web application. I have gone thru several tutorials and SO threads but none could solve my issue. Below are the trails that I have done and none was successful. Requirement : 1. H2 data base that I can view with web interface( console view) 2. I would like my data to be persisted even if I stop my running web application or even my machine(laptop)

How to fix: Embedded H2 Database “NonTransientError: Unable to read the page at position” error?

耗尽温柔 提交于 2020-07-08 09:24:13
问题 I am creating a JavaFX program with an embedded H2 database that will be used to handle user logins and passwords. Using Intellij Ultimate, I have a database that I can run from the toolbar. In addition, I am almost certain I have the correct JDBC driver and URL. The database runs fine from Intellij's database console. The error occurs when I try to access the database with Java code. I am using a database class to handle my database connection. I am receiving a JdbcSQLNonTransientException ,

No suitable driver found for jdbc:h2:tcp

感情迁移 提交于 2020-07-03 06:52:29
问题 an java.sql.SQLException: No suitable driver found for jdbc:h2:tcp://localhost/~/ZadatakDB is thrown when I try to connect to h2 database using a java web application. I can use H2 console without any issue, and pinging is successfull. I've also added h2-1.3.176 jar file to Libraries AND to WEB-INF/lib. Here is my Java method I am using to connect: private static Connection connectToDatabase() throws SQLException, IOException { String url = "jdbc:h2:tcp://localhost/~/ZadatakDB"; String

Hibernate 5 Multitenancy and H2 : ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Schema MYSCHEMA not found

回眸只為那壹抹淺笑 提交于 2020-06-29 04:43:10
问题 I am using Spring Framework test configuration (legacy app) Very strange behaviour of H2 database with Hibernate 5 multitenancy, I just added configuration to my tests, and the spring application context can't work : @Bean public static DataSource dataSource() { DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName("org.h2.Driver"); dataSource.setUrl("jdbc:h2:mem:db;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false"); dataSource.setUsername("sa");

SpringFramework: @Transactional(readOnly = true) not working with h2

非 Y 不嫁゛ 提交于 2020-06-27 09:10:26
问题 I am doing transaction testing with the SpringFramework. I have the following classes. UserService.class @Transactional public interface UserService { void add(User user); @Transactional(readOnly = true) User get(String id); @Transactional(readOnly = true) List<User> getAll(); void deleteAll(); void update(User user); } UserServiceImpl.class public class UserServiceImpl implements UserService { // skip some methods @Override public void update(User user) { userDao.update(user); } }

H2 not recognising regexp_like

半世苍凉 提交于 2020-06-26 04:06:15
问题 I have a query written to run on an Oracle database which uses the function REGEXP_LIKE to filter some rows from the query. The specific function call is regexp_like(col1, '[^[:alpha:]]') The problem is when I run the query on H2 I get the following error: org.h2.jdbc.JdbcSQLException: Function "REGEXP_LIKE" not found If I run the query directly on the Oracle database using the SQLDeveloper tool it returns as expected. Any ideas what could be causing this? 回答1: H2 doesn't have a function

Return primary key value generated by default in H2 database upon INSERT of new row, for UUID type column

时光怂恿深爱的人放手 提交于 2020-06-16 13:04:08
问题 When using a UUID data type as the primary key of a table, and asking H2 to generate each UUID value by default upon INSERT of a new record, how does one access the value of the newly generated UUID value? I am using plain JDBC 4.x in a Java app, if that helps with a solution. I know SCOPE_IDENTITY function returns a long for a key generated on a column marked as IDENTITY for an auto-incrementing sequence number. But I am using UUID rather than an incrementing number as my primary key column

Convert special String into Date in H2

牧云@^-^@ 提交于 2020-06-12 06:40:48
问题 There is a SQL function from Oracle to_date('26 Jul 2016, 05:15:58 AM','DD Mon YYYY, HH:MI:SS AM') , and it throws exception "Illegal pattern character 'o'" in H2. How shall I change it to make it work in H2? 回答1: The equivalent function of TO_DATE() in H2 is PARSEDATETIME() . This is how you should use it with your sample data: PARSEDATETIME('26 Jul 2016, 05:15:58 AM','dd MMM yyyy, hh:mm:ss a','en') Be careful not to use HH:mm:ss otherwise the AM/PM detection will not work. 回答2: Here is