[docs](odbc) fix docs for sqlserver odbc table (#14017)

Signed-off-by: nextdreamblue <zxw520blue1@163.com>

Signed-off-by: nextdreamblue <zxw520blue1@163.com>
This commit is contained in:
xueweizhang
2022-11-09 08:39:39 +08:00
committed by GitHub
parent cd8f0713ea
commit a0f136a0bc
2 changed files with 47 additions and 6 deletions

View File

@ -106,14 +106,15 @@ The following parameters are accepted by ODBC external table:
Parameter | Description
---|---
**hosts** | IP address of external database
**port** | Port of external database
**driver** | The driver name of ODBC Driver, which needs to be/conf/odbcinst.ini. The driver names should be consistent.
**type** | The type of external database, currently supports Oracle, MySQL and PostgerSQL
**user** | The user name of database
**password** | password for the user
**charset** | charset of connection
**charset** | charset of connection(it is useless for sqlserver)
Remark:
In addition to adding the above parameters to `PROPERTIES`, you can also add parameters specific to each database's ODBC driver implementation, such as `sslverify` for mysql, etc.
In addition to adding the above parameters to `PROPERTIES`, you can also add parameters specific to each database's ODBC driver implementation, such as `sslverify` for mysql`ClientCharset` for sqlserver, etc.
>Notes:
>
@ -203,7 +204,7 @@ This contains all versions of PostgreSQL from 9.x to 14.x, including the corresp
####
| Oracle版本 | Oracle ODBC版本 |
| Oracle version | Oracle ODBC version |
| ------------------------------------------------------------ | ------------------------------------------ |
| Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production | oracle-instantclient19.13-odbc-19.13.0.0.0 |
| Oracle Database 12c Standard Edition Release 12.2.0.1.0 - 64bit Production | oracle-instantclient19.13-odbc-19.13.0.0.0 |
@ -220,6 +221,14 @@ https://download.oracle.com/otn_software/linux/instantclient/1913000/oracle-inst
https://download.oracle.com/otn_software/linux/instantclient/1913000/oracle-instantclient19.13-basic-19.13.0.0.0-2.x86_64.rpm
```
#### 4.SQLServer
| SQLServer version | SQLServer ODBC version |
| --------- | -------------- |
| SQL Server 2016 Enterprise | freetds-1.2.21 |
Currently only tested this version, other versions will be added after testing
## Ubuntu operating system
The unixODBC versions used are: 2.3.4, Doris 0.15, Ubuntu 20.04
@ -259,6 +268,14 @@ sudo alien -i oracle-instantclient19.13-odbc-19.13.0.0.0-2.x86_64.rpm
sudo alien -i oracle-instantclient19.13-sqlplus-19.13.0.0.0-2.x86_64.rpm
````
#### 4.SQLServer
| SQLServer version | SQLServer ODBC version |
| --------- | -------------- |
| SQL Server 2016 Enterprise | freetds-1.2.21 |
Currently only tested this version, other versions will be added after testing
## Data type mapping
There are different data types among different databases. Here, the types in each database and the data type matching in Doris are listed.
@ -389,3 +406,6 @@ This is the compatibility problem between MySQL database ODBC driver and existin
The default encoding used by Doris when connecting to odbc tables is utf8, since the default utf8 encoding in mysql is utf8mb3, it can't represent the emoji expressions which need 4-byte encoding. Here need to set `charset`=`utf8mb4` when you create odbc mysql tables, then can read and write emoji normally 😀.
12. Set charset for sqlserver odbc table
It is useless to set `charset` parameter for sqlserver odbc table,you can set `ClientCharset` parameter (for freetds) to get write or read data, for example: "ClientCharset" = "UTF-8".

View File

@ -102,18 +102,19 @@ PROPERTIES (
参数 | 说明
---|---
**hosts** | 外表数据库的IP地址
**port** | 外表数据库的服务端口号
**driver** | ODBC外表的Driver名,该名字需要和be/conf/odbcinst.ini中的Driver名一致。
**odbc_type** | 外表数据库的类型,当前支持oracle, mysql, postgresql
**user** | 外表数据库的用户名
**password** | 对应用户的密码信息
**charset** | 数据库连接使用的字符集
**charset** | 数据库连接使用的字符集(对sqlserver无效)
备注:
`PROPERTIES` 中除了可以添加上述参数之外,还支持每个数据库的ODBC driver 实现的专用参数,比如mysql 的`sslverify`
`PROPERTIES` 中除了可以添加上述参数之外,还支持每个数据库的ODBC driver 实现的专用参数,比如mysql 的`sslverify`、sqlserver 的`ClientCharset`
>注意:
>
>如果你是SQL Server 2017 及之后的版本,因为SQL Server 2017及之后版本默认开启了安全认证,你需要定义 ODBC Resources的时候加上 `"TrustServerCertificate"="Yes"`
>如果你是SQL Server 2017 及之后的版本,因为SQL Server 2017及之后版本默认开启了安全认证,你需要定义 ODBC Resources的时候加上 `"TrustServerCertificate"="Yes"`
##### ODBC Driver的安装和配置
@ -214,6 +215,14 @@ https://download.oracle.com/otn_software/linux/instantclient/1913000/oracle-inst
https://download.oracle.com/otn_software/linux/instantclient/1913000/oracle-instantclient19.13-basic-19.13.0.0.0-2.x86_64.rpm
```
#### 4.SQLServer
| SQLServer版本 | SQLServer ODBC版本 |
| --------- | -------------- |
| SQL Server 2016 Enterprise | freetds-1.2.21 |
目前只测试了这一个版本其他版本测试后补充
### Ubuntu操作系统
使用的unixODBC版本是:2.3.4,Doris 0.15,Ubuntu 20.04
@ -253,6 +262,14 @@ sudo alien -i oracle-instantclient19.13-odbc-19.13.0.0.0-2.x86_64.rpm
sudo alien -i oracle-instantclient19.13-sqlplus-19.13.0.0.0-2.x86_64.rpm
```
#### 4.SQLServer
| SQLServer版本 | SQLServer ODBC版本 |
| --------- | -------------- |
| SQL Server 2016 Enterprise | freetds-1.2.21 |
目前只测试了这一个版本其他版本测试后补充
## 类型匹配
@ -377,3 +394,7 @@ sudo alien -i oracle-instantclient19.13-sqlplus-19.13.0.0.0-2.x86_64.rpm
11. 读写mysql外表的emoji表情出现乱码
Doris进行odbc外表连接时,默认采用的编码为utf8,由于mysql之中默认的utf8编码为utf8mb3,无法表示需要4字节编码的emoji表情。这里需要在建立mysql外表时设置`charset`=`utf8mb4`,便可以正常读写emoji表情😀。
12. 读写sqlserver外表的编码配置
由于sqlserver的odbc外表连接时,无法直接通过`charset`来配置编码,用户可以使用`ClientCharset`(for freetds)配置项来设置, 比如 "ClientCharset" = "UTF-8"。