首页 > 解决方案 > 如何使用 Java 和 PostgreSQL 执行 \d tablename

问题描述

如何\d tablename使用 Java 和 PostgreSQL 执行?

PreparedStatement pst = jdbc.conn.prepareStatement("\d u_item");
ResultSet set = pst.executeQuery();

错误:

org.postgresql.util.PSQLException: ERROR: syntax error at or near "\"

标签: javapostgresqlcmd

解决方案


\d is a command of the interactive psql client. It is not part of SQL.

You can't execute this command over a JDBC connection.


推荐阅读