Web tier: servlets, JSP, Web frameworks: how can we set a character in a prapared statement??
- Posted by: Maruthi Ram
- Posted on: March 25 2004 04:05 EST
for setting int, fload, double, String we have
setInt(), setFloat(), setDouble(), setString() respectively in prepared statement. how can we set a character from a prepared statement for a database with column type 'char'??
- how can we set a character in a prapared statement?? by Naresh kumar on March 25 2004 06:58 EST
- how can we set a character in a prapared statement?? by Paul Strack on March 25 2004 23:39 EST
You can use setString() method which can be applied for varchar in database
setString() works for char as well as varchar. Just bear in mind that if the string value you use is not long enough, the missing values will be padded with null characters.
This matter mainly for string retrieval: use getString().trim() to eliminate the null characters.