简体   繁体   中英

In JDBC for PostgreSQL, can I execute commands of psql?

When using a JDBC driver for PostgreSQL in a Java program, is it correct that I can only execute SQL commands?

Can I execute psql-specific commands, such as \\conninfo , \\l ...?

Does JDBC directly connect to PostgreSQL server, not to any client such as psql?

Thanks.

The PostgreSQL JDBC driver does not use psql at all. It is implemented in Java and does not even use the C client shared library libpq .

There is no way to use psql commands with JDBC.

If you start psql with the -E option, you can see the SQL commands that psql sends to the server during processing its commands. That might give you a clue how you can emulate psql functionality using JDBC.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM