public interface PreparedStatement
implements Statement
| java.sql.PreparedStatement |
| |
表示预编译的SQL语句的对象。
一个SQL语句被预编译并存储在一个PreparedStatement对象中。 然后可以使用此对象多次高效地执行此语句。
注意:setter方法( setShort , setString用于设置IN参数值必须指定与所定义的SQL类型的输入参数的兼容的类型,等等)。 例如,如果IN参数的SQL类型为INTEGER ,则应使用方法setInt 。
如果需要任意参数类型转换,则方法 setObject应与目标SQL类型一起使用。
在以下设置参数的示例中, con表示活动连接:
PreparedStatement pstmt = con.prepareStatement("UPDATE EMPLOYEES
SET SALARY = ? WHERE ID = ?");
pstmt.setBigDecimal(1, 153833.00)
pstmt.setInt(2, 110592)
Inherited constants |
|---|
java.sql.Statement
|
公共方法(Public methods) |
|
|---|---|
abstract void |
addBatch() 向这个 |
abstract void |
clearParameters() 立即清除当前参数值。 |
abstract boolean |
execute() 执行此 |
abstract ResultSet |
executeQuery() 执行此 |
abstract int |
executeUpdate() 执行在该SQL语句 |
abstract ResultSetMetaData |
getMetaData() 检索一个 |
abstract ParameterMetaData |
getParameterMetaData() 检索此 |
abstract void |
setArray(int parameterIndex, Array x) 将指定参数设置为给定的 |
abstract void |
setAsciiStream(int parameterIndex, InputStream x, long length) 将指定的参数设置为给定的输入流,该输入流将具有指定的字节数。 |
abstract void |
setAsciiStream(int parameterIndex, InputStream x) 将指定的参数设置为给定的输入流。 |
abstract void |
setAsciiStream(int parameterIndex, InputStream x, int length) 将指定的参数设置为给定的输入流,该输入流将具有指定的字节数。 |
abstract void |
setBigDecimal(int parameterIndex, BigDecimal x) 将指定参数设置为给定的 |
abstract void |
setBinaryStream(int parameterIndex, InputStream x, long length) 将指定的参数设置为给定的输入流,该输入流将具有指定的字节数。 |
abstract void |
setBinaryStream(int parameterIndex, InputStream x) 将指定的参数设置为给定的输入流。 |
abstract void |
setBinaryStream(int parameterIndex, InputStream x, int length) 将指定的参数设置为给定的输入流,该输入流将具有指定的字节数。 |
abstract void |
setBlob(int parameterIndex, InputStream inputStream, long length) 将指定的参数设置为 |
abstract void |
setBlob(int parameterIndex, InputStream inputStream) 将指定参数设置为 |
abstract void |
setBlob(int parameterIndex, Blob x) 将指定的参数设置为给定的 |
abstract void |
setBoolean(int parameterIndex, boolean x) 将指定的参数设置为给定的Java |
abstract void |
setByte(int parameterIndex, byte x) 将指定的参数设置为给定的Java |
abstract void |
setBytes(int parameterIndex, byte[] x) 将指定参数设置为给定的Java字节数组。 |
abstract void |
setCharacterStream(int parameterIndex, Reader reader, long length) 将指定的参数设置为给定的 |
abstract void |
setCharacterStream(int parameterIndex, Reader reader, int length) 将指定的参数设置为给定的 |
abstract void |
setCharacterStream(int parameterIndex, Reader reader) 将指定参数设置为给定的 |
abstract void |
setClob(int parameterIndex, Clob x) 将指定参数设置为给定的 |
abstract void |
setClob(int parameterIndex, Reader reader, long length) 将指定参数设置为 |
abstract void |
setClob(int parameterIndex, Reader reader) 将指定参数设置为 |
abstract void |
setDate(int parameterIndex, Date x) 使用运行应用程序的虚拟机的默认时区将指定参数设置为给定的 |
abstract void |
setDate(int parameterIndex, Date x, Calendar cal) 使用给定的 |
abstract void |
setDouble(int parameterIndex, double x) 将指定参数设置为给定的Java |
abstract void |
setFloat(int parameterIndex, float x) 将指定的参数设置为给定的Java |
abstract void |
setInt(int parameterIndex, int x) 将指定的参数设置为给定的Java |
abstract void |
setLong(int parameterIndex, long x) 将指定的参数设置为给定的Java |
abstract void |
setNCharacterStream(int parameterIndex, Reader value, long length) 将指定的参数设置为 |
abstract void |
setNCharacterStream(int parameterIndex, Reader value) 将指定参数设置为 |
abstract void |
setNClob(int parameterIndex, Reader reader, long length) 将指定参数设置为 |
abstract void |
setNClob(int parameterIndex, NClob value) 将指定参数设置为 |
abstract void |
setNClob(int parameterIndex, Reader reader) 将指定的参数设置为 |
abstract void |
setNString(int parameterIndex, String value) 将指定的参数设置为给定的 |
abstract void |
setNull(int parameterIndex, int sqlType, String typeName) 将指定的参数设置为SQL |
abstract void |
setNull(int parameterIndex, int sqlType) 将指定参数设置为SQL |
abstract void |
setObject(int parameterIndex, Object x, int targetSqlType) 用给定的对象设置指定参数的值。 |
abstract void |
setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) 用给定的对象设置指定参数的值。 |
abstract void |
setObject(int parameterIndex, Object x) 使用给定对象设置指定参数的值。 |
abstract void |
setRef(int parameterIndex, Ref x) 将指定参数设置为给定的 |
abstract void |
setRowId(int parameterIndex, RowId x) 将指定参数设置为给定的 |
abstract void |
setSQLXML(int parameterIndex, SQLXML xmlObject) 将指定的参数设置为给定的 |
abstract void |
setShort(int parameterIndex, short x) 将指定参数设置为给定的Java |
abstract void |
setString(int parameterIndex, String x) 将指定的参数设置为给定的Java |
abstract void |
setTime(int parameterIndex, Time x, Calendar cal) 使用给定的 |
abstract void |
setTime(int parameterIndex, Time x) 将指定参数设置为给定的 |
abstract void |
setTimestamp(int parameterIndex, Timestamp x) 将指定参数设置为给定的 |
abstract void |
setTimestamp(int parameterIndex, Timestamp x, Calendar cal) 使用给定的 |
abstract void |
setURL(int parameterIndex, URL x) 将指定的参数设置为给定的 |
abstract void |
setUnicodeStream(int parameterIndex, InputStream x, int length) 此方法在API级别1中已弃用。已弃用。 |
继承方法(Inherited methods) |
|
|---|---|
java.sql.Statement
|
|
java.sql.Wrapper
|
|
java.lang.AutoCloseable
|
|
void addBatch ()
向此 PreparedStatement对象的一批命令添加一组参数。
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed PreparedStatement |
也可以看看:
void clearParameters ()
立即清除当前参数值。
通常,重复使用语句的参数值仍然有效。 设置参数值会自动清除其以前的值。 但是,在某些情况下,立即释放当前参数值使用的资源非常有用; 这可以通过调用方法clearParameters来完成。
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed PreparedStatement |
boolean execute ()
执行此PreparedStatement对象中的SQL语句,该对象可能是任何种类的SQL语句。 一些准备好的语句返回多个结果 execute方法处理这些复杂的语句以及由方法executeQuery和executeUpdate处理的简单形式的语句。
execute方法返回boolean以指示第一个结果的形式。 您必须调用方法getResultSet或getUpdateCount来检索结果; 您必须致电getMoreResults移至任何后续结果。
| 返回(Returns) | |
|---|---|
boolean |
true if the first result is a ResultSet object; false if the first result is an update count or there is no result |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs; this method is called on a closed PreparedStatement or an argument is supplied to this method |
SQLTimeoutException |
when the driver has determined that the timeout value that was specified by the setQueryTimeout method has been exceeded and has at least attempted to cancel the currently running Statement |
ResultSet executeQuery ()
执行此 PreparedStatement对象中的SQL查询并返回查询生成的 ResultSet对象。
| 返回(Returns) | |
|---|---|
ResultSet |
a ResultSet object that contains the data produced by the query; never null |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs; this method is called on a closed PreparedStatement or the SQL statement does not return a ResultSet object |
SQLTimeoutException |
when the driver has determined that the timeout value that was specified by the setQueryTimeout method has been exceeded and has at least attempted to cancel the currently running Statement |
int executeUpdate ()
执行在该SQL语句PreparedStatement对象,它必须是一个SQL数据操纵语言(DML)语句,比如INSERT , UPDATE或DELETE ; 或者不返回任何内容的SQL语句,如DDL语句。
| 返回(Returns) | |
|---|---|
int |
either (1) the row count for SQL Data Manipulation Language (DML) statements or (2) 0 for SQL statements that return nothing |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs; this method is called on a closed PreparedStatement or the SQL statement returns a ResultSet object |
SQLTimeoutException |
when the driver has determined that the timeout value that was specified by the setQueryTimeout method has been exceeded and has at least attempted to cancel the currently running Statement |
ResultSetMetaData getMetaData ()
检索 ResultSetMetaData对象包含有关列信息 ResultSet这个时将返回的对象 PreparedStatement执行对象。
由于PreparedStatement对象是预编译的,因此可以了解它将返回而不必执行它的ResultSet对象。 因此,可以在PreparedStatement对象上调用方法getMetaData ,而不是等待执行它,然后在返回的ResultSet对象上调用ResultSet.getMetaData方法。
注意:由于缺乏底层DBMS支持,对于某些驱动程序使用此方法可能会很昂贵。
| 返回(Returns) | |
|---|---|
ResultSetMetaData |
the description of a ResultSet object's columns or null if the driver cannot return a ResultSetMetaData object |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
ParameterMetaData getParameterMetaData ()
检索此 PreparedStatement对象参数的数量,类型和属性。
| 返回(Returns) | |
|---|---|
ParameterMetaData |
a ParameterMetaData object that contains information about the number, types and properties for each parameter marker of this PreparedStatement object |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed PreparedStatement |
也可以看看:
void setArray (int parameterIndex,
Array x)
将指定参数设置为给定的java.sql.Array对象。 驱动程序在将它发送到数据库时将其转换为SQL ARRAY值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
Array: an Array object that maps an SQL ARRAY value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setAsciiStream (int parameterIndex,
InputStream x,
long length)
将指定的参数设置为给定的输入流,该输入流将具有指定的字节数。 当一个非常大的ASCII值输入到LONGVARCHAR参数时,通过java.io.InputStream发送它可能更实际。 数据将根据需要从流中读取,直到达到文件结束。 JDBC驱动程序将执行从ASCII到数据库字符格式的任何必要转换。
注意:此流对象既可以是标准的Java流对象,也可以是实现标准接口的自己的子类。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
InputStream: the Java input stream that contains the ASCII parameter value |
length |
long: the number of bytes in the stream |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setAsciiStream (int parameterIndex,
InputStream x)
将指定的参数设置为给定的输入流。 当一个非常大的ASCII值输入到LONGVARCHAR参数中时,通过java.io.InputStream发送它可能更实际。 数据将根据需要从流中读取,直到达到文件结束。 JDBC驱动程序将执行从ASCII到数据库字符格式的任何必要转换。
注意:此流对象既可以是标准的Java流对象,也可以是实现标准接口的自己的子类。
注意:请查阅您的JDBC驱动程序文档以确定使用带有长度参数的 setAsciiStream版本是否更有效。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
InputStream: the Java input stream that contains the ASCII parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setAsciiStream (int parameterIndex,
InputStream x,
int length)
将指定的参数设置为给定的输入流,该输入流将具有指定的字节数。 当一个非常大的ASCII值输入到LONGVARCHAR参数时,通过java.io.InputStream发送它可能更实际。 数据将根据需要从流中读取,直到达到文件结束。 JDBC驱动程序将执行从ASCII到数据库字符格式的任何必要转换。
注意:此流对象既可以是标准的Java流对象,也可以是实现标准接口的自己的子类。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
InputStream: the Java input stream that contains the ASCII parameter value |
length |
int: the number of bytes in the stream |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setBigDecimal (int parameterIndex,
BigDecimal x)
将指定参数设置为给定的java.math.BigDecimal值。 驱动程序在将它发送到数据库时将其转换为SQL NUMERIC值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
BigDecimal: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setBinaryStream (int parameterIndex,
InputStream x,
long length)
将指定的参数设置为给定的输入流,该输入流将具有指定的字节数。 当一个非常大的二进制值输入到LONGVARBINARY参数中时,通过java.io.InputStream对象发送它可能更实用。 数据将根据需要从流中读取,直到达到文件结尾。
注意:此流对象既可以是标准的Java流对象,也可以是实现标准接口的自己的子类。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
InputStream: the java input stream which contains the binary parameter value |
length |
long: the number of bytes in the stream |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setBinaryStream (int parameterIndex,
InputStream x)
将指定的参数设置为给定的输入流。 当一个非常大的二进制值输入到LONGVARBINARY参数中时,通过java.io.InputStream对象发送它可能更实用。 数据将根据需要从流中读取,直到达到文件结尾。
注意:此流对象既可以是标准的Java流对象,也可以是实现标准接口的自己的子类。
注:请查阅您的JDBC驱动程序文档以确定使用带有长度参数的 setBinaryStream版本是否更有效。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
InputStream: the java input stream which contains the binary parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setBinaryStream (int parameterIndex,
InputStream x,
int length)
将指定的参数设置为给定的输入流,该输入流将具有指定的字节数。 当一个非常大的二进制值输入到LONGVARBINARY参数中时,通过java.io.InputStream对象发送它可能更实际。 数据将根据需要从流中读取,直到达到文件结尾。
注意:此流对象既可以是标准的Java流对象,也可以是实现标准接口的自己的子类。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
InputStream: the java input stream which contains the binary parameter value |
length |
int: the number of bytes in the stream |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setBlob (int parameterIndex,
InputStream inputStream,
long length)
将指定的参数设置为InputStream对象。 输入流必须包含由长度指定的字符数,否则执行SQLException将生成PreparedStatement 。 此方法与setBinaryStream (int, InputStream, int)方法不同,因为它通知驱动程序参数值应该作为BLOB发送到服务器。 当使用setBinaryStream方法时,驱动程序可能需要做额外的工作来确定参数数据是否应作为LONGVARBINARY或BLOB发送到服务器
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: index of the first parameter is 1, the second is 2, ... |
inputStream |
InputStream: An object that contains the data to set the parameter value to. |
length |
long: the number of bytes in the parameter data. |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs; this method is called on a closed PreparedStatement; if the length specified is less than zero or if the number of bytes in the inputstream does not match the specfied length. |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setBlob (int parameterIndex,
InputStream inputStream)
将指定的参数设置为InputStream对象。 此方法与setBinaryStream (int, InputStream)方法不同,因为它通知驱动程序参数值应该作为BLOB发送到服务器。 当使用setBinaryStream方法时,驱动程序可能需要做额外的工作来确定参数数据是否应作为LONGVARBINARY或BLOB发送到服务器
注意:请查阅您的JDBC驱动程序文档以确定使用带有长度参数的 setBlob版本是否更有效。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: index of the first parameter is 1, the second is 2, ... |
inputStream |
InputStream: An object that contains the data to set the parameter value to. |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs; this method is called on a closed PreparedStatement or if parameterIndex does not correspond to a parameter marker in the SQL statement, |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setBlob (int parameterIndex,
Blob x)
将指定参数设置为给定的java.sql.Blob对象。 驱动程序在将它发送到数据库时将其转换为SQL BLOB值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
Blob: a Blob object that maps an SQL BLOB value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setBoolean (int parameterIndex,
boolean x)
将指定的参数设置为给定的Java boolean值。 驱动程序在将它发送到数据库时将其转换为SQL BIT或BOOLEAN值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
boolean: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setByte (int parameterIndex,
byte x)
将指定参数设置为给定的Java byte值。 驱动程序在将它发送到数据库时将其转换为SQL TINYINT值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
byte: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setBytes (int parameterIndex,
byte[] x)
将指定参数设置为给定的Java字节数组。 当驱动程序将它发送到数据库时,它会将其转换为SQL VARBINARY或LONGVARBINARY (具体取决于参数的大小(相对于驱动程序的VARBINARY值)。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
byte: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setCharacterStream (int parameterIndex,
Reader reader,
long length)
将指定的参数设置为给定的Reader对象,该对象是给定的字符长度。 当一个非常大的UNICODE值输入到LONGVARCHAR参数时,通过java.io.Reader对象发送它可能更实际。 数据将根据需要从流中读取,直到达到文件结尾。 JDBC驱动程序将执行从UNICODE到数据库字符格式的任何必要转换。
注意:此流对象既可以是标准的Java流对象,也可以是实现标准接口的自己的子类。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
reader |
Reader: the java.io.Reader object that contains the Unicode data |
length |
long: the number of characters in the stream |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setCharacterStream (int parameterIndex,
Reader reader,
int length)
将指定的参数设置为给定的Reader对象,该对象是给定的字符长度。 当一个非常大的UNICODE值输入到LONGVARCHAR参数中时,通过java.io.Reader对象发送它可能更实用。 数据将根据需要从流中读取,直到达到文件结尾。 JDBC驱动程序将执行从UNICODE到数据库字符格式的任何必要转换。
注意:此流对象既可以是标准的Java流对象,也可以是实现标准接口的自己的子类。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
reader |
Reader: the java.io.Reader object that contains the Unicode data |
length |
int: the number of characters in the stream |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setCharacterStream (int parameterIndex,
Reader reader)
将指定参数设置为给定的Reader对象。 当一个非常大的UNICODE值输入到LONGVARCHAR参数时,通过java.io.Reader对象发送它可能更实际。 数据将根据需要从流中读取,直到达到文件结尾。 JDBC驱动程序将执行从UNICODE到数据库字符格式的任何必要转换。
注意:此流对象既可以是标准的Java流对象,也可以是实现标准接口的自己的子类。
注:请查阅您的JDBC驱动程序文档,以确定使用带有长度参数的 setCharacterStream版本是否更有效。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
reader |
Reader: the java.io.Reader object that contains the Unicode data |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setClob (int parameterIndex,
Clob x)
将指定参数设置为给定的java.sql.Clob对象。 驱动程序在将它发送到数据库时将其转换为SQL CLOB值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
Clob: a Clob object that maps an SQL CLOB value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setClob (int parameterIndex,
Reader reader,
long length)
将指定的参数设置为Reader对象。 阅读器必须包含由长度指定的字符数,否则当执行SQLException将生成PreparedStatement 。 此方法与setCharacterStream (int, Reader, int)方法不同,因为它通知驱动程序参数值应该作为CLOB发送到服务器。 当使用setCharacterStream方法时,驱动程序可能需要做额外的工作来确定参数数据是否应作为LONGVARCHAR或CLOB发送到服务器
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: index of the first parameter is 1, the second is 2, ... |
reader |
Reader: An object that contains the data to set the parameter value to. |
length |
long: the number of characters in the parameter data. |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs; this method is called on a closed PreparedStatement or if the length specified is less than zero. |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setClob (int parameterIndex,
Reader reader)
将指定的参数设置为Reader对象。 此方法与setCharacterStream (int, Reader)方法不同,因为它通知驱动程序参数值应该作为CLOB发送到服务器。 当使用setCharacterStream方法时,驱动程序可能需要做额外的工作来确定参数数据是否应作为LONGVARCHAR或CLOB发送到服务器
注意:请查阅您的JDBC驱动程序文档,以确定使用带有长度参数的 setClob版本是否更有效。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: index of the first parameter is 1, the second is 2, ... |
reader |
Reader: An object that contains the data to set the parameter value to. |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs; this method is called on a closed PreparedStatementor if parameterIndex does not correspond to a parameter marker in the SQL statement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setDate (int parameterIndex,
Date x)
使用运行应用程序的虚拟机的默认时区将指定参数设置为给定的java.sql.Date值。 驱动程序在将它发送到数据库时将其转换为SQL DATE值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
Date: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setDate (int parameterIndex,
Date x,
Calendar cal)
使用给定的Calendar对象将指定参数设置为给定的java.sql.Date值。 该驱动程序使用Calendar对象构造一个SQL DATE值,然后驱动程序DATE值发送到数据库。 使用Calendar对象时,驱动程序可以计算考虑到自定义时区的日期。 如果未指定Calendar对象,则驱动程序使用默认时区,即运行应用程序的虚拟机的时区。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
Date: the parameter value |
cal |
Calendar: the Calendar object the driver will use to construct the date |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setDouble (int parameterIndex,
double x)
将指定的参数设置为给定的Java double值。 驱动程序在将它发送到数据库时将其转换为SQL DOUBLE值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
double: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setFloat (int parameterIndex,
float x)
将指定的参数设置为给定的Java float值。 驱动程序在将其发送到数据库时将其转换为SQL REAL值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
float: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setInt (int parameterIndex,
int x)
将指定的参数设置为给定的Java int值。 驱动程序在将它发送到数据库时将其转换为SQL INTEGER值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
int: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setLong (int parameterIndex,
long x)
将指定的参数设置为给定的Java long值。 驱动程序在将它发送到数据库时将其转换为SQL BIGINT值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
long: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setNCharacterStream (int parameterIndex,
Reader value,
long length)
将指定的参数设置为Reader对象。 Reader读取数据直到达到文件结尾。 驱动程序将从Java字符格式转换为数据库中的国家字符集。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: of the first parameter is 1, the second is 2, ... |
value |
Reader: the parameter value |
length |
long: the number of characters in the parameter data. |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; if a database access error occurs; or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setNCharacterStream (int parameterIndex,
Reader value)
将指定的参数设置为Reader对象。 Reader读取数据直到达到文件结尾。 驱动程序将从Java字符格式转换为数据库中的国家字符集。
注意:此流对象既可以是标准的Java流对象,也可以是实现标准接口的自己的子类。
注意:请查阅您的JDBC驱动程序文档以确定使用带有长度参数的 setNCharacterStream版本是否更有效。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: of the first parameter is 1, the second is 2, ... |
value |
Reader: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; if a database access error occurs; or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setNClob (int parameterIndex,
Reader reader,
long length)
将指定参数设置为Reader对象。 阅读器必须包含由长度指定的字符数,否则当执行SQLException将生成PreparedStatement 。 此方法与setCharacterStream (int, Reader, int)方法不同,因为它通知驱动程序应将参数值作为NCLOB发送到服务器。 当使用setCharacterStream方法时,驱动程序可能需要做额外的工作来确定参数数据是否应作为LONGNVARCHAR或NCLOB发送到服务器
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: index of the first parameter is 1, the second is 2, ... |
reader |
Reader: An object that contains the data to set the parameter value to. |
length |
long: the number of characters in the parameter data. |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if the length specified is less than zero; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; if a database access error occurs or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setNClob (int parameterIndex,
NClob value)
将指定参数设置为java.sql.NClob对象。 驱动程序在将它发送到数据库时将其转换为SQL NCLOB值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: of the first parameter is 1, the second is 2, ... |
value |
NClob: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; if a database access error occurs; or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setNClob (int parameterIndex,
Reader reader)
将指定的参数设置为Reader对象。 此方法与setCharacterStream (int, Reader)方法不同,因为它通知驱动程序参数值应该作为NCLOB发送到服务器。 当使用setCharacterStream方法时,驱动程序可能需要做额外的工作来确定参数数据是否应作为LONGNVARCHAR或NCLOB发送到服务器
注:请查阅您的JDBC驱动程序文档,以确定使用带有长度参数的 setNClob版本是否更有效。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: index of the first parameter is 1, the second is 2, ... |
reader |
Reader: An object that contains the data to set the parameter value to. |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; if a database access error occurs or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setNString (int parameterIndex,
String value)
将指定的参数设置为给定的String对象。 驱动程序在将数据发送到数据库时,将其转换为SQL NCHAR或NVARCHAR或LONGNVARCHAR值(具体取决于参数的大小(相对于驱动程序的NVARCHAR值)。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: of the first parameter is 1, the second is 2, ... |
value |
String: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; if a database access error occurs; or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setNull (int parameterIndex,
int sqlType,
String typeName)
将指定的参数设置为SQL NULL 。 该版本的方法setNull应该用于用户定义的类型和REF类型参数。 用户定义类型的示例包括:STRUCT,DISTINCT,JAVA_OBJECT和命名数组类型。
注意:为了便于携带,应用程序必须在指定NULL用户定义参数或REF参数时提供SQL类型代码和完全限定的SQL类型名称。 在用户定义类型的情况下,名称是参数本身的类型名称。 对于REF参数,名称是引用类型的类型名称。 如果JDBC驱动程序不需要类型代码或类型名称信息,则可能会忽略它。 虽然它用于用户定义和Ref参数,但此方法可用于设置任何JDBC类型的null参数。 如果该参数没有用户定义或REF类型,则忽略给定的typeName。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
sqlType |
int: a value from java.sql.Types |
typeName |
String: the fully-qualified name of an SQL user-defined type; ignored if the parameter is not a user-defined type or REF |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if sqlType is a ARRAY, BLOB, CLOB, DATALINK, JAVA_OBJECT, NCHAR, NCLOB, NVARCHAR, LONGNVARCHAR, REF, ROWID, SQLXML or STRUCT data type and the JDBC driver does not support this data type or if the JDBC driver does not support this method |
void setNull (int parameterIndex,
int sqlType)
将指定参数设置为SQL NULL 。
注意:您必须指定参数的SQL类型。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
sqlType |
int: the SQL type code defined in java.sql.Types |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if sqlType is a ARRAY, BLOB, CLOB, DATALINK, JAVA_OBJECT, NCHAR, NCLOB, NVARCHAR, LONGNVARCHAR, REF, ROWID, SQLXML or STRUCT data type and the JDBC driver does not support this data type |
void setObject (int parameterIndex,
Object x,
int targetSqlType)
用给定的对象设置指定参数的值。 该方法与上面的方法setObject ,只是它假设比例为零。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
Object: the object containing the input parameter value |
targetSqlType |
int: the SQL type (as defined in java.sql.Types) to be sent to the database |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if targetSqlType is a ARRAY, BLOB, CLOB, DATALINK, JAVA_OBJECT, NCHAR, NCLOB, NVARCHAR, LONGNVARCHAR, REF, ROWID, SQLXML or STRUCT data type and the JDBC driver does not support this data type |
也可以看看:
void setObject (int parameterIndex,
Object x,
int targetSqlType,
int scaleOrLength)
用给定的对象设置指定参数的值。 第二个参数必须是一个对象类型; 对于整数值,应该使用java.lang等效对象。 如果第二个参数是InputStream那么该流必须包含scaleOrLength指定的字节数。 如果第二个参数是Reader则阅读器必须包含scaleOrLength指定的字符数。 如果这些条件不成立,驱动程序将在准备好的语句执行时生成一个SQLException 。
在发送给数据库之前,给定的Java对象将被转换为给定的targetSqlType。 如果对象具有自定义映射(属于实现接口SQLData的类),则JDBC驱动程序应调用方法SQLData.writeSQL将其写入SQL数据流。 如果,在另一方面,对象是实现一类Ref , Blob , Clob , NClob , Struct , java.net.URL ,或Array ,驾驶员应把它传递给数据库作为相应SQL类型的值。
请注意,此方法可用于传递数据库特定的抽象数据类型。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
Object: the object containing the input parameter value |
targetSqlType |
int: the SQL type (as defined in java.sql.Types) to be sent to the database. The scale argument may further qualify this type. |
scaleOrLength |
int: for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types, this is the number of digits after the decimal point. For Java Object types InputStream and Reader, this is the length of the data in the stream or reader. For all other types, this value will be ignored. |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs; this method is called on a closed PreparedStatement or if the Java Object specified by x is an InputStream or Reader object and the value of the scale parameter is less than zero |
SQLFeatureNotSupportedException |
if targetSqlType is a ARRAY, BLOB, CLOB, DATALINK, JAVA_OBJECT, NCHAR, NCLOB, NVARCHAR, LONGNVARCHAR, REF, ROWID, SQLXML or STRUCT data type and the JDBC driver does not support this data type |
也可以看看:
void setObject (int parameterIndex,
Object x)
使用给定对象设置指定参数的值。 第二个参数必须是Object ; 因此, java.lang等效对象应该用于内置类型。
JDBC规范指定了从Java Object类型到SQL类型的标准映射。 在发送给数据库之前,给定的参数将被转换为相应的SQL类型。
请注意,通过使用特定于驱动程序的Java类型,此方法可用于传递数据库特定的抽象数据类型。 如果对象是实现接口SQLData的类,则JDBC驱动程序应调用方法SQLData.writeSQL将其写入SQL数据流。 如果,在另一方面,对象是实现一类Ref , Blob , Clob , NClob , Struct , java.net.URL , RowId , SQLXML或Array ,驾驶员应把它传递给数据库作为相应SQL类型的值。
注意:并非所有数据库都允许将非类型的Null发送到后端。 为了获得最大的可移植性,应该使用setNull或setObject(int parameterIndex, Object x, int sqlType)方法而不是setObject(int parameterIndex, Object x) 。
注:如果存在歧义,则此方法会引发异常,例如,如果对象是实现多个上述接口的类的类。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
Object: the object containing the input parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs; this method is called on a closed PreparedStatement or the type of the given object is ambiguous |
void setRef (int parameterIndex,
Ref x)
将指定参数设置为给定的REF(<structured-type>)值。 驱动程序在将它发送到数据库时将其转换为SQL REF值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
Ref: an SQL REF value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setRowId (int parameterIndex,
RowId x)
将指定参数设置为给定的java.sql.RowId对象。 驱动程序在将它发送到数据库时将其转换为SQL ROWID值
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
RowId: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setSQLXML (int parameterIndex,
SQLXML xmlObject)
将指定参数设置为给定的java.sql.SQLXML对象。 驱动程序在将它发送到数据库时将其转换为SQL XML值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: index of the first parameter is 1, the second is 2, ... |
xmlObject |
SQLXML: a SQLXML object that maps an SQL XML value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs; this method is called on a closed PreparedStatement or the java.xml.transform.Result, Writer or OutputStream has not been closed for the SQLXML object |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setShort (int parameterIndex,
short x)
将指定的参数设置为给定的Java short值。 驱动程序在将它发送到数据库时将其转换为SQL SMALLINT值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
short: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setString (int parameterIndex,
String x)
将指定参数设置为给定的Java String值。 当驱动程序将其发送到数据库时,该驱动程序将其转换为SQL VARCHAR或LONGVARCHAR值(具体取决于参数与VARCHAR值上的驱动程序限制有关)。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
String: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setTime (int parameterIndex,
Time x,
Calendar cal)
使用给定的Calendar对象将指定参数设置为给定的java.sql.Time值。 该驱动程序使用Calendar对象构建SQL TIME值,然后驱动程序TIME值发送到数据库。 使用Calendar对象时,驱动程序可以计算考虑到自定义时区的时间。 如果未指定Calendar对象,则驱动程序使用默认时区,即运行应用程序的虚拟机的时区。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
Time: the parameter value |
cal |
Calendar: the Calendar object the driver will use to construct the time |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setTime (int parameterIndex,
Time x)
将指定参数设置为给定的java.sql.Time值。 驱动程序在将它发送到数据库时将其转换为SQL TIME值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
Time: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setTimestamp (int parameterIndex,
Timestamp x)
将指定参数设置为给定的java.sql.Timestamp值。 驱动程序在将它发送到数据库时将其转换为SQL TIMESTAMP值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
Timestamp: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setTimestamp (int parameterIndex,
Timestamp x,
Calendar cal)
使用给定的Calendar对象将指定参数设置为给定的java.sql.Timestamp值。 该驱动程序使用Calendar对象构造一个SQL TIMESTAMP值,然后驱动程序TIMESTAMP值发送到数据库。 使用Calendar对象时,驱动程序可以计算考虑到自定义时区的时间戳。 如果未指定Calendar对象,则该驱动程序使用默认时区,即运行该应用程序的虚拟机的时区。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
Timestamp: the parameter value |
cal |
Calendar: the Calendar object the driver will use to construct the timestamp |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
void setURL (int parameterIndex,
URL x)
将指定参数设置为给定的java.net.URL值。 驱动程序在将它发送到数据库时将其转换为SQL DATALINK值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
URL: the java.net.URL object to be set |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setUnicodeStream (int parameterIndex,
InputStream x,
int length)
此方法在API级别1中已弃用。
已过时。
将指定的参数设置为给定的输入流,该输入流将具有指定的字节数。 当一个非常大的Unicode值输入到LONGVARCHAR参数中时,通过java.io.InputStream对象发送它可能更实用。 数据将根据需要从流中读取,直到达到文件结尾。 JDBC驱动程序将执行从Unicode到数据库字符格式的任何必要转换。 正如Java虚拟机规范中所定义的,Unicode流的字节格式必须是Java UTF-8。
注意:此流对象既可以是标准的Java流对象,也可以是实现标准接口的自己的子类。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
InputStream: a java.io.InputStream object that contains the Unicode parameter value |
length |
int: the number of bytes in the stream |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |