解决帆软报表使用postgresql数据库填报,报错varchar和字段类型json不匹配

楼主
我是社区第78851位番薯,欢迎点我头像关注我哦~

建议加入文档,方便更多使用PG数据库的用户。

我们在使用帆软报表 填报数据 到 postgresql 数据库的过程中,

内置sql填报,会出现json字段和填报的varchar数据类型不匹配的错误。

 

了解到帆软通过JDBC驱动连接 pg。

查到在驱动网站的文档中,有一个参数 stringtype (String) 可能和这个问题有关。

https://jdbc.postgresql.org/documentation/use/

  • stringtype (String) Default null
    Specify the type to use when binding PreparedStatement parameters set via setString() . If stringtype is set to VARCHAR (the default), such parameters will be sent to the server as varchar parameters. If stringtype is set to unspecified , parameters will be sent to the server as untyped values, and the server will attempt to infer an appropriate type. This is useful if you have an existing application that uses setString() to set parameters that are actually some other type, such as integers, and you are unable to change the application to use an appropriate method such as setInt() 

于是,经过测试,在 数据连接 的时候,加上此参数,解决了问题。

jdbc:postgresql://<数据库IP:PORT>/<DBNAME>?stringtype=unspecified

 

 

分享扩散:

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

返回顶部 返回列表