aspose file tools*
The moose likes JDBC and the fly likes UTF8 conversion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "UTF8 conversion " Watch "UTF8 conversion " New topic
Author

UTF8 conversion

Hanish Desai
Greenhorn

Joined: Oct 29, 2002
Posts: 4
Hi All,
We have an application running on Solaris 8 which checks an oracle database
and a java servlet sends out the mails at regular intervals based on the
status whether the message was sent or not.
The application has been running fine until now for abt 10 months. But today
morning we noticed that all mailing services had stopped. When we
investigated further we found that there was one message which was holding
the entire queue and none of the mails posted after that were being sent.
On checking the logs we found this error. "Fail to convert between UTF8 and
UCS2: failUTF8Conv"

Apparently it talks abt chracter set conversion in the database. The message
that was blocking was in some other language other than english, possibly
french. And we use Oracle 8 thin drivers to connect to the database and the
jdk version is jdk1.2.2.
Has somebody faced the same problem and is there any solution to this.. I
did check each of the sites Google fished out to me.. but they only talk
more about the problem rather than the solution to the problem.

Please help me with this problem..
Here is the content of the log file..
java.sql.SQLException: Fail to convert between UTF8 and UCS2: failUTF8Conv
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.sql.SQLException.<init>(SQLException.java:43)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:156)
at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:775)
at
oracle.jdbc.dbaccess.DBConversion.failUTF8Conv(DBConversion.java:1746)
at oracle.jdbc.dbaccess.DBConversion.utf8BytesToJavaChars(Compiled
Code)
at oracle.jdbc.dbaccess.DBConversion.utf8BytesToString(Compiled
Code)
at oracle.jdbc.dbaccess.DBConversion.CharBytesToString(Compiled
Code)
at oracle.jdbc.driver.OracleStatement.getStringValue(Compiled Code)
at oracle.jdbc.driver.OracleStatement.getObjectValue(Compiled Code)
at oracle.jdbc.driver.OracleStatement.getObjectValue(Compiled Code)
at oracle.jdbc.driver.OracleResultSetImpl.getObject(Compiled Code)
at sun.jdbc.rowset.CachedRowSet.populate(Compiled Code)
at com.sapient.core.sql.SQLCachedRowSet.populate(Compiled Code)
at com.sapient.core.sql.SQLWrapper.executeQueryStoredProc(Compiled
Code)
at com.sapient.core.sql.SQLWrapper.executeQueryStoredProc(Compiled
Code)
at com.edward.mailwrapper.MailUtil.getUnsentMailsParameters(Compiled
Code)
at com.edward.mailwrapper.MailService.performScheduledTask(Compiled
Code)
at atg.service.scheduler.ScheduledJob.runJobs(Compiled Code)
at atg.service.scheduler.Scheduler$2$handler.run(Scheduler.java:694)
Message----> Fail to convert between UTF8 and UCS2: failUTF8Conv
SQLCode----> 17037 SQLState----> null
--java.sql.SQLException: Fail to convert between UTF8 and UCS2: failUTF8Conv

Please Help....
Hanis Desai.
Tim Morrow
Greenhorn

Joined: Sep 17, 2003
Posts: 11
Is there any reason why this question is a cut-and-paste replica of a question posted to a mailing list about 11 months ago?
Duplicate Question
Maybe you could email that person and ask if they found a solution?
Mike Nightsky
Ranch Hand

Joined: Aug 18, 2001
Posts: 48
Did you get an answer, for your question and/or form the person who asked the question?

Its an annoying problem and i also found no solution.


Win the opportunity to make money on the Internet<br /><a href="http://sweeps.sitesell.com/minirich.html" target="_blank" rel="nofollow">http://sweeps.sitesell.com/minirich.html</a>
Bob Dobalina
Ranch Hand

Joined: May 24, 2001
Posts: 53
I, too, would love to know.
Bob Dobalina
Ranch Hand

Joined: May 24, 2001
Posts: 53
Ok, I tried new JDBC drivers from oracle, 10.1.0.2.0, and the problem went away. This is surprising, as it's still an 8.1.7 DB and we were using 8.1.7 drivers previously.

Anyway, if you see this problem, give this a shot.
Abhilash Kesavadas
Greenhorn

Joined: Feb 21, 2007
Posts: 1
Hi,

I had to maintain an old java application where I got the same exception:

java.sql.SQLException: Fail to convert between UTF8 and UCS2: failUTF8Conv

This exception comes when the application tried to retreive Taiwanese (multi byte) data from a Oracle 9i UTF8 database.
The excetion stems out of the resultset.getString() method used to fetch data, so it is a driver level problem. Possibly its got something to do with the way the metod is implemented in the old 8i or 9i driver.

To fix the problem there are 2 options :
Option 1: Upgrade to oracle 10g driver by getting new classes12.jar from Orcale website.
or
Option 2: Retreive data as a byte stream. The sample code would look like :

InputStream is_var = result_Set.getBinaryStream("COLMN_NAME");
if ( is_var != null )
{
BufferedReader br_var = new BufferedReader(
new InputStreamReader( is_var ));
if(br_var != null )
{
String str_var = br_var.readLine();
}
}

Cheers,
Abhilash
[ February 21, 2007: Message edited by: Abhilash Kesavadas ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: UTF8 conversion