Try out the following steps:
1. The database field lengths (NVARCHAR / NVARCHAR2 / NCHAR) have to be
declared at least three times the required variable length.
2. While inserting, the string should be preceded by the letter 'N' in
the insert query.
e.g. strQuery = "insert into TESTTABLE (ID ,NAME) values "
+intID+",N'"+originalstr+"')";
where NAME is defined as NVARCHAR / NVARCHAR2 / NCHAR
3. If the NCHAR/NVARCHAR type column has to be included in the where
clause of a select/update query, then the value to which it is compared,
should be preceded by the letter 'N'.
e.g. strQuery = "select count(1) from TESTTABLE where NAME LIKE
N'%"+searchstr+"%'";
Regards,
Milind
Neelu Mehta
<nmehta@MTCINDIA. To: [EMAIL PROTECTED]
COM> cc:
Sent by: A Subject: Re: handling of nvarchar
using CMPs
mailing list for
Enterprise
JavaBeans
development
<EJB-INTEREST@JAV
A.SUN.COM>
08/31/2002 04:04
PM
Please respond to
Neelu Mehta
I've tries all the options but still my problem is not solved yet.
According to my client we are not supposed to touch any database settings.
All we've do thru coding only.
Neelu
If you are supporting some of the Asian languages then ensure that you set
NLS_LANG = UTF8 in your OS and database.
All the JSPs, where multilingual support is to be implemented, should have
the content type set as UTF-8 in the header.
<%@page contentType="text/html; charset=utf-8" %>
If have not done the previous step:
In the servlet, conversion to UTF8 should done in the following manner.
String originalstr1 = (String) req.getParameter ("comment");
String originalstr = new String (originalstr1.getBytes
("ISO8859_1"),"UTF8");
For Weblogic 6.1, add the following entry in the web.xml file
<context-param>
<param-name>weblogic.httpd.inputCharset./</param-name>
<param-value>UTF-8</param-value>
</context-param>
For Tomcat, change the encoding in the first line of web.xml from
ISO-8859-1 to UTF-8
<?xml version="1.0" encoding="UTF-8"?>
Also some of the JDBC drivers do not support UTF-8 charcter set in entirety
so ensure that you use UTF-8 compliant DB driver.
Regards,
Milind
Manavendra Gupta
<[EMAIL PROTECTED]> To:
[EMAIL PROTECTED]
Sent by: A cc:
mailing list for Subject: Re: handling of
nvarchar using CMPs
Enterprise
JavaBeans
development
<EJB-INTEREST@JAV
A.SUN.COM>
08/29/2002 08:54
PM
Please respond to
Manavendra Gupta
What OS is your DB on? Check the NLS_LANG OS parameter - should be the same
as the character set on your DB.
With Warm Regards,
Manav.
----- Original Message -----
From: "Neelu Mehta" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 29, 2002 10:09 PM
Subject: handling of nvarchar using CMPs
> Hi All
>
> I'm using Oracle 9iAS and EJB 1.1. and Oracle8i as a backend. In
my one table I've some fields of type Nvarchar for multi lingual support.
> I'm facing problem while inserting data thru JSp to CMPs and finally
into
database.
> Error which I'm getting is Character set mismatch
>
>
> Can anybody help me to solve this problem
> Thanks in Advance
> Neelu
>
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff EJB-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
==========================================================================To
unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".