h2

spring boot default H2 jdbc connection (and H2 console)

狂风中的少年 提交于 2019-11-26 15:01:42
问题 I am simply trying to see the H2 database content for an embedded H2 database which spring-boot creates when I don't specify anything in my application.properties and start with mvn spring:run. I can see hibernate JPA creating the tables but if I try to access the h2 console at the URL below the database has no tables. http://localhost:8080/console/ I see suggestions like this one: View content of embedded H2 database started by Spring But I don't know where to put the suggested XML in spring

H2 Database vs SQLite on Android

泪湿孤枕 提交于 2019-11-26 14:07:56
问题 Because of the lack of Unicode support on the embedded SQLite database in Android I am mostly interested in performance and stability of H2 Database vs Android SQLite Are you guys using it? Should I be aware of any H2 database shortcomings? 回答1: Things are much better than I have expected. I now have an Android phone (HTC Desire, Android 2.2) and I made a first test. Opening and closing a database is relatively slow so far (opening an existing database for the second time takes 0.2 seconds,

Spring Boot 2 实战:使用 Flyway 管理你数据库的版本变更

微笑、不失礼 提交于 2019-11-26 11:26:10
1. 前言 随着项目的不断迭代,数据库表结构、数据都在发生着变化。甚至有的业务在多环境版本并行运行。数据为王的时代,管理好数据库的版本也成为了迫切的需要。如何能做到像 Git 之类的版本控制工具来管理数据库? Java 项目中常用 Flyway 和 Liquibase 来管理数据库版本。其中 Flyway 相对来说比较受欢迎。 2. Flyway 的特点 Flyway 大受欢迎是因为它具有以下优点: 简单 非常容易安装和学习,同时迁移的方式也很容易被开发者接受。 专一 专注于搞数据库迁移、版本控制而并没有其它副作用。 强大 专为连续交付而设计。让Flyway在应用程序启动时迁移数据库。 3. Flyway 的工作机制 Flyway 需要在 DB 中先创建一个 metadata 表 (缺省表名为 flyway_schema_history ), 在该表中保存着每次 migration (迁移)的记录, 记录包含 migration 脚本的版本号和 SQL 脚本的 checksum 值。下图表示了多个数据库版本。 对应的 metadata 表记录: installed_rank version description type script checksum installed_by installed_on execution_time success 1 1 Initial

How to find rows in one table that have no corresponding row in another table

烂漫一生 提交于 2019-11-26 10:33:59
问题 I have a 1:1 relationship between two tables. I want to find all the rows in table A that don\'t have a corresponding row in table B. I use this query: SELECT id FROM tableA WHERE id NOT IN (SELECT id FROM tableB) ORDER BY id desc id is the primary key in both tables. Apart from primary key indices, I also have a index on tableA(id desc). Using H2 (Java embedded database), this results in a full table scan of tableB. I want to avoid a full table scan. How can I rewrite this query to run

How to access in memory h2 database of one spring boot application from another spring boot application

↘锁芯ラ 提交于 2019-11-26 09:48:53
问题 In my project, i have created 3 spring boot application. First spring boot application has h2 embedded database. Now i want to access this database from my 2nd and 3rd spring boot application directly without writing any services to get this data. So can anyone tell me how can i achieve this? 回答1: You can setup H2 Server as Spring Bean. First edit pom.xml - delete <scope>runtime</scope> from h2 dependency: <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> </dependency

H2 in-memory database. Table not found

爱⌒轻易说出口 提交于 2019-11-26 03:06:57
问题 I\'ve got a H2 database with URL \"jdbc:h2:test\" . I create a table using CREATE TABLE PERSON (ID INT PRIMARY KEY, FIRSTNAME VARCHAR(64), LASTNAME VARCHAR(64)); . I then select everything from this (empty) table using SELECT * FROM PERSON . So far, so good. However, if I change the URL to \"jdbc:h2:mem:test\" , the only difference being the database is now in memory only, this gives me an org.h2.jdbc.JdbcSQLException: Table \"PERSON\" not found; SQL statement: SELECT * FROM PERSON [42102-154