# SQL Server 2000, JDBC drivers and Unicode
There is a serious performance problem that can arise when connecting a Java application to a SQL Server 2000 database. Many developers are not aware of the issue or how to avoid it. The essence of the problem is this: By default, most, if not all, Java middleware drivers send string parameters to SQL Server as unicode. If the unicode (16 bit) parameters reference VARCHAR (8 bit) key columns in an index, SQL Server will not use the index to resolve the query, resulting in many unnecessary table scans.Solution? Tell your driver to send ASCII parameters. Not ideal in some i18n situations(*), but perfectly useful in others. The article has a list of parms to set for common SQL Server drivers.
(*) Update: me not thinking. If you needed Unicode values, I guess you'd be using NVARCHAR anyway.
File under: java : {2005.12.05 21:45}