您的位置:首页 > 编程语言 > Java开发

springboot--h2 嵌入式数据库的使用

2017-12-13 20:43 555 查看

springboot–h2 嵌入式数据库的使用

springbooth2 嵌入式数据库的使用
添加依赖

配置
指定路径

内存模式

进入控制台

添加依赖

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>


配置

spring.datasource.url=jdbc:h2:~/test;AUTO_SERVER=TRUE;DB_CLOSE
_ON_EXIT=FALSE
spring.datasource.username=sa
spring.datasource.password=


注: 1.”~”这个符号代表的就是当前登录到操作系统的用户对应的用户目录 2.账号密码我们指定之后,就会自动创建

========================================================

指定路径:

spring.datasource.url=jdbc:h2:file:D:/roncoo_h2/roncoo_spring_boot;AUTO_SERVER=TRUE;DBCLOSE_ON_EXIT=FALSE

内存模式:

spring.datasource.url=jdbc:h2:mem:test

进入控制台

路径:http://localhost:8080/h2-console
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  数据库 spring-boot