LoginSignup
0
0

H2データベースのコンソール使用方法

Posted at

Spring boot を用いてWEBアプリを作成しており、テスト用のデータベースとしてH2を使用している際にH2コンソールへアクセスする方法を記述する。

yamlファイルの設定内容

application.yaml
spring:
  datasource:
    url: jdbc:h2:mem:test
    driverClassName: org.h2.Driver
    username: sa
    password:
  h2.console.enabled: true

H2コンソール接続用のURL

ブラウザを起動し以下URLで接続。

http://localhost:8080/h2-console

コンソールアクセス後のログイン方法

コンソール起動後はymlファイルに記載のURL、ユーザーネーム、パスワードでログインできる。
今回のケースであれば以下を入力する。

画面項目 入力値
JDBC URL jdbc:h2:mem:test
User Name sa
Password (入力不要)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0