All Questions

Tagged with
Filter by
Sorted by
Tagged with
34votes
3answers
47kviews

create if not exists view?

Is there any way to create view if not exists in MySQL or H2 Database?
user avatar
23votes
4answers
24kviews

Convert MySQL script to H2

I have an init script for my MySQL database but for test purposes I wan't to use a H2 database. Anyone knows how to convert the file or at least has a list of the syntax differences ? thanks.
user avatar
21votes
5answers
32kviews

How to add the mode=mysql to embedded H2 DB in Spring Boot 1.4.1 for @DataJpaTest?

I have some problems with using a schema.sql file to create my sql schema when executing a junit test while this schema contains mysql specific expression. I have to add the mode=mysql to the H2 url. ...
user avatar
  • 219
19votes
1answer
4kviews

How to use "on update CURRENT_TIMESTAMP" in H2 database with JUnit?

I want my entity to have a modification timestamp whenever it is updated. mysql supports this using the following definition: @Entity public class MyTable { @Column(columnDefinition = "TIMESTAMP ...
user avatar
  • 72.8k
17votes
2answers
8kviews

H2 update with join

As development DB I am using MySQL, and for tests I am using H2 database. The following script works in MySQL very well, but it is fails on H2. UPDATE `table_a` JOIN `table_b` ON `table_a`.id=`...
user avatar
  • 819
15votes
3answers
5kviews

IF function in H2 for MySQL compatibility

I'm using H2 (with MySQL compatibility mode) to write some automated tests against our software that uses MySQL. Unfortunately, it seems like H2 does not have have the IF function that many of our ...
user avatar
  • 9,140
13votes
2answers
6kviews

DATE_SUB and DATE_ADD in H2 for MySQL

I am using MySQL as my database and H2 for testing. I am also using playframework 2.3.x and Scala, but I think does not matter for the question purpose. H2 has a conflict with some functions that I ...
user avatar
  • 5,627
12votes
5answers
16kviews

How to replace enum type in H2 database?

MySQL dialect: CREATE TABLE My_Table ( my_column enum ('first', 'second', ... 'last')); H2 dialect: CREATE TABLE My_Table ( my_column ? ('first', 'second', ... 'last')); What type is equivalent in ...
user avatar
11votes
2answers
7kviews

H2 "runscript" command turns all table names into uppercase

I have a sql script (it is just schema definition). The script is a modified version (getting rid of the bad characters h2 doesn't like) of a mysql dumb. The script runs and the schema is inserted ...
user avatar
  • 9,368
9votes
5answers
26kviews

How to convert H2Database database file to MySQL database .sql file?

I have some data in H2Database file and I want to convert it to MySQL .sql database file. What are the methods I can follow?
user avatar
9votes
5answers
7kviews

How to write a null safe compare "<=>" in pure SQL?

In Mysql there is a compare operator that is a null safe: <=>. I use this in my Java program when creating prepared statements like this: String routerAddress = getSomeValue(); String sql = "...
user avatar
9votes
0answers
2kviews

Join deletion with same syntax in mysql and h2

I have a production database in mysql and do some Junit tests in H2. I am struggling to find a syntax that would both work in tests and production to delete records in 2 tables. SQL queries are sent ...
user avatar
  • 5,331
8votes
0answers
1kviews

ON DUPLICATE KEY support in H2

I use h2 for testing purpose in a Spring Boot (& spring data JPA) application. I'm storing some sort of statistic per day, and therefore I set up ON DUPLICATE KEY UPDATE queries to store those ...
user avatar
  • 1,470
7votes
1answer
15kviews

How to find the active number of open database connections in H2/MySQL

How to find the active number of open database connections in H2/MySQL. We need this information to identify if there are any connection leaks.
user avatar
  • 13.4k
7votes
1answer
14kviews

H2 and MySQL compatibility issues

i am using H2 for my integration tests with Liquibase and it seems that there are compatibility issues. A simple change column function does not pass on H2 where it works perfectly on MySQL ...
user avatar
  • 9,895

15 30 50 per page
1
2 3 4 5
17