
# 连接postgresql或者gaussdb时报错
#### 问题
连接postgresql或者gaussdb时报错。
![](https://support.huaweicloud.com/cmpntguide-mrs/zh-cn_image_0000001272346574.png)
#### 回答
- 场景一：（**import** 场景）使用**sqoop import** 命令抽取开源postgre到MRS hdfs或hive等。
  - 问题现象： 使用sqoop命令查询postgre表可以，但是执行sqoop import命令倒数时报错：
    - 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
    
    - 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
     
  
  - 问题根因：
    - 报错中type为5时：在执行sqoop import命令时，会启动MapReduce任务，由于MRS Hadoop安装目录（/opt/Bigdata/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 /opt/Bigdata/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-mrs/zh-cn_image_0000001532920221.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安装目录（/opt/Bigdata/FusionInsight_HD_\*/1_\*_NodeManager/install/hadoop/share/hadoop/common/lib）下自带了postgre驱动包gsjdbc4-\*.jar，与开源postgre服务不兼容导致报错。
    
  
  - 解决方案：
    1. 在每台MRS NodeManager实例所在节点上移动驱动包gsjdbc4-\*.jar到tmp目录下。 **mv /opt/Bigdata/FusionInsight_HD_\*/1_\*_NodeManager/install/hadoop/share/hadoop/common/lib/gsjdbc4-\*.jar /tmp**
       
    
    
    
    2. 将/opt/Bigdata/client/Hive/Beeline/lib/gsjdbc4-\*.jar删除 。
     
   
 
