You are here: Re: JDBC - varchar or nvarchar fields? « MsSQL Server « IT news, forums, messages
Re: JDBC - varchar or nvarchar fields?

Posted by joeNOSPAM@BEA.com on 05/10/06 17:22

The Microsoft client-DBMS protocol sends string data in two possible
ways, and the DBMS will treat that data differently depending on
which way it was sent. If you have tables with indexes on varchar
columns, the DBMS *will not* use nvarchar data to search these
indexes, so you get ill-performing table scans. Similarly, if you have
indexes on nvarchar columns, the dbms will not use varchar data for
searches. This means your data and column types should match.
Java's 16-bit characters match the nvarchar form better. By default
most JDBC drivers for Microsoft will send string data as nvarchar so
they don't corrupt any potential 16-bit data. They also usually have
an optional property which will tell the driver to send strings as
varchar,
but they usually can't mix-and-match. Lastly, consider that you may
want to deal with internationalized strings. For these reasons, I
recommend that you standardize on NVARCHAR columns for your
string data.
Yes, nvarchar takes 16 bits per char where varchar takes 8, but
nowadays scrimping every last bit of disk space is not typically a
driving economic concern.

Joe Weinstein at BEA Systems

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация