h2記憶體資料庫和mysql資料庫的區別

2021-06-23 04:55:17 字數 1388 閱讀 2384

h2不支援以下配置:

engine=innodb default charset=utf8 comment '使用者表';

h2記憶體資料庫:

drop table if exists 'q_user';

create table `q_user` (

`id` int(11) not null auto_increment comment '自增主鍵',

`user_id` varchar(32) not null comment '使用者唯一標識',

`nickname` varchar(32) not null comment '暱稱',

`realname` varchar(32) not null comment '真實姓名',

`password` varchar(50) not null comment '密碼',

`email` varchar(64) not null comment '郵箱',

`status` tinyint(2) not null comment '狀態,1為有效,2為已刪除',

`last_login_time` timestamp not null comment '最後一次登陸時間',

primary key (`id`),

unique key `uniq_user_id` (`user_id`)

);

mysql資料庫:

create table `q_user` (

`id` int(11) not null auto_increment comment '自增主鍵',

`user_id` varchar(32) not null comment '使用者唯一標識',

`nickname` varchar(32) not null comment '暱稱',

`realname` varchar(32) not null comment '真實姓名',

`password` varchar(50) not null comment '密碼',

`email` varchar(64) not null comment '郵箱',

`status` tinyint(2) not null comment '狀態,1為有效,2為已刪除',

`last_login_time` timestamp not null comment '最後一次登陸時間',

primary key (`id`),

unique key `uniq_user_id` (`user_id`)

) engine=innodb default charset=utf8 comment '使用者表';

配置h2資料庫

1.新增依賴 com.h2database h21.4.178 2.修改資料庫配置的properties檔案,主要是jdbc.drivername和jdbc.url jdbc.drivername org.h2.driver jdbc.url jdbc h2 mem demo mode mysql ...

在Spring Boot使用H2記憶體資料庫

在spring boot使用h2記憶體資料庫 要想使用h2,我們需要新增如下配置 org.springframework.bootgroupid spring boot starter data jpaartifactid dependency com.h2databasegroupid h2art...

H2資料庫的應用

h2是乙個j a編寫的關係型資料庫,它可以被嵌入j a應用程式中使用,或者作為乙個單獨的資料庫伺服器執行。在啟動安裝程式前面,確保pc上已經存在jdk,安裝過程中配置預設就行,當然也可以自己選擇安裝路徑。我這裡選擇安裝到e盤,安裝後h2的目錄如下 在bin目錄下有乙個h2 2.1.210.jar的包...