liuanxin opened a new issue, #19671:
URL: https://github.com/apache/doris/issues/19671

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   doris : 1.2.4.1
   
   > select version();
   +--------------+
   | version() |
   +--------------+
   | 5.7.99     |
   +--------------+
   
   ### What's Wrong?
   
   外部表无法访问
   
   ### What You Expected?
   
   我有一个 mysql 表
   ```sql
   use temp;
   
   CREATE TABLE t_temp (
       id INT(11)
   );
   
   insert into t_temp(id) values(1), (2), (3);
   ```
   
   基于 https://doris.apache.org/zh-CN/download/ 下载的 1.2.4.1 的版本, 参考文档(以下简称 1 和 2)
   1. 
https://doris.apache.org/zh-CN/docs/dev/data-operate/import/import-scenes/external-table-load#%E5%88%9B%E5%BB%BA%E5%A4%96%E9%83%A8%E8%A1%A8
   2. 
https://doris.apache.org/zh-CN/docs/dev/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-EXTERNAL-TABLE/#example
   
   
   之后在 doris 中如下操作
   ```sql
   CREATE EXTERNAL RESOURCE `mysql_resource`
   PROPERTIES (
       "type" = "odbc_catalog",
       "host" = "127.0.0.1",
       "port" = "3306",
       "user" = "root",
       "password" = "root",
       /* 在上面的 1 中有提到这个参数选项, 在 2 中没有, 是否可以补全相关的文档? */
       "odbc_type" = "MySQL"
   );
   
   /* 参照上面的 1 建立外部表 */
   CREATE EXTERNAL TABLE `resouce_temp1` (
       `id` INT(11)
   ) ENGINE=ODBC /* 此处用的是 ODBC */
   PROPERTIES (
       "odbc_catalog_resource" = "mysql_resource",
       "database" = "temp",
       "table" = "t_temp"
   );
   
   /* 基于上面的 2 建立外部表 */
   CREATE EXTERNAL TABLE `resouce_temp2` (
       `id` INT(11)
   ) ENGINE=mysql  /* 此处用的是 mysql */
   PROPERTIES (
       "odbc_catalog_resource" = "mysql_resource",
       "database" = "temp",
       "table" = "t_temp"
   );
   
   
   select count(*) from resouce_temp1;
   /* 访问上面的 1 建立的外部表时 npe */
   ERROR 1105 (HY000): errCode = 2, detailMessage = Unexpected exception: null
   
   
   select count(*) from resouce_temp2;
   /*
   访问上面的 2 建立的外部表时提示编译参数没有开. 直接用的脚本下载,
   如果回复基于 
https://doris.apache.org/zh-CN/docs/1.2/install/source-install/compilation-general/#%E7%89%B9%E5%88%AB%E5%A3%B0%E6%98%8E
 
   要求从源码编译并添加 WITH_MYSQL 选项, 还是不要了, 谢谢
   */
   ERROR 1105 (HY000): errCode = 2, detailMessage = 
(127.0.0.1)[INTERNAL_ERROR]Don't support MySQL table, you should rebuild Doris 
with WITH_MYSQL option ON
   ```
   
   请问应该以哪里的文档为准? 并且要怎样访问外部表?
   
   ### How to Reproduce?
   
   _No response_
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to