我尝试从postgresql数据库获取数据,但收到此异常。
我读了一些替代方法,但对我不起作用。
String sql="select description from job;"
//String sql="select description from public.job;"
//String sql="select description from public.\"job\";"
//String sql="select description from \"public\".\"job\";"
//String sql="select description from \"public\".job;"
...
Statement st = myconnection.createStatement();
ResultSet rs = st.executeQuery(sql); // throws exception
执行下一个脚本后,我收到:
SELECT *
FROM information_schema.columns
order by table_schema, table_name;
结果:
table_catalog|table_schema|table_name|...
--Others rows
postgres|public|job|
postgres|public|job|
--Others rows
PostgresSQL版本 PostgreSQL 12.1,由Visual C ++ build 1914(64位)编译
有什么主意吗?谢谢
编辑:
例外
org.postgresql.util.PSQLException: ERROR: relation «job» does not exist
Position: 25
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2497)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2233)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:310)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:446)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:370)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:311)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:297)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:274)
at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:225)
...