Implicit conversion from data type text to nvarchar is not allowed.
- From: Bo Zhu <ffkiller@xxxxxxxxxxxxxxxxx>
- Date: Thu, 17 Aug 2006 18:56:35 +0800
Hi,
The new SQL Server 2005 JDBC driver 1.0 release is giving me some headache.
Due to some indexing problem, we used the setAsciiStream() method in PreparedStatement class instead of the setString() method to populate a VARCHAR field with Java String object (Some guy in my team told me using setString() to store Java String in DB VARCHAR field will make table index unusable). It works fine with the old SQL Server 2000 JDBC driver, but when I upgraded the driver to 2005 (SQL Server is still 2000), I got this weird exception:
com.microsoft.sqlserver.jdbc.SQLServerException: Implicit conversion from data type text to nvarchar is not allowed. Use the CONVERT function to run this query.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.IOBuffer.processPackets(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.sendExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteUpdate(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown Source)
at JDBCDriverTest.main(JDBCDriverTest.java:22)
The exception didn't occur when I tested the same piece of code against SQL Server 2005. So I think there is something wrong with the compatibility mode of SQL Server 2005 JDBC Driver.
Does anyone have good explanations for that?
.
- Follow-Ups:
- RE: Implicit conversion from data type text to nvarchar is not allowed.
- From: Matt Weber [MSFT]
- RE: Implicit conversion from data type text to nvarchar is not allowed.
- Prev by Date: RE: Atteched DB's only "read only"
- Next by Date: Re: MS SQL Server 2005 JDBC Driver Performance Issue
- Previous by thread: Re: JDBC driver for SQL server 7.0
- Next by thread: RE: Implicit conversion from data type text to nvarchar is not allowed.
- Index(es):
Relevant Pages
|
Loading