SQL server jdbc driver issues with UTF8 and NVARCHAR 
Author Message
 SQL server jdbc driver issues with UTF8 and NVARCHAR

I'm trying to internationalize a sqlserver 2000 db including support for
japanese text.
I have a table with 'NVARCHAR' type for unicode data.
I have changed the encoding on JSP pages to UTF8.
Having trouble passing japanese text from a webpage to the db through the

  CallableStatement stmt = con.prepareCall("{call usp_japinstest(?,?) }");


This will insert the text from textfields on the page to a table in the db.
However, something is breaking on the way to the db, because when i view the
data in SQLserver, I can see that the format is different than if I entered
it directly through enterprise manager.
When I retrieve it and display in the web browser, it does not display

If I directly insert unicode data through enterprise manager, it displays
fine in the web page.

Also, if I pass in data directly to the procedure instead of calling
'setObject' or 'setString', this also works.
for example:

CallableStatement stmt = con.prepareCall("{call usp_japinstest(
request.getParameter("japanese")  ,
 request.getParameter("english")   ) }");

this will work as far as getting data into the db in the right format and
displaying properly upon retrieval, however, i think its kind of a hack.
I would much rather use placeholders (?) with the setObject or setString
In reading the java api, it looks like there is no NVARCHAR type in
java.sql.Types and maybe the driver is converting to VARCHAR on the way into
the db??? could this be breaking the encoding?

any feedback is greatly appreciated.

Im currently setting up another machine with oracle db and oracle jdbc
driver to see if i encounter similar issues but would really like to avoid a
migration to oracle over jdbc driver issues.

thanks in advance

Sat, 15 Jan 2005 21:32:32 GMT
 [ 1 post ] 

 Relevant Pages 

1. SQL Server 7.0 ODBC Drivers and Unicode (nchar, nvarchar, ntext datatypes)

2. MS-SQL 2000 JDBC Driver issues with IBM WebSphere

3. Performance issues - WebLogic JDBC driver to MS-SQL

4. Microsoft SQL Server 7 with Microsoft SQL Server 2000 Driver for JDBC

5. Microsoft SQL Server 7 and Microsoft SQL Server 2000 Driver for JDBC

6. runtime error with Microsoft SQL Server JDBC driver and SQL Server 7

7. Character set conversion to UTF8 from WE8ISO8859P1 to UTF8

8. Solution: UCS2 / UTF8 / Oracle / Fail to convert between UTF8 and UCS2

9. UTF8 issues

10. jdbc driver classpath issue when java(j++) object called from vbscript in asp file

11. JDBC drivers installation issue ...

12. JDBC drivers installation issue ...

Powered by phpBB® Forum Software