FacebookTwitter
Hatrack River Forum   
my profile login | search | faq | forum home

  next oldest topic   next newest topic
» Hatrack River Forum » Active Forums » Books, Films, Food and Culture » Database tech (JDBC) question

   
Author Topic: Database tech (JDBC) question
MrSquicky
Member
Member # 1802

 - posted      Profile for MrSquicky   Email MrSquicky         Edit/Delete Post 
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?

Posts: 10177 | Registered: Apr 2001  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
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]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Dagonee
Member
Member # 5818

 - posted      Profile for Dagonee           Edit/Delete Post 
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.

Posts: 26071 | Registered: Oct 2003  |  IP: Logged | Report this post to a Moderator
   

   Close Topic   Feature Topic   Move Topic   Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:


Contact Us | Hatrack River Home Page

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