"\ d"在jdbc程序中失败 [英] "\d" failed in jdbc program

查看:114
本文介绍了"\ d"在jdbc程序中失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在PostgreSQL中,我们可以在客户端使用\d命令列出数据库中的表,但是在客户端JDBC程序中它失败.是否有可能?为什么和为什么不?

In PostgreSQL, we can list tables in a database with the \d command in client terminal but it failed in a client JDBC program. Is it possible? Why and Why Not?

推荐答案

\dpsql命令,而不是SQL语句.

\d is a psql command, not a SQL statement.

要获取数据库中可用的表,您应该使用JDBC API,例如

To get the tables available in the database you should use the JDBC API, such as DatabaseMetaData.getTables().

或者,您可以运行

select  table_schema, table_name
from information_schema.tables

获取表名列表.

这篇关于"\ d"在jdbc程序中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