我正在使用jdbc查询Redshift集群。该查询只有一个参数:
select * from table_name bc where bc.column_name ~ ? limit 10
我正在使用
提供参数stmt.setString(1, "expected_value");
查询执行失败,并带有异常:
org.postgresql.util.PSQLException: ERROR: The pattern must be a valid UTF-8 literal character expression
Detail:
-----------------------------------------------
error: The pattern must be a valid UTF-8 literal character expression
code: 8001
context:
query: 496280
location: cgx_impl.cpp:1902
process: padbmaster [pid=4192]
-----------------------------------------------
执行不带参数的查询可以正常工作:
select * from table_name bc where bc.column_name 'expected_value' ? limit 10
任何可能导致异常的想法?
答案 0 :(得分:0)
使用Amazon Redshift JDBC驱动程序: http://docs.aws.amazon.com/redshift/latest/mgmt/configure-jdbc-connection.html