diff --git a/content/docs-lite/en/docs/Developerguide/configuring-a-data-source-in-the-linux-os.md b/content/docs-lite/en/docs/Developerguide/configuring-a-data-source-in-the-linux-os.md new file mode 100644 index 0000000000000000000000000000000000000000..166d54b5a1d7d2bb5668f95b55f8ef7446ff61f7 --- /dev/null +++ b/content/docs-lite/en/docs/Developerguide/configuring-a-data-source-in-the-linux-os.md @@ -0,0 +1,510 @@ +# Configuring a Data Source in the Linux OS + +The ODBC DRIVER \(**psqlodbcw.so**\) provided by openGauss can be used after it has been configured in a data source. To configure a data source, you must configure the **odbc.ini** and **odbcinst.ini** files on the server. The two files are generated during the unixODBC compilation and installation, and are saved in the **/usr/local/etc** directory by default. + +## Procedure + +1. Obtain the source code package of unixODBC by following link: + + [https://sourceforge.net/projects/unixodbc/files/unixODBC/2.3.9/unixODBC-2.3.9pre.tar.gz/download](https://sourceforge.net/projects/unixodbc/files/unixODBC/2.3.9/unixODBC-2.3.9pre.tar.gz/download) + + After the download, validate the integrity based on the integrity validation algorithm provided by the community. + +2. Install unixODBC. It does not matter if unixODBC of another version has been installed. + + Currently, unixODBC-2.2.1 is not supported. For example, to install unixODBC-2.3.0, run the commands below. unixODBC is installed in the **/usr/local** directory by default. The data source file is generated in the **/usr/local/etc** directory, and the library file is generated in the **/usr/local/lib** directory. + + ``` + tar zxvf unixODBC-2.3.0.tar.gz + cd unixODBC-2.3.0 + # Modify the configure file. (If it does not exist, modify the configure.ac file.) Find LIB_VERSION. + # Change the value of LIB_VERSION to 1:0:0 to compile a *.so.1 dynamic library with the same dependency on psqlodbcw.so. + vim configure + + ./configure --enable-gui=no #To perform compilation on an ARM server, add the configure parameter --build=aarch64-unknown-linux-gnu. + make + # The installation may require root permissions. + make install + ``` + +3. Replace the openGauss client driver. + 1. Decompress the **openGauss-x.x.x-ODBC.tar.gz** package. After the decompression, the **lib** and **odbc** folders are generated. The **odbc** folder contains another **lib** folder. Copy the **psqlodbca.la**, **psqlodbca.so**, **psqlodbcw.la**, and **psqlodbcw.so** files from **/odbc/lib** to **/usr/local/lib**. + 2. Copy the library in the **lib** directory obtained after decompressing **openGauss-x.x.x-ODBC.tar.gz** to the **/usr/local/lib** directory. + +4. Configure a data source. + 1. Configure the ODBC driver file. + + Add the following content to the **/usr/local/etc/odbcinst.ini** file: + + ``` + [GaussMPP] + Driver64=/usr/local/lib/psqlodbcw.so + setup=/usr/local/lib/psqlodbcw.so + ``` + + For descriptions of the parameters in the **odbcinst.ini** file, see [Table 1](#en-us_topic_0283136654_en-us_topic_0237120407_en-us_topic_0059778464_td564f21e7c8e458bbd741b09896f5d91). + + **Table 1** odbcinst.ini configuration parameters + + +
+ | ++ | ++ | +
---|---|---|
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | +Driver installation path, which is the same as the dynamic library path in Driver64. + |
+ + | +
+ | ++ | ++ | +
---|---|---|
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | +
+ NOTE:
+ After a user established a connection, the ODBC driver automatically clears their password stored in memory. +However, if this parameter is configured, UnixODBC will cache data source files, which may cause the password to be stored in the memory for a long time. +When you connect to an application, you are advised to send your password through an API instead of writing it in a data source configuration file. After the connection has been established, immediately clear the memory segment where your password is stored. + |
+
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | +If this parameter is set to 1, the mylog file of the PostgreSQL ODBC driver will be printed. The directory generated for storing logs is /tmp/. If this parameter is set to 0, no directory is generated. + |
+ + | +
+ | +Whether to enable the extended query protocol for the database. +The value can be 0 or 1. The default value is 1, indicating that the extended query protocol is enabled. + |
+ + | +
+ | +Whether to enable the batch query protocol. If it is enabled, DML performance can be improved. The value can be 0 or 1. The default value is 1. +If this parameter is set to 0, the batch query protocol is disabled (mainly for communication with earlier database versions). +If this parameter is set to 1 and support_batch_bind is set to on, the batch query protocol is enabled. + |
+ + | +
+ | ++ | ++ | +
+ | +Each time SQLFreeHandle is invoked to release statements, ODBC sends a Deallocate plan_name statement to the server. A large number of such statements exist in the service. To reduce the number of the statements to be sent, stmt->plan_name is left empty so that the database can identify them as unnamed statements. This parameter is added to control the threshold for unnamed statements. + |
+ + | +
+ | +Whether to display the driver deployment path and process owner in the connection_info parameter mentioned in connection_info. + |
+
+ NOTE:
+ The default value is 0. If this parameter is set to 1, the ODBC driver reports the driver deployment path and process owner to the database and displays the information in the connection_info parameter (see connection_info). In this case, you can query the information from PG_STAT_ACTIVITY. + |
+
+ | +If this parameter is set to Yes, the Boolean value is mapped to the SQL_CHAR type. If this parameter is not set, the value is mapped to the SQL_BIT type. + |
+ + | +
+ | +When an attempt is made to update a row of data, setting this parameter to Yes allows the application to detect whether the data has been modified by other users. + |
+ + | +
+ | +By default, the driver regards the system table as a common SQL table. + |
+ + | +
+ | ++ | +
---|---|
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
---|---|
+ | +SQLAllocHandle is a generic function for allocating a handle. It can replace the following functions: +
|
+
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | +SQLFreeHandle is a generic function for releasing a handle. It can replace the following functions: +
|
+
+ | ++ | ++ | +
---|---|---|
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ | +
---|---|---|
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ + | +
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ + | ++ | +
+ | +是否开启批量查询协议(打开可提高DML性能);可选值0或者1,默认为1。 + + + |
+ + | +
+ | ++ | ++ | +
+ | +每次调用SQLFreeHandle释放Stmt时,ODBC都会向server端发送一个Deallocate plan_name语句,业务中存在大量这类语句。为了减少这类语句的发送,我们将 stmt->plan_name置空,从而使得数据库识别这个为unamed stmt。增加这个参数对unamed stmt的阈值进行控制。 + |
+ + | +
+ | +GUC参数connection_info(参见connection_info)中显示驱动部署路径和进程属主用户的开关。 + |
+
+ 说明:
+ 默认值为0。当设置为1时,ODBC驱动会将当前驱动的部署路径、进程属主用户上报到数据库中,记录在connection_info参数(参见connection_info)里;同时可以在PG_STAT_ACTIVITY中查询到。 + |
+
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ | +
---|---|---|
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | +必须使用SSL安全连接,在verify-ca的验证范围之外,同时验证数据库所在主机的主机名是否与证书内容一致。openGauss不支持此模式。 + |
+
+ | ++ | +
---|---|
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | +输出参数:指向与列绑定的数据缓冲区的指针。SQLFetch函数返回这个缓冲区中的数据。如果此参数为一个空指针,则StrLen_or_IndPtr是一个有效值。 + |
+
+ | ++ | +
+ | ++ | +
+ | ++ | +
---|---|
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
---|---|
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
---|---|
+ | ++ | +
+ | ++ | +
---|---|
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
---|---|
+ | ++ | +
+ | ++ | +
---|---|
+ | ++ | +
+ | ++ | +
---|---|
+ | +SQLFreeHandle要释放的句柄类型。必须为下列值之一: +
|
+
+ | ++ | +
+ | ++ | ++ | +
---|---|---|
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | ++ | +
+ | ++ | +
---|---|
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
---|---|
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
---|---|
+ | +SQLAllocHandle:申请句柄资源,可替代如下函数: +
|
+
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | +SQLFreeHandle:释放句柄资源,可替代如下函数: +
|
+
+ | ++ | +
---|---|
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
+ | ++ | +
---|---|
+ | ++ | +
+ | ++ | +
---|---|
+ | ++ | +
+ | +SQL statement to be executed. One SQL statement can be executed at a time. + |
+
+ | ++ | +
+ | ++ | +
---|---|
+ | ++ | +
+ | ++ | +
---|---|
+ | ++ | +
+ | ++ | +
---|---|
+ | ++ | +
+ | ++ | +
+ | ++ | +