--- title: "setNCharacterStream Method to java.io.Reader object - long | Microsoft Docs" ms.custom: "" ms.date: "01/19/2017" ms.prod: sql ms.prod_service: connectivity ms.reviewer: "" ms.technology: connectivity ms.topic: conceptual ms.assetid: 36396dc9-f109-4da0-bd64-726704046bbf author: David-Engel ms.author: v-daenge --- # setNCharacterStream Method (int, java.io.Reader, long) [!INCLUDE[Driver_JDBC_Download](../../../includes/driver_jdbc_download.md)] Sets the designated parameter to the specified Reader object. ## Syntax ``` public final void setNCharacterStream(int parameterIndex, java.io.Reader value, long length) ``` #### Parameters *parameterIndex* An **int** that indicates the parameter index. *value* A Reader object that contains the parameter value. *length* A **long** that indicates the number of characters in the parameter value. ## Exceptions [SQLServerException](../../../connect/jdbc/reference/sqlserverexception-class.md) ## Remarks This setNCharacterStream method is specified by the setNCharacterStream method in the java.sql.PreparedStatement interface. This method should be used for **NCHAR**, **NVARCHAR**, **NTEXT**, and **XML** data types. If the length of the stream is different than what is specified in the *length* parameter, the JDBC driver throws an exception when the row is updated or inserted. If the length of the stream is unknown, the *length* parameter may be set to -1 to indicate that the driver should accept the stream regardless of its length. With sqljdbc4.jar, we recommend that you use the JDBC 4.0 method [setNCharacterStream Method (int, java.io.Reader)](../../../connect/jdbc/reference/setncharacterstream-method-int-java-io-reader.md) when the application wants to update the column from a stream whose length is unknown. ## See Also [setNCharacterStream Method (SQLServerPreparedStatement)](../../../connect/jdbc/reference/setncharacterstream-method-sqlserverpreparedstatement.md) [SQLServerPreparedStatement Members](../../../connect/jdbc/reference/sqlserverpreparedstatement-members.md)