How to Approach Java, Databases & SQL (for My Google Photos Clone)

preview_player
Показать описание
Part 4: We want to save our thumbnail data to a database, so that we can render our pictures to a nice HTML gallery page and finish the proof of concept for our Google Photos clone! Which database should we use and why? Which Java database API? What database tools will make our lives easier along the way? Find out in this episode of Marco Codes!

► Previous Episodes

► Source Repository
Branch: episode-4

► Timestamps
00:00 Intro
00:52 Where We Left Off
01:46 Setup
04:38 Writing a Database Schema
10:08 Creating a DataSource
12:46 Saving Thumbnail Data
14:00 Refactoring Maneuver
16:21 Extracting Image Creation Dates
17:10 Avoiding Duplication
19:04 Inspecting H2 File DBs
21:23 Rendering HTML Output
30:30 What’s Next?

► FOLLOW ME
Рекомендации по теме
Комментарии
Автор

Very useful tips and tricks, as always!

tipazas
Автор

Nice approach. I did something similar but I use Postgres, Spring Boot and Angular. In my case UI requests a list of photos from specific directory which is on my NAS. Spring Boot service then creates thumbnails on a fly using Thumbnailator component. I don’t save thumbnails on a disk, and instead I return them as data URL which can be then directly rendered in UI. Performance is not bad. Using bit of multithreading I was able to create 100 thumbnails typically in less than 5-6 seconds. In order not to delay the response, I initially return list of file names with only couple of other properties. That list then gets rendered in the browser with some default thumbnail (i.e. egg timer or similar). Then I push thumbnail data URL’s from the server to the client as they get created. Initially I used web sockets for this but then I found that server side events (SSE) are much better and simpler to implement for my use case. Once all thumbnails are received by UI it terminates SSE request.

brankokostic