How to use ibatis to insert records for NVARCHAR2

How can i insert a string into a NVARCHAR2 field using ibatis? i am puuting a string variable into a map, and pass the map to ibatis for processing, but i couldnt append the "N" in front of the string. e.g N'string'.
AngoraAsked:
Who is Participating?
 
AngoraAuthor Commented:
Hi, the problem is solved by writing an typehandler for the jdbcType: nvarchar
0
 
ksivananthCommented:
>>but i couldnt append the "N" in front of the string. e.g N'string'.

why you have to?
0
 
AngoraAuthor Commented:
i try inserting chinese character without the 'N', then data store is '??'
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
ksivananthCommented:
that means you are dealing with diff( DB is in diff charset than the string you store ) charsets, you should store them as unicode( if its in diff encoding, you need to convert it to unicode ) and set the appropriate charset in DB too!
0
 
AngoraAuthor Commented:
I try to use the direct jdbc connection with the N'string', and it actually work. So i not too sure what is missing when i use that with ibatis
0
 
AngoraAuthor Commented:
The sql statement that work is something like this:
INSERT INTO SomeMultiLangTable (userfname)
VALUES(N' " + Request.QueryString["lang"] + " ') ";

when i use this in ibatis , it become
INSERT INTO SomeMultiLangTable (userfname)
VALUES(#string#).

I use a map for the #string#, so i use map.add("string", " N' "+Request.QueryString["lang"] +" ' "), but this ended inserting " N'stringcontent' " to the database. and when i insert chinese char in, it insert ?? into it
0
 
Kevin CrossChief Technology OfficerCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.