To create a Java program that interacts with a Cassandra database, you'll need to follow these steps:

1. Install and set up the Cassandra database.
2. Create a keyspace and table in Cassandra for storing book information.
3. Add the DataStax Java Driver for Apache Cassandra as a dependency in your Java project.
4. Write Java code to connect to the Cassandra database, insert data, and retrieve data.

Here's an example of how to accomplish this:

**Step 1: Install and set up the Cassandra database**

Follow the instructions on the official [Cassandra website](http://cassandra.apache.org/doc/latest/getting_started/installing.html) to install and start the Cassandra database.

**Step 2: Create a keyspace and table in Cassandra**

Open the `cqlsh` command-line tool by running `cqlsh` in your terminal or command prompt. Then execute the following commands to create a keyspace and table for storing book information:

```sql
CREATE KEYSPACE IF NOT EXISTS library WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};

USE library;

CREATE TABLE IF NOT EXISTS books (
    id UUID PRIMARY KEY,
    title TEXT,
    author TEXT,
    publication_date DATE,
    genre TEXT
);
```

**Step 3: Add the DataStax Java Driver for Apache Cassandra as a dependency**

Add the following Maven dependency to your `pom.xml` file:

```xml
<dependencies>
    ...
    <dependency>
        <groupId>com.datastax.oss</groupId>
        <artifactId>java-driver-core</artifactId>
        <version>4.13.0</version>
    </dependency>
    ...
</dependencies>
```

Or add the following Gradle dependency to your `build.gradle` file:

```groovy
dependencies {
    ...
    implementation 'com.datastax.oss:java-driver-core:4.13.0'
    ...
}
```

**Step 4: Write Java code to connect, insert data, and retrieve data**

Create a new Java class called `CassandraBooksExample` with the following content:

```java
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import com.datastax.oss.driver.api.core.cql.Row;

import java.time.LocalDate;
import java.util.UUID;

public class CassandraBooksExample {

    public static void main(String[] args) {
        // Connect to the Cassandra database
        try (CqlSession session = CqlSession.builder().withKeyspace("library").build()) {
            // Insert a book into the books table
            UUID bookId = UUID.randomUUID();
            String title = "The Catcher in the Rye";
            String author = "J.D. Salinger";
            LocalDate publicationDate = LocalDate.of(1951, 7, 16);
            String genre = "Fiction";

            String insertQuery = "INSERT INTO books (id, title, author, publication_date, genre) VALUES (?, ?, ?, ?, ?)";
            session.execute(insertQuery, bookId, title, author, publicationDate, genre);

            System.out.println("Inserted book: " + title);

            // Retrieve all books from the books table
            ResultSet resultSet = session.execute("SELECT * FROM books");

            System.out.println("\nRetrieved books:");
            for (Row row : resultSet) {
                System.out.printf("%s by %s (%s) - Genre: %s%n",
                        row.getString("title"),
                        row.getString("author"),
                        row.getLocalDate("publication_date"),
                        row.getString("genre"));
            }
        }
    }
}
```

Run the `CassandraBooksExample` class, and you should see output similar to the following:

```
Inserted book: The Catcher in the Rye

Retrieved books:
The Catcher in the Rye by J.D. Salinger (1951-07-16) - Genre: Fiction
```

This example demonstrates how to connect to a Cassandra database, insert data into the `books` table, and retrieve all rows from the table using the DataStax Java Driver for Apache Cassandra.
Cassandra 데이터베이스와 상호 작용하는 Java 프로그램을 생성하려면 다음 단계를 따라야 합니다.

1. Cassandra 데이터베이스를 설치하고 설정합니다.
2. 책 정보를 저장할 키 공간과 테이블을 Cassandra에 생성합니다.
3. Java 프로젝트에 아파치 카산드라용 데이터스택스 자바 드라이버를 종속성으로 추가합니다.
4. Cassandra 데이터베이스에 연결하고, 데이터를 삽입하고, 데이터를 검색하는 Java 코드를 작성합니다.

이 작업을 수행하는 방법의 예는 다음과 같습니다.

**1단계: Cassandra 데이터베이스 설치 및 설정**

공식 [Cassandra 웹사이트](http://cassandra. apache.org/doc/latest/getting_started/installing.html)의 지침에 따라 Cassandra 데이터베이스를 설치하고 시작합니다.

**2단계: Cassandra에서 키 공간 및 테이블 생성**

터미널 또는 명령 프롬프트에서 `cqlsh`를 실행하여 `cqlsh` 명령줄 툴을 엽니다. 그런 다음 다음 명령을 실행하여 책 정보를 저장할 키 공간과 테이블을 만듭니다:

```sql
CREATE KEYSPACE IF NOT EXISTS library WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};

USE library;

CREATE TABLE IF NOT EXISTS books (
    id UUID PRIMARY KEY,
    title TEXT,
    author TEXT,
    publication_date DATE,
    genre TEXT
);
```

**3단계: Apache Cassandra용 DataStax Java 드라이버를 종속성으로 추가합니다**

pom.xml` 파일에 다음 Maven 종속성을 추가합니다:

```xml
<dependencies>
    ...
    <dependency>
        <groupId>com.datastax.oss</groupId>
        <artifactId>java-driver-core</artifactId>
        <version>4.13.0</version>
    </dependency>
    ...
</dependencies>
```

또는 `build.gradle` 파일에 다음 Gradle 종속성을 추가합니다:

```groovy
dependencies {
    ...
    implementation 'com.datastax.oss:java-driver-core:4.13.0'
    ...
}
```

**4단계: 연결, 데이터 삽입 및 데이터 검색을 위한 Java 코드 작성**

다음 내용을 포함하는 `CassandraBooksExample`이라는 새 Java 클래스를 만듭니다:

```java
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import com.datastax.oss.driver.api.core.cql.Row;

import java.time.LocalDate;
import java.util.UUID;

public class CassandraBooksExample {

    public static void main(String[] args) {
        // Connect to the Cassandra database
        try (CqlSession session = CqlSession.builder().withKeyspace("library").build()) {
            // Insert a book into the books table
            UUID bookId = UUID.randomUUID();
            String title = "The Catcher in the Rye";
            String author = "J.D. Salinger";
            LocalDate publicationDate = LocalDate.of(1951, 7, 16);
            String genre = "Fiction";

            String insertQuery = "INSERT INTO books (id, title, author, publication_date, genre) VALUES (?, ?, ?, ?, ?)";
            session.execute(insertQuery, bookId, title, author, publicationDate, genre);

            System.out.println("Inserted book: " + title);

            // Retrieve all books from the books table
            ResultSet resultSet = session.execute("SELECT * FROM books");

            System.out.println("\nRetrieved books:");
            for (Row row : resultSet) {
                System.out.printf("%s by %s (%s) - Genre: %s%n",
                        row.getString("title"),
                        row.getString("author"),
                        row.getLocalDate("publication_date"),
                        row.getString("genre"));
            }
        }
    }
}
```

`CassandraBooksExample` 클래스를 실행하면 다음과 비슷한 출력이 표시됩니다:

```
Inserted book: The Catcher in the Rye

Retrieved books:
The Catcher in the Rye by J.D. Salinger (1951-07-16) - Genre: Fiction
```

이 예제에서는 Apache Cassandra용 DataStax Java 드라이버를 사용하여 Cassandra 데이터베이스에 연결하고, 'books` 테이블에 데이터를 삽입하고, 테이블에서 모든 행을 검색하는 방법을 보여 줍니다.