Why I obtain this “SQLSyntaxErrorException: ORA-00933: SQL command not properly ended” when I try to perform this JDBC query?

前端 未结 2 1991
北荒
北荒 2020-12-21 04:07

I have some problem trying to implement a simple JDBC query into a Java application.

So I have the following query:

SELECT   D.*
FROM   coda_tx c, do         


        
相关标签:
2条回答
  • 2020-12-21 04:56

    executeQuery() automatically adds a semicolon to a statement when executing it.

    Change the line sb.append("';"); to sb.append("'");.

    Also you'll need to add spaces at the end or at the beginning of each line, your statements are invalid otherwise.

    0 讨论(0)
  • 2020-12-21 05:09

    Add a white space at the end of each line so that the keyword on the next line is not clumped with it, e.g.:

    sb.append("SELECT D.* ");
    

    instead of

    sb.append("SELECT D.*");
    

    and also remove the trailing semicolon.

    0 讨论(0)
提交回复
热议问题