File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes trouble with string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "trouble with string" Watch "trouble with string" New topic

trouble with string

miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i'm developing a home app (swing standalone app and database) in my laptop (for a long time...)
my environment:
winXP home SP2
eclipse 3.1 with all updates
using visual editor for eclipse
hibernate 2.1.7
MySQL 4.1.10a-nt
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

my app is nearly finished, so i made a jar (troubles with this will follow) and tried it in my pc, wich is winXP pro SP2, and then installed the same MySQL; the jre is the very same

at a certain point my app has a button that populates some fields based in a hql query:

private final String QUERY_CONTRATO_T =

"from ContratoTecnica c "

+ "WHERE nomeActoMedico = ? "

+ "and tipoContrato = ? "

+ "order by nomeActoMedico asc, data desc";

both nomeActoMedico and tipoContrato are strings.
What happens is extraordinary: in my laptop everything goes fine, but in my pc the query doesnt return as expected, when strings include some characters, like:
"Conven��o", "Domic�lio" and so on

I dont have the smallest idea why this is happening

Can someone please give me any hint?


java amateur
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
Sounds like a character set issue. If this were Oracle I'd say you needed to use NVARCHAR and configure the database to allow 16-bit characters. Not sure how MySql deals with such issues, don't use it that often.

Reid - SCJP2 (April 2002)
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24183

Moving to "JDBC".

[Jess in Action][AskingGoodQuestions]
Consider Paul's rocket mass heater.
subject: trouble with string