import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class AddCameraOrientationColumns { public static void main(String[] args) { String url = "jdbc:dm://192.168.0.145:30236?charSet=utf8"; String username = "WATERSHED"; String password = "WaterShed./1224"; try (Connection conn = DriverManager.getConnection(url, username, password); Statement stmt = conn.createStatement()) { // 添加第三人称相机朝向字段 String addHeadingSql = "ALTER TABLE BUSINESS_SCENE ADD COLUMN THIRD_PERSON_CAMERA_HEADING DECIMAL(10,6)"; String addPitchSql = "ALTER TABLE BUSINESS_SCENE ADD COLUMN THIRD_PERSON_CAMERA_PITCH DECIMAL(10,6)"; String addRollSql = "ALTER TABLE BUSINESS_SCENE ADD COLUMN THIRD_PERSON_CAMERA_ROLL DECIMAL(10,6)"; try { stmt.execute(addHeadingSql); System.out.println("成功添加 THIRD_PERSON_CAMERA_HEADING 字段"); } catch (SQLException e) { System.out.println("THIRD_PERSON_CAMERA_HEADING 字段已存在,跳过"); } try { stmt.execute(addPitchSql); System.out.println("成功添加 THIRD_PERSON_CAMERA_PITCH 字段"); } catch (SQLException e) { System.out.println("THIRD_PERSON_CAMERA_PITCH 字段已存在,跳过"); } try { stmt.execute(addRollSql); System.out.println("成功添加 THIRD_PERSON_CAMERA_ROLL 字段"); } catch (SQLException e) { System.out.println("THIRD_PERSON_CAMERA_ROLL 字段已存在,跳过"); } System.out.println("所有字段添加完成!"); } catch (SQLException e) { e.printStackTrace(); } } }