ERROR: relation does not exist

蹲街弑〆低调 提交于 2019-12-02 13:58:12

问题


So here is the problem. I am scraping some data with java and eventually i place that java into postgres database. When i run Java program, i get error ERROR: relation "table name" does not exist but when i personally write that same query in PGAdmin III, it works fine. I googled it and it's not about caps letters that most people have problems with. Here is a screenshot:


回答1:


My first thought was that you were using double quotes for values, but then I looked again and realized you were assembling a query using string concatenation.

DON'T DO THAT. In addition to making these problems impossible to debug you open yourself up to sql injection.

In debugging something like this, you should first port to use placeholder syntax (which PostgreSQL's JDBC driver supports) and then, if that doesn't work, then post the server logs.



来源:https://stackoverflow.com/questions/36125679/error-relation-does-not-exist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!