To create a Java application that connects to an Azure SQL Database and performs basic CRUD operations, you can follow these steps:

1. Install the necessary tools and libraries
2. Set up your Azure SQL Database
3. Configure environment variables
4. Write the Java code

### 1. Install the necessary tools and libraries

First, make sure you have installed the following tools on your system:

- Java Development Kit (JDK) version 8 or later: https://www.oracle.com/java/technologies/javase-downloads.html
- Apache Maven for building the project: https://maven.apache.org/download.cgi

Next, add the JDBC driver for SQL Server as a dependency in your `pom.xml` file:

```xml
<dependencies>
    <dependency>
        <groupId>com.microsoft.sqlserver</groupId>
        <artifactId>mssql-jdbc</artifactId>
        <version>9.4.0.jre11</version>
    </dependency>
</dependencies>
```

### 2. Set up your Azure SQL Database

Follow the instructions provided by Microsoft to create an Azure SQL Database and obtain the connection string:

https://docs.microsoft.com/en-us/azure/sql-database/sql-database-single-database-get-started?tabs=azure-portal

### 3. Configure environment variables

Set the following environment variables with the appropriate values from your Azure SQL Database connection string:

- `AZURE_SQL_SERVER`: The server name
- `AZURE_SQL_DATABASE`: The database name
- `AZURE_SQL_USER`: The username
- `AZURE_SQL_PASSWORD`: The password

### 4. Write the Java code

Create a class called `DatabaseManager` to handle the database connection and CRUD operations:

```java
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class DatabaseManager {
    private Connection connection;

    public void connect() throws SQLException {
        String server = System.getenv("AZURE_SQL_SERVER");
        String database = System.getenv("AZURE_SQL_DATABASE");
        String user = System.getenv("AZURE_SQL_USER");
        String password = System.getenv("AZURE_SQL_PASSWORD");

        String connectionString = "jdbc:sqlserver://" + server + ";database=" + database + ";user=" + user + ";password=" + password;
        connection = DriverManager.getConnection(connectionString);
    }

    // Implement CRUD operations here
}
```

Now you can implement the CRUD operations as methods in the `DatabaseManager` class. For example, to create a table called `Person` with columns for name and age:

```java
public void createTable() throws SQLException {
    String sql = "CREATE TABLE Person (id INT PRIMARY KEY IDENTITY(1, 1), name NVARCHAR(50) NOT NULL, age INT NOT NULL)";
    try (Statement statement = connection.createStatement()) {
        statement.execute(sql);
    }
}

public void insertPerson(String name, int age) throws SQLException {
    String sql = "INSERT INTO Person (name, age) VALUES ('" + name + "', " + age + ")";
    try (Statement statement = connection.createStatement()) {
        statement.executeUpdate(sql);
    }
}

public void updatePerson(int id, String newName, int newAge) throws SQLException {
    String sql = "UPDATE Person SET name='" + newName + "', age=" + newAge + " WHERE id=" + id;
    try (Statement statement = connection.createStatement()) {
        statement.executeUpdate(sql);
    }
}

public void deletePerson(int id) throws SQLException {
    String sql = "DELETE FROM Person WHERE id=" + id;
    try (Statement statement = connection.createStatement()) {
        statement.executeUpdate(sql);
    }
}

public void listPersons() throws SQLException {
    String sql = "SELECT * FROM Person";
    try (Statement statement = connection.createStatement()) {
        ResultSet resultSet = statement.executeQuery(sql);
        while (resultSet.next()) {
            int id = resultSet.getInt("id");
            String name = resultSet.getString("name");
            int age = resultSet.getInt("age");
            System.out.println(id + ": " + name + ", " + age);
        }
    }
}
```

Finally, create a `Main` class to provide a simple text-based user interface for interacting with the data:

```java
import java.sql.SQLException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        DatabaseManager dbManager = new DatabaseManager();
        Scanner scanner = new Scanner(System.in);

        try {
            dbManager.connect();

            // Example usage of CRUD operations:
            dbManager.createTable();
            dbManager.insertPerson("John Doe", 30);
            dbManager.updatePerson(1, "Jane Doe", 28);
            dbManager.deletePerson(2);
            dbManager.listPersons();

        } catch (SQLException e) {
            e.printStackTrace();
        }

        scanner.close();
    }
}
```

Now you can build and run your Java application using Maven:

```
mvn clean compile exec:java
```

This will connect to your Azure SQL Database, perform the specified CRUD operations, and display the results in the console.
Azure SQL 데이터베이스에 연결하고 기본 CRUD 작업을 수행하는 Java 애플리케이션을 만들려면 다음 단계를 수행하면 됩니다.

1. 필요한 도구 및 라이브러리 설치
2. Azure SQL 데이터베이스 설정
3. 환경 변수 구성
4. Java 코드 작성

### 1. 필요한 도구 및 라이브러리 설치

