【问题标题】:Unable to choose postgreSQL database when making connection with SQLDeveloper与 SQLDeveloper 建立连接时无法选择 postgreSQL 数据库
【发布时间】:2019-01-08 11:58:30
【问题描述】:

我想用 SQLDeveloper 连接到我的 PostgreSQL 数据库,但是当我要选择数据库时,它没有显示我可以选择的任何数据库。 我的操作系统是CentOS 6,SQLDeveloper 17.4.1.054,我的jdbc是42.2.4.jar .我在 CentOS 的 5432 端口上安装了 PostgreSQL 10.4

我对此很陌生,所以我不知道我做错了什么。提前感谢Screenshot of the SQLDeveloper

【问题讨论】:

  • 在我的脑海中,也许 Postgres 服务器没有在您的 CentOS 上运行/访问。 Check here 了解如何检查 Postgres 是否正在运行。如果不是,那么您目前的体验就是我所期望的。
  • 我通过 pg_ctl 检查了服务器,它说它已经启动了。原来我没有重新配置pg_hba.conf。我重新配置后,它可以工作了

标签: oracle-sqldeveloper centos6


【解决方案1】:

我尝试重新配置位于 /var/lib/pgsql/10/data/ 的 pg_hba.conf

我将 IPv4 部分的方法从“ident”更改为“trust”

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust

之后,我重新启动了 PostgreSQL 服务,并设法从 SQLDeveloper 连接到 PostgreSQL

【讨论】:

    【解决方案2】:

    首先在你想要的数据库上尝试 psql

    这是我在 Postgres 上的本地数据库列表

    $ psql 
    psql (10.3)
    Type "help" for help.
    
    bamcgill=# show databases
    bamcgill-# \l
                                      List of databases
       Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
    -----------+----------+----------+-------------+-------------+-----------------------
     bamcgill  | bamcgill | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
     postgres  | bamcgill | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
     template0 | bamcgill | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/bamcgill          +
               |          |          |             |             | bamcgill=CTc/bamcgill
     template1 | bamcgill | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/bamcgill          +
               |          |          |             |             | bamcgill=CTc/bamcgill
     world     | bamcgill | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
    (5 rows)
    
    bamcgill-# \c world
    You are now connected to database "world" as user "bamcgill".
    world-# \dt
                  List of relations
     Schema |      Name       | Type  |  Owner   
    --------+-----------------+-------+----------
     public | city            | table | bamcgill
     public | country         | table | bamcgill
     public | countrylanguage | table | bamcgill
    (3 rows)
    
    world-# 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-15
      • 1970-01-01
      • 2016-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多