You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Paul Wallace <pw...@twowaytv.com.au> on 2005/09/12 04:13:07 UTC

PreparedStatement & Unicode & MySQL

Hi,
    I am having trouble inserting and retrieving Asian characters in my
MySQL DB using PreparedStatement. I have set up my table thus:
 
CREATE TABLE `messages` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `message_body` text NOT NULL,
  `sender_number` text NOT NULL,
  `shortcode` text NOT NULL,
  `image` longblob,
  PRIMARY KEY  (`id`)
) CHARACTER SET utf8 TYPE=MyISAM; 
 
and am inserting using a PreparedStatement -
pstmt.setString(indexOfColumnInQuestion, asianTextString); to insert in
to message_body. However, when viewing the column in the query browser,
and retrieving it from a ResultSet, it reads ????????????? ??? ???? and
so on (I am attempting to insert Thai characters in this instance).
 
Is there a method of PreparedStatement I am missing?
 
thanks and regards
 
Paul.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org