먼저, 시스템에 다음 도구가 설치되어 있는지 확인합니다.

- Java 개발 키트(JDK) 버전 8 이상: https://www.oracle.com/java/technologies/javase-downloads.html
- 프로젝트 빌드를 위한 Apache Maven: https://maven.apache.org/download.cgi

다음, `pom.xml` 파일에 SQL Server용 JDBC 드라이버를 종속 요소로 추가합니다:

```xml
<dependencies>
    <dependency>
        <groupId>com.microsoft.sqlserver</groupId>
        <artifactId>mssql-jdbc</artifactId>
        <version>9.4.0.jre11</version>
    </dependency>
</dependencies>
```

### 2. Azure SQL 데이터베이스 설정

마이크로소프트에서 제공한 지침에 따라 Azure SQL 데이터베이스를 생성하고 연결 문자열을 얻습니다:

https://docs.microsoft.com/en-us/azure/sql-database/sql-database-single-database-get-started?tabs=azure-portal

### 3. 환경 변수 구성

다음 환경 변수를 Azure SQL 데이터베이스 연결 문자열에서 적절한 값으로 설정합니다:

- `AZURE_SQL_SERVER`: 서버 이름
- `AZURE_SQL_DATABASE`: 데이터베이스 이름
- `AZURE_SQL_USER`: 사용자 이름
- `AZURE_SQL_PASSWORD`: 비밀번호

### 4. Java 코드 작성

데이터베이스 연결 및 CRUD 작업을 처리하기 위해 `DatabaseManager`라는 클래스를 생성합니다:

```java
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class DatabaseManager {
    private Connection connection;

    public void connect() throws SQLException {
        String server = System.getenv("AZURE_SQL_SERVER");
        String database = System.getenv("AZURE_SQL_DATABASE");
        String user = System.getenv("AZURE_SQL_USER");
        String password = System.getenv("AZURE_SQL_PASSWORD");

        String connectionString = "jdbc:sqlserver://" + server + ";database=" + database + ";user=" + user + ";password=" + password;
        connection = DriverManager.getConnection(connectionString);
    }

    // Implement CRUD operations here
}
```

이제 `DatabaseManager` 클래스에서 CRUD 작업을 메서드로 구현할 수 있습니다. 예를 들어, 이름과 나이에 대한 열이 있는 `Person`이라는 테이블을 만들 수 있습니다:

```java
public void createTable() throws SQLException {
    String sql = "CREATE TABLE Person (id INT PRIMARY KEY IDENTITY(1, 1), name NVARCHAR(50) NOT NULL, age INT NOT NULL)";
    try (Statement statement = connection.createStatement()) {
        statement.execute(sql);
    }
}

public void insertPerson(String name, int age) throws SQLException {
    String sql = "INSERT INTO Person (name, age) VALUES ('" + name + "', " + age + ")";
    try (Statement statement = connection.createStatement()) {
        statement.executeUpdate(sql);
    }
}

public void updatePerson(int id, String newName, int newAge) throws SQLException {
    String sql = "UPDATE Person SET name='" + newName + "', age=" + newAge + " WHERE id=" + id;
    try (Statement statement = connection.createStatement()) {
        statement.executeUpdate(sql);
    }
}

public void deletePerson(int id) throws SQLException {
    String sql = "DELETE FROM Person WHERE id=" + id;
    try (Statement statement = connection.createStatement()) {
        statement.executeUpdate(sql);
    }
}

public void listPersons() throws SQLException {
    String sql = "SELECT * FROM Person";
    try (Statement statement = connection.createStatement()) {
        ResultSet resultSet = statement.executeQuery(sql);
        while (resultSet.next()) {
            int id = resultSet.getInt("id");
            String name = resultSet.getString("name");
            int age = resultSet.getInt("age");
            System.out.println(id + ": " + name + ", " + age);
        }
    }
}
```

마지막으로, 데이터와 상호 작용할 수 있는 간단한 텍스트 기반 사용자 인터페이스를 제공하는 `Main` 클래스를 만듭니다:

```java
import java.sql.SQLException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        DatabaseManager dbManager = new DatabaseManager();
        Scanner scanner = new Scanner(System.in);

        try {
            dbManager.connect();

            // Example usage of CRUD operations:
            dbManager.createTable();
            dbManager.insertPerson("John Doe", 30);
            dbManager.updatePerson(1, "Jane Doe", 28);
            dbManager.deletePerson(2);
            dbManager.listPersons();

        } catch (SQLException e) {
            e.printStackTrace();
        }

        scanner.close();
    }
}
```

이제 Maven을 사용하여 Java 애플리케이션을 빌드하고 실행할 수 있습니다:

```
mvn clean compile exec:java
```

그러면 Azure SQL 데이터베이스에 연결하여 지정된 CRUD 작업을 수행한 후 콘솔에 결과를 표시합니다.