@@ -0,0 +1,106 @@
+package chess.database.dao;
+
+import chess.dto.game.ChessGameLoadDto;
+import chess.dto.game.ChessGameSaveDto;
+
+import java.sql.*;
+import java.util.ArrayList;
+import java.util.List;
+
+public final class DbChessGameDao implements ChessDao {
+
+    private final String url;
+    private final String user;
+    private final String password;
+
+    public DbChessGameDao(final String url, final String user, final String password) {
+        this.url = url;
+        this.user = user;
+        this.password = password;
+    }
+
+    private Connection getConnection() {
+        try {
+            return DriverManager.getConnection(url, user, password);
+        } catch (SQLException e) {
+//            throw new RuntimeException(e);
+            return null;
+        }
+    }
+
+    @Override
+    public void save(final ChessGameSaveDto dto) {
+        final String sql = "INSERT INTO chess_game(piece_type, piece_file, piece_rank, piece_team, last_turn) VALUES (?, ?, ?, ?, ?)";
+        try (final Connection connection = getConnection();
+             final PreparedStatement preparedStatement = connection.prepareStatement(sql);
+        ) {
+            for (int i = 0; i < dto.getSize(); i++) {
+                preparedStatement.setString(1, dto.getPieceTypes().get(i));
+                preparedStatement.setString(2, dto.getPieceFiles().get(i));
+                preparedStatement.setString(3, dto.getPieceRanks().get(i));
+                preparedStatement.setString(4, dto.getPieceTeams().get(i));
+                preparedStatement.setString(5, dto.getLastTurns().get(i));
+                preparedStatement.executeUpdate();
+            }
+        } catch (SQLException e) {
+            throw new RuntimeException(e);
+        } catch (NullPointerException ignored) {
+        }
+    }
+
+    @Override
+    public ChessGameLoadDto loadGame() {
+        final String sql = "SELECT piece_type, piece_file, piece_rank, piece_team, last_turn FROM chess_game";
+        try (final Connection connection = getConnection();
+             final PreparedStatement preparedStatement = connection.prepareStatement(sql);
+             final ResultSet resultSet = preparedStatement.executeQuery();
+        ) {
+            final List<String> pieceType = new ArrayList<>();
+            final List<String> pieceFile = new ArrayList<>();
+            final List<String> pieceRanks = new ArrayList<>();
+            final List<String> pieceTeams = new ArrayList<>();
+            String lastTurn = "";
+
+            while (resultSet.next()) {
+                pieceType.add(resultSet.getString("piece_type"));
+                pieceFile.add(resultSet.getString("piece_file"));
+                pieceRanks.add(resultSet.getString("piece_rank"));
+                pieceTeams.add(resultSet.getString("piece_team"));
+                lastTurn = resultSet.getString("last_turn");
+            }
+            return new ChessGameLoadDto(pieceType, pieceFile, pieceRanks, pieceTeams, lastTurn);
+        } catch (SQLException e) {
+            throw new RuntimeException(e);
+        } catch (NullPointerException e) {
+            return null;
+        }
+    }
+
+    @Override
+    public boolean hasHistory() {
+        final String sql = "SELECT piece_type, piece_file, piece_rank, piece_team, last_turn FROM chess_game";
+        try (final Connection connection = getConnection();
+             final PreparedStatement preparedStatement = connection.prepareStatement(sql);
+             final ResultSet resultSet = preparedStatement.executeQuery();
+        ) {
+            return resultSet.next();
+        } catch (SQLException e) {
+            throw new RuntimeException(e);
+        } catch (NullPointerException e) {
+            return false;
+        }
+    }
+
+    @Override
+    public void delete() {
+        final String sql = "DELETE FROM chess_game";
+        try (final Connection connection = getConnection();
+             final PreparedStatement preparedStatement = connection.prepareStatement(sql)
+        ) {
+            preparedStatement.executeUpdate();
+        } catch (SQLException e) {
+            throw new RuntimeException(e);
+        } catch (NullPointerException ignored) {
+        }
+    }
+}

리뷰: Jdbc Connection 관리를 Dao에서 해주고 계시네요! 그런데 관리해야 할 테이블이 늘어나서 여러 Dao 객체가 생겨나게 되면 중복되는 코드외 인스턴스 변수들이 발생하게 될 것 같아요.

저도 체스미션을 진행하며 리뷰어분께 리뷰받은 사항인데 DB Connection과 같은 resource 관리 코드를 Util 클래스 등으로 구분해서 관리해보시는 건 어떨지 제안드려봅니다!