简体   繁体   中英

Prepared Statement setter in JDBCCursor Item Reader

I am setting the value of String something like this:

ps.setString(1, "'Schema.tablename.Columnname','Schema.tablename.ColumnName'"); 

Then the prepared statement is setting the value as a blank string ( '' ).

Do I need escape characters here? I tried escaping the characters, but it is not working.

if you need single quote then do it as follows

ps.setString(1, "''Schema.tablename.Columnname'',''Schema.tablename.ColumnName''");

if don't need single quote then remove them

ps.setString(1, "Schema.tablename.Columnname,Schema.tablename.ColumnName");

Make sure you remove all single quotes if you dont want them. if want them then make sure for each single quote add extra single quote.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM