0

It's possible to scan all databases in PostgreSQL like in MySQL, because in MySQL i can write connection like "jdbc:mysql://" + hostName + ":" + portNumber"; and i will retrieve all schemas, but when I'am trying to do it with Postgre SQL i have not result up to time when i give the database name in url?

7
  • 1
    No, you need to connect to a database that exists. Commented Mar 10, 2021 at 12:36
  • But there is also a database that lets you see what all the databases are - you connect to it and query [sorry it's late and tired - I can find it tomorrow]. Commented Mar 10, 2021 at 12:52
  • 1
    @MrR calm down. It's all described in the link I gave. If you're talking about pg_database, then yeah you can query that (table, not database), once you can connect to an existing database on the server. Commented Mar 10, 2021 at 12:54
  • @Kayaman - sorry - my eyes missed the link (which I can see now I hold the eyes open)... Commented Mar 10, 2021 at 12:58
  • 2
    What MySQL calls a "database" is in fact a schema. So you would map MySQL "databases" to Postgres schemas. And once you did that you can simply connect to the database where you created all the schemas. And then you can query information_schema.schemata to list all schemas inside that database. Commented Mar 10, 2021 at 13:37

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.