全部產品
Search
文件中心

AnalyticDB:SQL WorkBench/J

更新時間:May 21, 2026

本文測試了SQL WorkBench/J與AnalyticDB for MySQL在連通性、列舉資料庫、建立表等方面的相容性,並給出測試結果圖。

測試環境

MySQL JDBC Driver SQL WorkBench/J
MySQL JDBC Driver 5.1.48 (Platform Independent),下載地址為MySQL JDBC Driver 下載地址為SQL WorkBench/J

測試範圍

  • 連通性使用 SQL Workbench/J 串連 MySQL 資料庫,Driver 選擇 MySQL (com.mysql.jdbc..Driver),URL 填寫 jdbc:mysql://localhost:3303/test4dmp,輸入使用者名稱和密碼後單擊 Test,彈窗提示串連成功。
  • 列舉資料庫
    show databases;
    -- Result:
    -- Database
    -- MYSQL
    -- INFORMATION_SCHEMA
    -- test4dmp
  • 建立表
    CREATE TABLE `school` (
    `id` bigint NOT NULL,
    `name` varchar,
    `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    key status_idx(`name`),
    primary key (id)
    ) DISTRIBUTE BY HASH(`id`);
  • 列舉所有表在 SQL Workbench/J 中串連 test4dmp 資料庫(User=kepler),執行 show tables; 命令,查詢結果共 32 張表,包括 binary_test、course、dimension_test_date、dimension_test_date_1、dimension_test_id、dimension_test_id_1、dimension_test_int、dimension_test_int_1、dimension_test_timestamp、dimension_test_timestamp_1、elective 等。
  • 查看錶結構
    show create table school;
    -- 查詢結果
    -- Table: school
    -- Create Table:
    CREATE TABLE `school` (
      `id` bigint NOT NULL,
      `name` varchar,
      `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
      ...
    )
  • 向表中寫入資料
    insert into school (id, name) value (1,'a');
  • 查看錶資料在 SQL Workbench/J 中以使用者 kepler 串連資料庫 test4dmp,執行 select * from school limit 10;,查詢結果返回一行資料(id=1, name=a, create_time=2019-11-19 14:22:54, update_time=2019-11-19 14:22:54),驗證表資料讀取正常。
  • 建立視圖
    CREATE VIEW `school_view` as select * from school;
    執行成功,返回 View school_view created
  • 查看視圖結構
    show create view school_view;
    +-------------+---------------------------------------------------------------+----------------------+----------------------+
    | View        | Create View                                                   | character_set_client | collation_connection |
    +-------------+---------------------------------------------------------------+----------------------+----------------------+
    | school_view | CREATE VIEW `test4dmp`.`school_view` AS SELECT * FROM  school | utf8                 | utf8_general_ci      |
    +-------------+---------------------------------------------------------------+----------------------+----------------------+
  • 查詢檢視在 SQL Workbench/J 中執行 select * from school_view limit 10;,查詢結果返回一條記錄:ID 為 1,NAME 為 a,CREATE_TIME 和 UPDATE_TIME 均為 2019-11-19 14:22:54。