0

I want to make a connection to my PostgreSQL database with SQLDeveloper, but when i'm about to choose the db, it doesn't show any db I can pick. My OS is CentOS 6, SQLDeveloper 17.4.1.054, and my jdbc is 42.2.4.jar . I installed PostgreSQL 10.4 on port 5432 on my CentOS

I'm really new to this, so I don't know what I did wrong. Thanks in advanceScreenshot of the SQLDeveloper

Jack Doe
  • 31
  • 2
  • 9
  • Off the top of my head, perhaps Postgres server is not running/reachable on your CentOS. [Check here](https://stackoverflow.com/questions/7975414/how-to-check-status-of-postgresql-server-mac-os-x) to get an idea of how to check if Postgres is even running. If it's not, then your current experience is what I would expect. – Tim Biegeleisen Aug 01 '18 at 02:00
  • i checked the server via pg_ctl, it says it has already been started. turned out I haven't reconfigure the pg_hba.conf. after I reconfigured it, it works – Jack Doe Aug 02 '18 at 02:21

2 Answers2

0

Try psql first on the database you want

heres a list of my local databases on 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-# 
Barry McGillin
  • 465
  • 5
  • 11
0

I tried to reconfigure the pg_hba.conf which located at /var/lib/pgsql/10/data/

I changed the method on IPv4 section from "ident" to "trust"

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

after that, I restarted the PostgreSQL service and I managed to make the connection to PostgreSQL from SQLDeveloper

Jack Doe
  • 31
  • 2
  • 9