This is topic Database tech (JDBC) question in forum Books, Films, Food and Culture at Hatrack River Forum.


To visit this topic, use this URL:
http://www.hatrack.com/ubb/main/ultimatebb.php?ubb=get_topic;f=2;t=030969

Posted by MrSquicky (Member # 1802) on :
 
I've got a MySQL 4.1 server running that I'm accessing with JDBC using the MySQL provided Connector/J 3.1 classes.

I'm having problems with some characters in sotred strings being turned into '?' when I'm retrieving them. So something like "‘life dilemmas’" turns into "?life dilemmas?". As you can imagine, this is pretty annoying.

They are all being inserted into the database correctly and are correct in the database and when retrieved using the MySQL Control Center gui. It's just when I get them with a JDBC query that they're getting corrupted/translated.

I figure it's a character set issue, as all the characters I'm having this problem for are non-standard, but I can't figure out how to fix it.

I've tried changing the character set when I open a connection using the DriverManager so that it looks like this:

Properties props = new Properties();
props.setProperty("charSet","windows-1250");
dbConn = DriverManager.getConnection(urlString, props);

I've used "utf-8", "iso-8859-1", "iso-8859-2", and "windows-1250" for the character set property.

I also changed the MySQL URL string used for connecting so that it adds the useUnicode=true property. But still no dice.

Does anyone know how I can go about solving this?
 
Posted by Hobbes (Member # 433) on :
 
My only help is that I think you're right about the char-set issue, but I'm not a MySQL guy, so... best of luck. :-|

Hobbes [Smile]
 
Posted by Dagonee (Member # 5818) on :
 
Try latin1 - that's the default.

Do you have access to the SHOW CREATE DATABASE command? That will tell you the default characterset.

Good luck.
 


Copyright © 2008 Hatrack River Enterprises Inc. All rights reserved.
Reproduction in whole or in part without permission is prohibited.


Powered by Infopop Corporation
UBB.classic™ 6.7.2