Java Crosstab - preparedstatement query

前端 未结 2 1780
失恋的感觉
失恋的感觉 2020-12-06 12:03

I have a typical crosstab query with static parameters. It works fine with createStatement. I want to use preparestatement to query instead.

         String          


        
2条回答
  •  感情败类
    2020-12-06 12:24

    You have fallen for the confusing type hierarchy of PreparedStatement extends Statement:

    PreparedStatement has the same execute*(String) methods like Statement, but they're not supposed to be used, just use the parameterless execute*() methods of PreparedStatement --- you already have given the actual query string to execute using conn.prepareStatement().

提交回复
热议问题