Mixture of utf-8 languages becomes ?.... or ''
Posted by: glloyd1
Date: June 21, 2005 08:59AM

I am trying to store a mixture of languages in a single table as utf-8 text, all of which becomes either ??... or in the case of french an empty string. I am using the connector/j driver.

This is my code that opens the connection:
String url = "jdbc:mysql://setdevdb1.setimes.com:3306/MetaDataDB?useUnicode=true&characterEncoding=UTF8";
Class.forName("com.mysql.jdbc.Driver");
Connection con =DriverManager.getConnection(url,"dba","setimes");
Statement st= con.createStatement();
st.execute("SET NAMES 'utf8'");
st.close();
st= con.createStatement();
ResultSet r= st.executeQuery("SHOW VARIABLES LIKE 'CHAR%'");
while(r.next())
{
System.out.println("Variable:"+ r.getString("Variable_name")+" Value:"+ r.getString("Value"));
}
r.close();
st.close();
return con;


SHOW VERSION() returns:
4.1.8-standard-log


SHOW VARIABLES LIKE 'CHAR%' returns the following:

Variable:character_set_client Value:utf8
Variable:character_set_connection Value:utf8
Variable:character_set_database Value:utf8
Variable:character_set_results Value:utf8
Variable:character_set_server Value:latin1
Variable:character_set_system Value:utf8
Variable:character_sets_dir Value:/usr/share/mysql/charsets/

SHOW CREATE TABLE MetaData returns:

CREATE TABLE `MetaData` (
`KEY` int(11) NOT NULL auto_increment,
`ID` varchar(255) NOT NULL default '',
`TITLE` varchar(255) NOT NULL default '',
`LANG` varchar(10) NOT NULL default 'en_GB',
`DATE` date NOT NULL default '0000-00-00',
`IMAGE` varchar(255) default NULL,
`TEASER` varchar(255) default NULL,
`SITE` varchar(10) NOT NULL default 'mewi',
PRIMARY KEY (`KEY`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8


Can somebody tell me what is wrong with this picture?



Edited 1 time(s). Last edit at 06/21/2005 09:02AM by glloyd1.

Options: ReplyQuote


Subject
Views
Written By
Posted
Mixture of utf-8 languages becomes ?.... or ''
2633
June 21, 2005 08:59AM
2299
July 05, 2005 01:13AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.