[英]JDBC: how to perform functions inside a prepared statement?
With this query 与此查询
INSERT INTO `schema`.`table` (`col1`, `col2`)
VALUES ('value1', unhex(sha2("value2", 256)));
how to prepare a statement for the jdbc driver with one value produced by those functions? 如何用这些函数产生的一个值为jdbc驱动程序准备一条语句?
preparedStatement = connect.prepareStatement("insert into schema.table values (?, ?)");
Use the following format to get the job done. 使用以下格式完成工作。
preparedStatement = connect.prepareStatement("insert into schema.table values (?, unhex(sha2(?,256)))");
preparedStatement.setString(1, "value1");
preparedStatement.setString(2, "value2");
尝试这个
preparedStatement = connect.prepareStatement("insert into schema.table values (?, unhex(sha2(?, 256)))");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.