--- title: "setCharacterStream Method (int, java.io.Reader, int) | Microsoft Docs" ms.custom: "" ms.date: "01/19/2017" ms.prod: sql ms.prod_service: connectivity ms.reviewer: "" ms.technology: connectivity ms.topic: conceptual apiname: - "SQLServerPreparedStatement.setCharacterStream" apilocation: - "sqljdbc.jar" apitype: "Assembly" ms.assetid: 139a5b74-8d7d-41cf-991a-a142349c58f6 author: David-Engel ms.author: v-daenge --- # setCharacterStream Method (int, java.io.Reader, int) [!INCLUDE[Driver_JDBC_Download](../../../includes/driver_jdbc_download.md)] Sets the designated parameter to the given Reader object, which is the given number of characters long. ## Syntax ``` public final void setCharacterStream(int n, java.io.Reader reader, int length) ``` #### Parameters *n* An **int** that indicates the parameter number. *reader* A Reader object. *length* The number of characters. ## Exceptions [SQLServerException](../../../connect/jdbc/reference/sqlserverexception-class.md) ## Remarks This setCharacterStream method is specified by the setCharacterStream method in the java.sql.PreparedStatement interface. If the length of the stream is different than that 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 [setCharacterStream Method (int, java.io.Reader)](../../../connect/jdbc/reference/setcharacterstream-method-int-java-io-reader.md) when the application wants to update the column from a stream whose length is unknown. ## See Also [SQLServerPreparedStatement Members](../../../connect/jdbc/reference/sqlserverpreparedstatement-members.md) [SQLServerPreparedStatement Class](../../../connect/jdbc/reference/sqlserverpreparedstatement-class.md)