TestModelFields.java 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import java.sql.Connection;
  2. import java.sql.DriverManager;
  3. import java.sql.Statement;
  4. import java.sql.ResultSet;
  5. public class TestModelFields {
  6. public static void main(String[] args) {
  7. try {
  8. Class.forName("dm.jdbc.driver.DmDriver");
  9. String url = "jdbc:dm://192.168.0.145:30236?charSet=utf8";
  10. String username = "WATERSHED";
  11. String password = "WaterShed./1224";
  12. Connection conn = DriverManager.getConnection(url, username, password);
  13. Statement stmt = conn.createStatement();
  14. // 查询所有模型的字段情况
  15. String selectSql = "SELECT model_id, model_name, model_coordinates, rotation_x, rotation_y, rotation_z, scale_x, scale_y, scale_z FROM WATERSHED_MODEL";
  16. ResultSet rs = stmt.executeQuery(selectSql);
  17. System.out.println("=== 模型数据检查 ===");
  18. int count = 0;
  19. while (rs.next()) {
  20. count++;
  21. Long modelId = rs.getLong("model_id");
  22. String modelName = rs.getString("model_name");
  23. String coordinates = rs.getString("model_coordinates");
  24. System.out.println("\n模型 " + count + ":");
  25. System.out.println(" ID: " + modelId);
  26. System.out.println(" 名称: " + modelName);
  27. System.out.println(" 坐标: " + coordinates);
  28. System.out.println(" 旋转: X=" + rs.getDouble("rotation_x") + ", Y=" + rs.getDouble("rotation_y") + ", Z=" + rs.getDouble("rotation_z"));
  29. System.out.println(" 缩放: X=" + rs.getDouble("scale_x") + ", Y=" + rs.getDouble("scale_y") + ", Z=" + rs.getDouble("scale_z"));
  30. }
  31. System.out.println("\n总共 " + count + " 个模型");
  32. rs.close();
  33. stmt.close();
  34. conn.close();
  35. } catch (Exception e) {
  36. e.printStackTrace();
  37. }
  38. }
  39. }