| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.Statement;
- import java.sql.ResultSet;
- public class TestModelData { public static void main(String[] args) {
- try {
- // 加载驱动
- Class.forName("dm.jdbc.driver.DmDriver");
-
- // 连接数据库
- String url = "jdbc:dm://192.168.0.145:30236?charSet=utf8";
- String username = "WATERSHED";
- String password = "WaterShed./1224";
-
- Connection conn = DriverManager.getConnection(url, username, password);
- Statement stmt = conn.createStatement();
-
- // 查询模型数据
- String selectSql = "SELECT model_id, model_name, rotation_x, rotation_y, rotation_z, scale_x, scale_y, scale_z FROM WATERSHED_MODEL WHERE model_id = 111";
- ResultSet rs = stmt.executeQuery(selectSql);
-
- if (rs.next()) {
- System.out.println("=== 数据库中的模型数据 ===");
- System.out.println("model_id: " + rs.getLong("model_id"));
- System.out.println("model_name: " + rs.getString("model_name"));
- System.out.println("rotation_x: " + rs.getDouble("rotation_x"));
- System.out.println("rotation_y: " + rs.getDouble("rotation_y"));
- System.out.println("rotation_z: " + rs.getDouble("rotation_z"));
- System.out.println("scale_x: " + rs.getDouble("scale_x"));
- System.out.println("scale_y: " + rs.getDouble("scale_y"));
- System.out.println("scale_z: " + rs.getDouble("scale_z"));
- }
-
- // 关闭连接
- rs.close();
- stmt.close();
- conn.close();
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
|