@@ -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) {
+        }
+    }
+}

리뷰: Dao에서 NullPointerException을 무시하는 것은 리뷰어를 위한 배려일까요? ㅎㅎ 그게 아니라면 어떤 의도로 예외를 무시처리해주신 건지 궁금합니다~