数据仓库服务 GaussDB(DWS)-执行业务抛出异常:调用存储过程报错 ERROR: cached plan must not change result type
调用存储过程报错 ERROR: cached plan must not change result type
问题分析:由于JDBC中使用了PreparedStatement,默认重复执行5次就会缓存plan,在此之后有如果重建表操作(例如修改表定义),再次执行就会报错ERROR: cached plan must not change result type.
处理方法:在JDBC连接字串中指定prepareThreshold=0,不再cache plan。例如:
1 |
String url = "jdbc:postgresql:// 192.168.0.10:2000/postgres?prepareThreshold=0"; |