
# 连接postgresql或者gaussdb时报错
#### 问题
连接postgresql或者gaussdb时报错。
![](https://support.huaweicloud.com/cmpntguide-lts-mrs/zh-cn_image_0000001803282592.png "点击放大")
#### 回答
场景一：（**import** 场景）使用**sqoop import** 命令抽取开源Postgre到MRS HDFS或Hive等。
- 问题现象： 使用sqoop命令查询postgre表可以，但是执行sqoop import命令倒数时报错：
  ```
  The authentication type 5 is not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or subnet, and that it
  ```
  ```
  The authentication type 12 is not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or subnet, and that it
  ```
  
- 问题根因：
  - 报错中type为5时：在执行sqoop import命令时，会启动MapReduce任务，由于MRS Hadoop安装目录（${BIGDATA_HOME}/FusionInsight_HD_\*/1_\*_NodeManager/install/hadoop/share/hadoop/common/lib）下自带了postgre驱动包gsjdbc4-\*.jar，与开源Postgre服务不兼容导致报错。
  
  - 报错中type为12时：数据库的pg_hba.conf文件配置有误。
   
- 解决方案：
  - 报错中type为5时：在每台MRS NodeManager实例所在节点上移动驱动包"gsjdbc4-\*.jar"到"tmp"目录下。 **mv ${BIGDATA_HOME}/FusionInsight_HD_\*/1_\*_NodeManager/install/hadoop/share/hadoop/common/lib/gsjdbc4-\*.jar /tmp**
    
  
  - 报错中type为12时：调整数据库的pg_hba.conf文件，将address改成Sqoop所在节点的IP。 ![](https://support.huaweicloud.com/cmpntguide-lts-mrs/zh-cn_image_0000001803442380.png)
    
   
 
场景二：（**export** 场景）使用**sqoop export** 命令抽取开源Postgre到MRS HDFS或Hive等。
- 问题现象： 使用sqoop命令查询postgre表可以，但是执行sqoop export命令倒数时报错：
  ```
  The authentication type 5 is not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or subnet, and that it
  ```
  
- 问题根因： 在执行sqoop export命令时，会启动MapReduce任务，由于MRS Hadoop安装目录（${BIGDATA_HOME}/FusionInsight_HD_\*/1_\*_NodeManager/install/hadoop/share/hadoop/common/lib）下自带了postgre驱动包"gsjdbc4-\*.jar"，与开源Postgre服务不兼容导致报错。
  
- 解决方案：
  1. 在每台MRS NodeManager实例所在节点上移动驱动包"gsjdbc4-\*.jar"到"tmp"目录下。 **mv ${BIGDATA_HOME}/FusionInsight_HD_\*/1_\*_NodeManager/install/hadoop/share/hadoop/common/lib/gsjdbc4-\*.jar /tmp**
     
  
  
  
  2. 将"/opt/client/Hive/Beeline/lib/gsjdbc4-\*.jar"删除 。
   
 
