RE: Problem in java with getting japanese values from database

>Hi
>
>I am using SQL server2000 and jakarta tomcat 3.1
>If I try to fetch japanese data from the database
>I get the value as ??. The db driver that I am
>using is sun.jdbc.odbc.JdbcOdbcDriver
>
>How do I get correct japanese values from the
>database?
>
>regards
>Mubariz

Depending on the column datatype and your
JDBC driver you may need to denote quote-
delimited Unicode data in your SQL statements
with an 'N' like in this INSERT:

insert into items(
   id, ..., item_ntext
)values(
   1001, ..., N"Some Japanese text"
)

Then again this may only apply to INSERTs
and UPDATEs.

Or could you be seeing the JSP problem
that JDBC returns the UTF-8 data as a
stream of ISO-8859-1 which therefore
needs to be "decoded" as UTF-8 like this:

   String f=request.getParameter("data");
   if(f!=null){
      f = new String(f.getBytes("ISO-8859-1"), "UTF-8");
   }

/Chris

Chris Cowperthwait
Sr. Technical Consultant
Professional Services
GlobalSight Corporation
E: chris@globalsight.com
P: (720) 622-4005
F: (720) 622-4001
M: (303) 249-2188

Received on Wednesday, 19 June 2002 10:37:31 UTC