Gustavo:

I had a similar problem using PostgreSQL. I solved it changing my 
database encoding to UNICODE, which is what Java uses for String 
representation.

Hope it solves your problem. Regards,

Eduardo San Martín.
Concepción - Chile.


Gustavo Comba wrote:

> Hi,
>
> I'm having a strange problem. I'm developing a J2EE Web
> Application, with Entity Beans, Servlets, JSPs and so on. I've
> started to get character conversion problems, and I've isolated
> the piece of code giving me problems.
>
> The code is:
>
> DriverManager.registerDriver(new
> oracle.jdbc.driver.OracleDriver());
> Connection con = DriverManager.getConnection
> ("jdbc:oracle:thin:@oraclehost:1521:orcl", "user", "password");
> dumpTable(con, out);
> String updateStatement = "UPDATE IDIOMAS SET IDIOMA = ? WHERE
> IDIDIOMA = ? ";
> PreparedStatement prepStmt = con.prepareStatement
> (updateStatement);
> prepStmt.setString(1, m_Idioma);
> prepStmt.setLong(2, m_Id);
> prepStmt.executeUpdate();
> prepStmt.close();
> con.close();
>
> Where "m_Idioma", which is a standard java.lang.String, which
> eventually is "Español", and m_Id is a long with the primary key
> of the record I want to update.
>
> If I paste this code into a JSP, then I get the desired
> result, BUT, if I paste and run the code from a Servlet (exactly
> the same code), then my "Español" becomes "Espaýol"... I've
> tried almost everything, I've runned the Servlet on the J2EE
> server and locally whit the debugger, and the same result.
>
> My DataBase server is a Oracle 8.1.7 Database, and I'm using
> Oracle 9i Application Server OC4J (the Orion AS).
>
> The problem is the same with "á", "é", "í" and so on.
>
> I'll apreciate any kind of help you can give me.
>
> Thanks in advance, and please forgive my English.
>
> Gustavo Comba
>




Reply via email to