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

public class AddTitleField {
    public static void main(String[] args) {
        String url = "jdbc:mysql://172.28.135.68:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8";
        String username = "root";
        String password = "123456";
        
        Connection connection = null;
        Statement statement = null;
        
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            connection = DriverManager.getConnection(url, username, password);
            statement = connection.createStatement();
            
            String sql = "ALTER TABLE introduction ADD COLUMN title VARCHAR(200) NOT NULL COMMENT 'title' AFTER intro_id";
            statement.executeUpdate(sql);
            
            System.out.println("Success: title column added");
            
        } catch (Exception e) {
            System.out.println("Error: " + e.getMessage());
        } finally {
            try {
                if (statement != null) statement.close();
                if (connection != null) connection.close();
            } catch (Exception e) {
            }
        }
    }
}
