H2 Database Quick Start Guide¶
๐ Getting Started¶
Run the Application¶
That's it! The application starts with H2 database automatically initialized with sample data.
๐๏ธ Access H2 Console¶
URL: http://localhost:8080/h2-console
Login Credentials:
- JDBC URL: jdbc:h2:mem:sampledb
- Username: sa
- Password: (leave empty)
Click Connect to access the database console.
๐ Sample Data Available¶
Products Table (10 items)¶
- Scooby Doo series toys (5 items)
- Cars series toys (5 items)
Insurance Members Table (1 member)¶
- John Deer with 3 policies and 6 plans
๐ Useful SQL Queries¶
View All Products¶
View All Members¶
View Member Policies¶
View Policy Plans¶
Search Products by Name¶
๐งช Run Tests¶
All repository tests now pass automatically!
๐ณ Docker Deployment¶
# Build and start
docker-compose up -d
# View logs
docker-compose logs -f
# Stop
docker-compose down
๐ Key Features¶
โ
No Setup Required - Database is embedded
โ
Auto-Initialized - Sample data loaded on startup
โ
Web Console - Inspect data via browser
โ
Fast Tests - No external dependencies
โ
Self-Contained - Perfect for demos
๐ API Endpoints¶
- Swagger UI: http://localhost:8080/swagger-ui.html
- Health Check: http://localhost:8080/actuator/health
- H2 Console: http://localhost:8080/h2-console
๐ More Information¶
See H2_MIGRATION.md for complete migration details.