public interface RowSet
implements ResultSet
| javax.sql.RowSet |
该接口为JavaBeans TM组件模型的JDBC API添加了支持。 可以在Visual Bean开发环境中用作JavaBeans组件的行集可以在设计时创建和配置,并在运行时执行。
RowSet接口提供了一组JavaBeans属性,允许将RowSet实例配置为连接到JDBC数据源并从数据源读取一些数据。 A组的设置方法( setInt , setBytes , setString ,等)提供了一种方式来传递输入参数行集的命令属性。 该命令是行集从关系数据库获取数据时使用的SQL查询,通常情况下是这样。
RowSet接口支持JavaBeans事件,允许 RowSet集上发生事件时通知应用程序中的其他组件,例如其值发生更改。
RowSet接口是独一无二的,因为它旨在使用JDBC API的其余部分来实现。 换句话说, RowSet实现是一个在JDBC驱动程序“顶部”执行的软件层。 任何人都可以提供RowSet接口的实现,包括想要提供RowSet实现作为其JDBC产品一部分的JDBC驱动程序供应商。
一个RowSet对象可能会与数据源建立连接并在整个生命周期中维持该连接,在这种情况下,它被称为连接的行集。 行集还可以与数据源建立连接,从中获取数据,然后关闭连接。 这样的行集称为断开的行集。 断开连接的行集可能会在断开连接时更改其数据,然后将更改发送回原始数据源,但它必须重新建立连接才能完成此操作。
未连接的行集可能具有与其关联的读取器( RowSetReader对象)和写入器( RowSetWriter对象)。 读者可以用许多不同的方式实现,以便用数据填充行集,包括从非关系数据源获取数据。 作者还可以用许多不同的方式实现,以将对行集数据所做的更改传播回基础数据源。
行集很容易使用。 RowSet接口扩展了标准的java.sql.ResultSet接口。 RowSetMetaData接口扩展了java.sql.ResultSetMetaData接口。 因此,熟悉JDBC API的开发人员必须学习使用行集的最少数量的新API。 此外,使用JDBC ResultSet对象的第三方软件工具也很容易与行集配合使用。
Inherited constants |
|---|
java.sql.ResultSet
|
公共方法(Public methods) |
|
|---|---|
abstract void |
addRowSetListener(RowSetListener listener) 注册给定的侦听器,以便将会通知此 |
abstract void |
clearParameters() 清除为此 |
abstract void |
execute() 用数据填充这个 |
abstract String |
getCommand() 检索此对象的命令属性 |
abstract String |
getDataSourceName() 检索标识此 |
abstract boolean |
getEscapeProcessing() 检索是否为此 |
abstract int |
getMaxFieldSize() 检索某些列值可能返回的最大字节数。 |
abstract int |
getMaxRows() 检索此 |
abstract String |
getPassword() 检索用于创建数据库连接的密码。 |
abstract int |
getQueryTimeout() 检索驱动程序等待语句执行的最大秒数。 |
abstract int |
getTransactionIsolation() 检索为此 |
abstract Map<String, Class<?>> |
getTypeMap() 检索与此 |
abstract String |
getUrl() 检索url属性这个 |
abstract String |
getUsername() 检索用于为此 |
abstract boolean |
isReadOnly() 检索此 |
abstract void |
removeRowSetListener(RowSetListener listener) 从 |
abstract void |
setArray(int i, Array x) 将 |
abstract void |
setAsciiStream(String parameterName, InputStream x, int length) 将指定的参数设置为给定的输入流,该输入流将具有指定的字节数。 |
abstract void |
setAsciiStream(int parameterIndex, InputStream x) 将此 |
abstract void |
setAsciiStream(int parameterIndex, InputStream x, int length) 将此 |
abstract void |
setAsciiStream(String parameterName, InputStream x) 将指定的参数设置为给定的输入流。 |
abstract void |
setBigDecimal(int parameterIndex, BigDecimal x) 将此 |
abstract void |
setBigDecimal(String parameterName, BigDecimal x) 将指定参数设置为给定的 |
abstract void |
setBinaryStream(String parameterName, InputStream x) 将指定的参数设置为给定的输入流。 |
abstract void |
setBinaryStream(int parameterIndex, InputStream x, int length) 将此 |
abstract void |
setBinaryStream(String parameterName, InputStream x, int length) 将指定的参数设置为给定的输入流,该输入流将具有指定的字节数。 |
abstract void |
setBinaryStream(int parameterIndex, InputStream x) 将此 |
abstract void |
setBlob(int parameterIndex, InputStream inputStream, long length) 将指定的参数设置为 |
abstract void |
setBlob(int parameterIndex, InputStream inputStream) 将指定的参数设置为 |
abstract void |
setBlob(String parameterName, Blob x) 将指定参数设置为给定的 |
abstract void |
setBlob(String parameterName, InputStream inputStream, long length) 将指定的参数设置为 |
abstract void |
setBlob(int i, Blob x) 将 |
abstract void |
setBlob(String parameterName, InputStream inputStream) 将指定的参数设置为 |
abstract void |
setBoolean(String parameterName, boolean x) 将指定的参数设置为给定的Java |
abstract void |
setBoolean(int parameterIndex, boolean x) 将此 |
abstract void |
setByte(int parameterIndex, byte x) 将此 |
abstract void |
setByte(String parameterName, byte x) 将指定的参数设置为给定的Java |
abstract void |
setBytes(String parameterName, byte[] x) 将指定参数设置为给定的Java字节数组。 |
abstract void |
setBytes(int parameterIndex, byte[] x) 将此对象命令的 |
abstract void |
setCharacterStream(int parameterIndex, Reader reader) 将此 |
abstract void |
setCharacterStream(String parameterName, Reader reader, int length) 将指定的参数设置为给定的 |
abstract void |
setCharacterStream(String parameterName, Reader reader) 将指定的参数设置为给定的 |
abstract void |
setCharacterStream(int parameterIndex, Reader reader, int length) 将此 |
abstract void |
setClob(int i, Clob x) 将 |
abstract void |
setClob(int parameterIndex, Reader reader, long length) 将指定参数设置为 |
abstract void |
setClob(int parameterIndex, Reader reader) 将指定参数设置为 |
abstract void |
setClob(String parameterName, Clob x) 将指定的参数设置为给定的 |
abstract void |
setClob(String parameterName, Reader reader, long length) 将指定的参数设置为 |
abstract void |
setClob(String parameterName, Reader reader) 将指定参数设置为 |
abstract void |
setCommand(String cmd) 将此 |
abstract void |
setConcurrency(int concurrency) 将此 |
abstract void |
setDataSourceName(String name) 将此 |
abstract void |
setDate(String parameterName, Date x, Calendar cal) 使用给定的 |
abstract void |
setDate(String parameterName, Date x) 使用运行应用程序的虚拟机的默认时区将指定参数设置为给定的 |
abstract void |
setDate(int parameterIndex, Date x) 将此 |
abstract void |
setDate(int parameterIndex, Date x, Calendar cal) 将 |
abstract void |
setDouble(int parameterIndex, double x) 将此 |
abstract void |
setDouble(String parameterName, double x) 将指定的参数设置为给定的Java |
abstract void |
setEscapeProcessing(boolean enable) 将此 |
abstract void |
setFloat(String parameterName, float x) 将指定的参数设置为给定的Java |
abstract void |
setFloat(int parameterIndex, float x) 将此 |
abstract void |
setInt(int parameterIndex, int x) 将此 |
abstract void |
setInt(String parameterName, int x) 将指定的参数设置为给定的Java |
abstract void |
setLong(int parameterIndex, long x) 将此 |
abstract void |
setLong(String parameterName, long x) 将指定的参数设置为给定的Java |
abstract void |
setMaxFieldSize(int max) 将列值可以返回的最大字节数设置为给定的字节数。 |
abstract void |
setMaxRows(int max) 将此 |
abstract void |
setNCharacterStream(String parameterName, Reader value, long length) 将指定的参数设置为 |
abstract void |
setNCharacterStream(int parameterIndex, Reader value) 将此 |
abstract void |
setNCharacterStream(int parameterIndex, Reader value, long length) 将指定的参数设置为 |
abstract void |
setNCharacterStream(String parameterName, Reader value) 将指定的参数设置为 |
abstract void |
setNClob(String parameterName, Reader reader, long length) 将指定参数设置为 |
abstract void |
setNClob(String parameterName, NClob value) 将指定参数设置为 |
abstract void |
setNClob(int parameterIndex, Reader reader, long length) 将指定的参数设置为 |
abstract void |
setNClob(String parameterName, Reader reader) 将指定的参数设置为 |
abstract void |
setNClob(int parameterIndex, NClob value) 将指定的参数设置为 |
abstract void |
setNClob(int parameterIndex, Reader reader) 将指定参数设置为 |
abstract void |
setNString(int parameterIndex, String value) 将指定的参数设置为给定的 |
abstract void |
setNString(String parameterName, String value) 将指定的参数设置为给定的 |
abstract void |
setNull(int paramIndex, int sqlType, String typeName) 将此 |
abstract void |
setNull(int parameterIndex, int sqlType) 将此 |
abstract void |
setNull(String parameterName, int sqlType) 将指定参数设置为SQL |
abstract void |
setNull(String parameterName, int sqlType, String typeName) 将指定的参数设置为SQL |
abstract void |
setObject(String parameterName, Object x, int targetSqlType, int scale) 用给定的对象设置指定参数的值。 |
abstract void |
setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) 使用给定的Java |
abstract void |
setObject(int parameterIndex, Object x) 设置在这个指定的参数 |
abstract void |
setObject(String parameterName, Object x, int targetSqlType) 用给定的对象设置指定参数的值。 |
abstract void |
setObject(int parameterIndex, Object x, int targetSqlType) 使用Java |
abstract void |
setObject(String parameterName, Object x) 用给定的对象设置指定参数的值。 |
abstract void |
setPassword(String password) 设置此数据库密码 |
abstract void |
setQueryTimeout(int seconds) 将驱动程序等待语句执行的最长时间设置为给定的秒数。 |
abstract void |
setReadOnly(boolean value) 设置此 |
abstract void |
setRef(int i, Ref x) 使用给定的 |
abstract void |
setRowId(int parameterIndex, RowId x) 将指定的参数设置为给定的 |
abstract void |
setRowId(String parameterName, RowId x) 将指定参数设置为给定的 |
abstract void |
setSQLXML(int parameterIndex, SQLXML xmlObject) 将指定参数设置为给定的 |
abstract void |
setSQLXML(String parameterName, SQLXML xmlObject) 将指定参数设置为给定的 |
abstract void |
setShort(int parameterIndex, short x) 将此 |
abstract void |
setShort(String parameterName, short x) 将指定的参数设置为给定的Java |
abstract void |
setString(String parameterName, String x) 将指定的参数设置为给定的Java |
abstract void |
setString(int parameterIndex, String x) 将此 |
abstract void |
setTime(String parameterName, Time x, Calendar cal) 使用给定的 |
abstract void |
setTime(int parameterIndex, Time x, Calendar cal) 使用给定的 |
abstract void |
setTime(String parameterName, Time x) 将指定的参数设置为给定的 |
abstract void |
setTime(int parameterIndex, Time x) 将此 |
abstract void |
setTimestamp(int parameterIndex, Timestamp x, Calendar cal) 将 |
abstract void |
setTimestamp(String parameterName, Timestamp x, Calendar cal) 使用给定的 |
abstract void |
setTimestamp(String parameterName, Timestamp x) 将指定的参数设置为给定的 |
abstract void |
setTimestamp(int parameterIndex, Timestamp x) 将此 |
abstract void |
setTransactionIsolation(int level) 设置此 |
abstract void |
setType(int type) 将此 |
abstract void |
setTypeMap(Map<String, Class<?>> map) 安装给定 |
abstract void |
setURL(int parameterIndex, URL x) 将指定的参数设置为给定的 |
abstract void |
setUrl(String url) 设置 |
abstract void |
setUsername(String name) 将此 |
继承方法(Inherited methods) |
|
|---|---|
java.sql.ResultSet
|
|
java.sql.Wrapper
|
|
java.lang.AutoCloseable
|
|
void addRowSetListener (RowSetListener listener)
注册给定的侦听器,以便将会通知此 RowSet对象上发生的事件。
| 参数(Parameters) | |
|---|---|
listener |
RowSetListener: a component that has implemented the RowSetListener interface and wants to be notified when events occur on this RowSet object |
void clearParameters ()
清除为此 RowSet对象的命令设置的参数。
一般来说,参数值对于重复使用RowSet对象仍然有效。 设置参数值会自动清除其以前的值。 但是,在某些情况下,立即释放当前参数值使用的资源很有用,可以通过调用方法clearParameters来完成。
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void execute ()
用数据填充这个 RowSet对象。
execute方法可以使用以下属性创建用于读取数据的连接:url,数据源名称,用户名,密码,事务隔离和类型映射。 execute方法可以使用以下属性来创建执行命令的语句:命令,只读,最大字段大小,最大行数,转义处理和查询超时。
如果所需的属性尚未设置,则会引发异常。 如果此方法成功,则会丢弃行集的当前内容,并且还会(重新)设置行集的元数据。 如果有未完成的更新,它们将被忽略。
如果这个RowSet对象没有与其数据源保持连续的连接,则它可以使用读取器(一个RowSetReader对象)来填充数据。 在这种情况下,读者将被注册到这个RowSet对象,并且方法execute将作为其实现的一部分在读者的readData方法上调用。
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or any of the properties necessary for making a connection and creating a statement have not been set |
String getCommand ()
获取此RowSet对象的命令属性。 command属性包含一个命令字符串,该字符串必须是SQL查询,可以执行该命令字符串以用数据填充行集。 默认值是null 。
| 返回(Returns) | |
|---|---|
String |
the command string; may be null |
也可以看看:
String getDataSourceName ()
检索标识此 RowSet对象的数据源的逻辑名称。
| 返回(Returns) | |
|---|---|
String |
a data source name |
boolean getEscapeProcessing ()
检索是否为此RowSet对象启用了转义处理。 如果启用转义扫描(默认情况下),则在将SQL语句发送到数据库之前,驱动程序将执行转义替换。
| 返回(Returns) | |
|---|---|
boolean |
true if escape processing is enabled; false if it is disabled |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
int getMaxFieldSize ()
检索某些列值可能返回的最大字节数。 此限制仅适用于BINARY , VARBINARY , LONGVARBINARYBINARY , CHAR , VARCHAR , LONGVARCHAR , NCHAR个NVARCHAR列。 如果超出限制,则会过多丢弃超量数据。
| 返回(Returns) | |
|---|---|
int |
the current maximum column size limit; zero means that there is no limit |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
int getMaxRows ()
检索此行的最大数量RowSet对象可以包含。 如果超出限制,超出的行将被无声地丢弃。
| 返回(Returns) | |
|---|---|
int |
the current maximum number of rows that this RowSet object can contain; zero means unlimited |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
String getPassword ()
检索用于创建数据库连接的密码。 在调用方法execute之前,密码属性在运行时设置。 它通常不是一个RowSet对象的序列化状态的一部分。
| 返回(Returns) | |
|---|---|
String |
the password for making a database connection |
也可以看看:
int getQueryTimeout ()
检索驱动程序等待语句执行的最大秒数。 如果超过此限制,则抛出SQLException 。
| 返回(Returns) | |
|---|---|
int |
the current query timeout limit in seconds; zero means unlimited |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
int getTransactionIsolation ()
检索为此 RowSet对象设置的事务隔离级别。
| 返回(Returns) | |
|---|---|
int |
the transaction isolation level; one of Connection.TRANSACTION_READ_UNCOMMITTED, Connection.TRANSACTION_READ_COMMITTED, Connection.TRANSACTION_REPEATABLE_READ, or Connection.TRANSACTION_SERIALIZABLE |
也可以看看:
Map<String, Class<?>> getTypeMap ()
检索与此Map对象关联的RowSet对象,该对象指定SQL用户定义类型(如果有)的自定义映射。 默认情况下,类型映射表为空。
| 返回(Returns) | |
|---|---|
Map<String, Class<?>> |
a java.util.Map object containing the names of SQL user-defined types and the Java classes to which they are to be mapped |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
String getUrl ()
检索此对象将使用RowSet对象创建连接的url属性(如果它使用DriverManager而不是DataSource对象来建立连接)。 默认值是null 。
| 返回(Returns) | |
|---|---|
String |
a string url |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
String getUsername ()
检索用于为此RowSet对象创建数据库连接的用户名。 在调用方法execute之前,运行时会设置username属性。 它通常不是RowSet对象的序列化状态的一部分。
| 返回(Returns) | |
|---|---|
String |
the username property |
也可以看看:
boolean isReadOnly ()
检索此RowSet对象是否为只读对象。 如果可以更新,则默认情况下行集是可更新的。
尝试更新只读行集将导致抛出 SQLException 。
| 返回(Returns) | |
|---|---|
boolean |
true if this RowSet object is read-only; false if it is updatable |
也可以看看:
void removeRowSetListener (RowSetListener listener)
从 RowSet对象上发生事件时将通知的组件列表中删除指定的侦听器。
| 参数(Parameters) | |
|---|---|
listener |
RowSetListener: a component that has been registered as a listener for this RowSet object |
void setArray (int i,
Array x)
使用给定的Array值RowSet对象的命令中的指定参数设置为Array 。 驱动程序会将其转换为Array对象在将其发送到数据库之前所代表的ARRAY值。
| 参数(Parameters) | |
|---|---|
i |
int: the first parameter is 1, the second is 2, ... |
x |
Array: an object representing an SQL array |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setAsciiStream (String parameterName, InputStream x, int length)
将指定的参数设置为给定的输入流,该输入流将具有指定的字节数。 当一个非常大的ASCII值输入到LONGVARCHAR参数时,通过java.io.InputStream发送它可能更实际。 数据将根据需要从流中读取,直到达到文件结束。 JDBC驱动程序将执行从ASCII到数据库字符格式的任何必要转换。
注意:此流对象既可以是标准的Java流对象,也可以是实现标准接口的自己的子类。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
InputStream: the Java input stream that contains the ASCII parameter value |
length |
int: the number of bytes in the stream |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setAsciiStream (int parameterIndex,
InputStream x)
将此RowSet对象的命令中的指定参数设置为给定的输入流。 当一个非常大的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 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)
将此RowSet对象命令中的指定参数设置为给定的java.io.InputStream值。 通过java.io.InputStream而不是LONGVARCHAR参数发送非常大的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 a database access error occurs |
void setAsciiStream (String parameterName, InputStream x)
将指定的参数设置为给定的输入流。 当一个非常大的ASCII值输入到LONGVARCHAR参数时,通过java.io.InputStream发送它可能更实际。 数据将根据需要从流中读取,直到达到文件结束。 JDBC驱动程序将执行从ASCII到数据库字符格式的任何必要转换。
注意:此流对象既可以是标准的Java流对象,也可以是实现标准接口的自己的子类。
注意:请查阅您的JDBC驱动程序文档,以确定使用带有长度参数的 setAsciiStream版本是否更有效。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
InputStream: the Java input stream that contains the ASCII parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setBigDecimal (int parameterIndex,
BigDecimal x)
将此RowSet对象的命令中的指定参数设置为给定的java.math.BigDeciaml值。 驱动程序在将其发送到数据库之前将其转换为SQL NUMERIC值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
BigDecimal: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setBigDecimal (String parameterName, BigDecimal x)
将指定参数设置为给定的java.math.BigDecimal值。 驱动程序在将它发送到数据库时将其转换为SQL NUMERIC值。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
BigDecimal: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
void setBinaryStream (String parameterName, InputStream x)
将指定的参数设置为给定的输入流。 当一个非常大的二进制值输入到LONGVARBINARY参数时,通过java.io.InputStream对象发送它可能更实际。 数据将根据需要从流中读取,直到达到文件结尾。
注意:此流对象既可以是标准的Java流对象,也可以是实现标准接口的自己的子类。
注:请查阅您的JDBC驱动程序文档以确定使用带有长度参数的 setBinaryStream版本是否更有效。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
InputStream: the java input stream which contains the binary parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setBinaryStream (int parameterIndex,
InputStream x,
int length)
将此RowSet对象命令中的指定参数设置为给定的java.io.InputStream值。 通过java.io.InputStream发送非常大的二进制值而不是LONGVARBINARY参数可能更实用。 驱动程序将根据需要从流中读取数据,直到达到文件结尾。
注意:此流对象既可以是标准的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 a database access error occurs |
void setBinaryStream (String parameterName, InputStream x, int length)
将指定的参数设置为给定的输入流,该输入流将具有指定的字节数。 当一个非常大的二进制值输入到LONGVARBINARY参数中时,通过java.io.InputStream对象发送它可能更实际。 数据将根据需要从流中读取,直到达到文件结尾。
注意:此流对象既可以是标准的Java流对象,也可以是实现标准接口的自己的子类。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
InputStream: the java input stream which contains the binary parameter value |
length |
int: the number of bytes in the stream |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setBinaryStream (int parameterIndex,
InputStream x)
将此RowSet对象的命令中的指定参数设置为给定的输入流。 当一个非常大的二进制值输入到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 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 setBlob (int parameterIndex,
InputStream inputStream,
long length)
将指定的参数设置为InputStream对象。 所述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 a database access error occurs, this method is called on a closed PreparedStatement, if parameterIndex does not correspond to a parameter marker in the SQL statement, 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 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 (String parameterName, Blob x)
将指定的参数设置为给定的java.sql.Blob对象。 驱动程序在将它发送到数据库时将其转换为SQL BLOB值。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
Blob: a Blob object that maps an SQL BLOB value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setBlob (String parameterName, InputStream inputStream, long length)
将指定的参数设置为InputStream对象。 所述inputstream必须包含长度指定的字符数,否则SQLException时将产生CallableStatement被执行。 此方法与setBinaryStream (int, InputStream, int)方法不同,因为它通知驱动程序参数值应该作为BLOB发送到服务器。 当使用setBinaryStream方法时,驱动程序可能需要做额外的工作来确定参数数据是否应作为LONGVARBINARY或BLOB发送到服务器
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter to be set 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, or if the length specified is less than zero; if the number of bytes in the inputstream does not match the specfied length; if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setBlob (int i,
Blob x)
使用给定的Blob值RowSet对象的命令中的指定参数设置为Blob 。 驱动程序将此转换为BLOB ,该值Blob对象将它发送到数据库之前代表。
| 参数(Parameters) | |
|---|---|
i |
int: the first parameter is 1, the second is 2, ... |
x |
Blob: an object representing a BLOB |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setBlob (String parameterName, InputStream inputStream)
将指定的参数设置为InputStream对象。 此方法与setBinaryStream (int, InputStream)方法不同,因为它通知驱动程序参数值应该作为BLOB发送到服务器。 当使用setBinaryStream方法时,驱动程序可能需要做额外的工作来确定参数数据是否应作为LONGVARBINARY或BLOB发送到服务器
注意:请查阅您的JDBC驱动程序文档,以确定使用带有长度参数的 setBlob版本是否更有效。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
inputStream |
InputStream: An object that contains the data to set the parameter value to. |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setBoolean (String parameterName, boolean x)
将指定的参数设置为给定的Java boolean值。 驱动程序在将它发送到数据库时将其转换为SQL BIT或BOOLEAN值。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
boolean: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
void setBoolean (int parameterIndex,
boolean x)
将此RowSet对象的命令中的指定参数设置为给定的Java boolean值。 驱动程序在将其发送到数据库之前将其转换为SQL BIT值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
boolean: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setByte (int parameterIndex,
byte x)
将此RowSet对象的命令中的指定参数设置为给定的Java byte值。 驱动程序在将其发送到数据库之前将其转换为SQL TINYINT值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
byte: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setByte (String parameterName, byte x)
将指定的参数设置为给定的Java byte值。 驱动程序在将它发送到数据库时将其转换为SQL TINYINT值。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
byte: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
void setBytes (String parameterName, byte[] x)
将指定参数设置为给定的Java字节数组。 当它将数据发送到数据库时,驱动程序将其转换为SQL VARBINARY或LONGVARBINARY (具体取决于参数的大小与驱动程序对VARBINARY值的限制)。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
byte: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
void setBytes (int parameterIndex,
byte[] x)
将此RowSet对象的命令中的指定参数设置为byte值的给定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 a database access error occurs |
void setCharacterStream (int parameterIndex,
Reader reader)
将此RowSet对象的命令中的指定参数设置为给定的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 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 setCharacterStream (String parameterName, Reader reader, int length)
将指定的参数设置为给定的Reader对象,该对象是给定的字符长度。 当一个非常大的UNICODE值输入到LONGVARCHAR参数时,通过java.io.Reader对象发送它可能更实际。 数据将根据需要从流中读取,直到达到文件结尾。 JDBC驱动程序将执行从UNICODE到数据库字符格式的任何必要转换。
注意:此流对象既可以是标准的Java流对象,也可以是实现标准接口的自己的子类。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
reader |
Reader: the java.io.Reader object that contains the UNICODE data used as the designated parameter |
length |
int: the number of characters in the stream |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setCharacterStream (String parameterName, Reader reader)
将指定参数设置为给定的Reader对象。 当一个非常大的UNICODE值输入到LONGVARCHAR参数时,通过java.io.Reader对象发送它可能更实际。 数据将根据需要从流中读取,直到达到文件结尾。 JDBC驱动程序将执行从UNICODE到数据库字符格式的任何必要转换。
注意:此流对象既可以是标准的Java流对象,也可以是实现标准接口的自己的子类。
注:请查阅您的JDBC驱动程序文档以确定使用带有长度参数的 setCharacterStream版本是否更有效。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
reader |
Reader: the java.io.Reader object that contains the Unicode data |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setCharacterStream (int parameterIndex,
Reader reader,
int length)
将此RowSet对象的命令中的指定参数设置为给定的java.io.Reader值。 通过java.io.Reader而不是LONGVARCHAR参数发送非常大的UNICODE值可能更实用。 驱动程序将根据需要从流中读取数据,直到达到文件结尾。
注意:此流对象既可以是标准的Java流对象,也可以是实现标准接口的自己的子类。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
reader |
Reader: the Reader object that contains the UNICODE data to be set |
length |
int: the number of characters in the stream |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setClob (int i,
Clob x)
将RowSet对象的命令中的指定参数设置为给定的Clob值。 驱动程序会将其转换为Clob对象在将其发送到数据库之前所代表的CLOB值。
| 参数(Parameters) | |
|---|---|
i |
int: the first parameter is 1, the second is 2, ... |
x |
Clob: an object representing a CLOB |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
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 a database access error occurs, this method is called on a closed PreparedStatement, if parameterIndex does not correspond to a parameter marker in the SQL statement, 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 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 setClob (String parameterName, Clob x)
将指定参数设置为给定的java.sql.Clob对象。 驱动程序在将它发送到数据库时将其转换为SQL CLOB值。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
Clob: a Clob object that maps an SQL CLOB value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setClob (String parameterName, Reader reader, long length)
将指定参数设置为Reader对象。 所述reader必须包含长度另有指定的字符数SQLException的时,将产生CallableStatement被执行。 此方法与setCharacterStream (int, Reader, int)方法不同,因为它通知驱动程序参数值应作为CLOB发送到服务器。 当使用setCharacterStream方法时,驱动程序可能需要做额外的工作来确定参数数据是否应作为LONGVARCHAR或CLOB发送到服务器
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter to be set |
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; a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setClob (String parameterName, Reader reader)
将指定的参数设置为Reader对象。 此方法与setCharacterStream (int, Reader)方法不同,因为它通知驱动程序参数值应该作为CLOB发送到服务器。 当使用setCharacterStream方法时,驱动程序可能需要做额外的工作来确定参数数据是否应该作为LONGVARCHAR或CLOB发送到服务器
注:请查阅您的JDBC驱动程序文档以确定使用带有长度参数的 setClob版本是否更有效。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
reader |
Reader: An object that contains the data to set the parameter value to. |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setCommand (String cmd)
将此RowSet对象的命令属性设置为给定的SQL查询。 当行集从不支持命令的数据源(如电子表格)中获取其数据时,此属性是可选的。
| 参数(Parameters) | |
|---|---|
cmd |
String: the SQL query that will be used to get the data for this RowSet object; may be null |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
void setConcurrency (int concurrency)
将此RowSet对象的并发性设置为给定的并发级别。 此方法用于更改行集的并发级别,默认为ResultSet.CONCUR_READ_ONLY
| 参数(Parameters) | |
|---|---|
concurrency |
int: one of the ResultSet constants specifying a concurrency level: ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
void setDataSourceName (String name)
将此 RowSet对象的数据源名称属性设置为给定的 String 。
数据源名称属性的值可用于查找DataSource名称服务注册的DataSource对象。 检索后, DataSource对象可用于创建到它所表示的数据源的连接。
| 参数(Parameters) | |
|---|---|
name |
String: the logical name of the data source for this RowSet object; may be null |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
void setDate (String parameterName, Date x, Calendar cal)
使用给定的Calendar对象将指定参数设置为给定的java.sql.Date值。 该驱动程序使用Calendar对象构造一个SQL DATE值,驱动程序随后DATE值发送到数据库。 通过aa Calendar对象,驱动程序可以计算考虑到自定义时区的日期。 如果未指定Calendar对象,则驱动程序使用默认时区,即运行应用程序的虚拟机的时区。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
Date: the parameter value |
cal |
Calendar: the Calendar object the driver will use to construct the date |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
void setDate (String parameterName, Date x)
使用运行应用程序的虚拟机的默认时区将指定参数设置为给定的java.sql.Date值。 驱动程序在将它发送到数据库时将其转换为SQL DATE值。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
Date: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
void setDate (int parameterIndex,
Date x)
将此RowSet对象的命令中的指定参数设置为给定的java.sql.Date值。 驱动程序在将其发送到数据库之前将其转换为SQL DATE值,并使用默认的java.util.Calendar来计算日期。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
Date: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setDate (int parameterIndex,
Date x,
Calendar cal)
使用给定的java.sql.Date值RowSet对象的命令中的指定参数设置为java.sql.Date 。 驱动程序会将其转换为SQL DATE值,并使用给定的java.util.Calendar对象计算日期。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
Date: the parameter value |
cal |
Calendar: the java.util.Calendar object to use for calculating the date |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setDouble (int parameterIndex,
double x)
将此RowSet对象的命令中的指定参数设置为给定的Java double值。 驱动程序在将其发送到数据库之前将其转换为SQL DOUBLE值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
double: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setDouble (String parameterName, double x)
将指定的参数设置为给定的Java double值。 驱动程序在将它发送到数据库时将其转换为SQL DOUBLE值。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
double: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
void setEscapeProcessing (boolean enable)
将此RowSet对象的转义处理设置为打开或关闭。 如果转义扫描处于打开状态(默认),驱动程序将在将SQL语句发送到数据库之前执行转义替换。
| 参数(Parameters) | |
|---|---|
enable |
boolean: true to enable escape processing; false to disable it |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
void setFloat (String parameterName, float x)
将指定的参数设置为给定的Java float值。 驱动程序在将它发送到数据库时将其转换为SQL FLOAT值。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
float: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
void setFloat (int parameterIndex,
float x)
将此对象命令的RowSet命令中的指定参数设置为给定的Java float值。 驱动程序在将其发送到数据库之前将其转换为SQL REAL值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
float: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setInt (int parameterIndex,
int x)
将此RowSet对象的命令中的指定参数设置为给定的Java int值。 驱动程序在将其发送到数据库之前将其转换为SQL INTEGER值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
int: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setInt (String parameterName, int x)
将指定的参数设置为给定的Java int值。 驱动程序在将它发送到数据库时将其转换为SQL INTEGER值。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
int: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
void setLong (int parameterIndex,
long x)
将此RowSet对象的命令中的指定参数设置为给定的Java long值。 驱动程序在将其发送到数据库之前将其转换为SQL BIGINT值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
long: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setLong (String parameterName, long x)
将指定参数设置为给定的Java long值。 驱动程序在将它发送到数据库时将其转换为SQL BIGINT值。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
long: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
void setMaxFieldSize (int max)
将列值可以返回的最大字节数设置为给定的字节数。 此限制仅适用于BINARY , VARBINARY , LONGVARBINARYBINARY , CHAR , VARCHAR , LONGVARCHAR , NCHAR个NVARCHAR列。 如果超出限制,则会过多丢弃超量数据。 为了获得最大的便携性,请使用大于256的值。
| 参数(Parameters) | |
|---|---|
max |
int: the new max column size limit in bytes; zero means unlimited |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
void setMaxRows (int max)
将此RowSet对象可以包含的最大行数设置为指定的数字。 如果超出限制,超出的行将被无声地丢弃。
| 参数(Parameters) | |
|---|---|
max |
int: the new maximum number of rows; zero means unlimited |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
void setNCharacterStream (String parameterName, Reader value, long length)
将指定的参数设置为Reader对象。 Reader读取数据直到达到文件结束。 驱动程序将从Java字符格式转换为数据库中的国家字符集。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the column to be set |
value |
Reader: the parameter value |
length |
long: the number of characters in the parameter data. |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; or if a database access error occurs |
void setNCharacterStream (int parameterIndex,
Reader value)
将此RowSet对象的命令中的指定参数设置为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 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,
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 the driver does not support national character sets; if the driver can detect that a data conversion error could occur ; or if a database access error occurs |
void setNCharacterStream (String parameterName, Reader value)
将指定参数设置为Reader对象。 Reader读取数据直到达到文件结尾。 驱动程序将从Java字符格式转换为数据库中的国家字符集。
注意:此流对象既可以是标准的Java流对象,也可以是实现标准接口的自己的子类。
注意:请查阅您的JDBC驱动程序文档,以确定使用带有长度参数的 setNCharacterStream版本是否更有效。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
value |
Reader: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
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 CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setNClob (String parameterName, Reader reader, long length)
将指定参数设置为Reader对象。 所述reader必须包含长度另有指定的字符数SQLException的时,将产生CallableStatement被执行。 此方法不同于setCharacterStream (int, Reader, int)方法,因为它通知驱动程序参数值应该作为NCLOB发送到服务器。 当使用setCharacterStream方法时,驱动程序可能需要做额外的工作来确定参数数据是以LONGNVARCHAR还是NCLOB发送到服务器
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter to be set |
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 CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setNClob (String parameterName, NClob value)
将指定的参数设置为java.sql.NClob对象。 该对象实现了java.sql.NClob接口。 这个NClob对象映射到SQL NCLOB 。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the column to be set |
value |
NClob: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; or if a database access error occurs |
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 (String parameterName, Reader reader)
将指定的参数设置为Reader对象。 此方法与setCharacterStream (int, Reader)方法不同,因为它通知驱动程序参数值应该作为NCLOB发送到服务器。 当使用setCharacterStream方法时,驱动程序可能需要做额外的工作来确定参数数据是否应作为LONGNVARCHAR或NCLOB发送到服务器
注意:请参阅JDBC驱动程序文档以确定使用带有长度参数的 setNClob版本是否更有效。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
reader |
Reader: An object that contains the data to set the parameter value to. |
| 抛出异常(Throws) | |
|---|---|
SQLException |
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 CallableStatement |
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 the driver does not support national character sets; if the driver can detect that a data conversion error could occur ; or if a database access error occurs |
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对象。 当驱动程序将其发送到数据库时,该驱动程序LONGNVARCHAR值转换为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 the driver does not support national character sets; if the driver can detect that a data conversion error could occur ; or if a database access error occurs |
void setNString (String parameterName, String value)
将指定的参数设置为给定的String对象。 驱动程序将其转换为SQL NCHAR或NVARCHAR或LONGNVARCHAR
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the column to be set |
value |
String: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; or if a database access error occurs |
void setNull (int paramIndex,
int sqlType,
String typeName)
设置在这个指定的参数RowSet对象的SQL命令SQL NULL 。 该版本的方法setNull应该用于SQL用户定义类型(UDT)和REF类型参数。 的UDT的实例包括: STRUCT , DISTINCT , JAVA_OBJECT ,和指定数组类型。
注意:为了便于携带,应用程序在指定NULL UDT或REF参数时必须提供SQL类型代码和完全限定的SQL类型名称。 在UDT的情况下,名称是参数本身的类型名称。 对于REF参数,名称是引用类型的类型名称。 如果JDBC驱动程序不需要类型代码或类型名称信息,则可能会忽略它。 虽然它的目的是为UDT和REF参数,但此方法可用于设置任何JDBC类型的null参数。 如果该参数没有用户定义或REF类型,则忽略typeName参数。
| 参数(Parameters) | |
|---|---|
paramIndex |
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 UDT or the type name of the SQL structured type being referenced by a REF type; ignored if the parameter is not a UDT or REF type |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setNull (int parameterIndex,
int sqlType)
设置在这个指定的参数 RowSet对象的SQL命令SQL NULL 。
注意:您必须指定参数的SQL类型。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
sqlType |
int: a SQL type code defined by java.sql.Types |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setNull (String parameterName, int sqlType)
将指定参数设置为SQL NULL 。
注意:您必须指定参数的SQL类型。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
sqlType |
int: the SQL type code defined in java.sql.Types |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setNull (String parameterName, int sqlType, String typeName)
将指定的参数设置为SQL NULL 。 该版本的方法setNull应该用于用户定义的类型和REF类型参数。 用户定义类型的示例包括:STRUCT,DISTINCT,JAVA_OBJECT和命名数组类型。
注意:为了便于携带,应用程序必须在指定NULL用户定义参数或REF参数时提供SQL类型代码和完全限定的SQL类型名称。 在用户定义类型的情况下,名称是参数本身的类型名称。 对于REF参数,名称是引用类型的类型名称。 如果JDBC驱动程序不需要类型代码或类型名称信息,则可能会忽略它。 虽然它用于用户定义和Ref参数,但此方法可用于设置任何JDBC类型的null参数。 如果该参数没有用户定义或REF类型,则忽略给定的typeName。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
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 SQL REF value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void setObject (String parameterName, Object x, int targetSqlType, int scale)
用给定的对象设置指定参数的值。 第二个参数必须是一个对象类型; 对于整数值,应该使用java.lang等效的对象。
在发送给数据库之前,给定的Java对象将被转换为给定的targetSqlType。 如果对象具有自定义映射(属于实现接口SQLData的类),则JDBC驱动程序应调用方法SQLData.writeSQL将其写入SQL数据流。 如果,在另一方面,对象是实现一类Ref , Blob , Clob , NClob , Struct , java.net.URL ,或Array ,驾驶员应把它传递给数据库作为相应SQL类型的值。
请注意,此方法可用于传递数据库特定的抽象数据类型。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
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. |
scale |
int: for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types, this is the number of digits after the decimal point. For all other types, this value will be ignored. |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
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)
设置在这个指定的参数RowSet对象与给定的Java命令Object 。 对于整数值,应该使用java.lang等效对象(例如,针对int的类Integer的int )。 如果第二个参数是InputStream那么该流必须包含scaleOrLength指定的字节数。 如果第二个参数是Reader那么阅读器必须包含由scaleOrLength指定的字符数。 如果这些条件不成立,驱动程序将在准备好的语句执行时生成SQLException 。
给定的Java对象在被发送到数据库之前将被转换为targetSqlType。
如果对象是实现SQLData的类,则行集应调用方法SQLData.writeSQL将对象写入SQLOutput数据流。 如果,在另一方面,对象是实现一类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 a database access error occurs |
也可以看看:
void setObject (int parameterIndex,
Object x)
将此RowSet对象的命令中的指定参数设置为Java Object 。 对于整数值,应该使用java.lang等效对象。
JDBC规范提供了从Java对象类型到SQL类型的标准映射。 驱动程序会将给定的Java对象转换为其标准的SQL映射,然后将其发送到数据库。
请注意,可以使用此方法通过使用特定于驱动程序的Java类型传递数据库特定的抽象数据类型。 如果对象是实现SQLData的类,则行集应调用方法SQLData.writeSQL将对象写入SQLOutput数据流。 如果,在另一方面,对象是实现一类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 |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setObject (String parameterName, Object x, int targetSqlType)
用给定的对象设置指定参数的值。 该方法与上面的方法setObject ,不同之setObject于其假定刻度为零。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
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 a database access error occurs or this method is called on a closed CallableStatement |
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)
将此RowSet对象的命令中的指定参数设置为Java Object 。 对于整数值,应该使用java.lang等效的对象。 此方法与上面的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 a database access error occurs |
void setObject (String parameterName, Object x)
用给定的对象设置指定参数的值。 第二个参数必须是Object ; 因此, java.lang等效对象应该用于内置类型。
JDBC规范指定了从Java Object类型到SQL类型的标准映射。 在发送给数据库之前,给定的参数将被转换为相应的SQL类型。
请注意,通过使用特定于驱动程序的Java类型,此方法可用于传递数据库特定的抽象数据类型。 如果对象是实现接口SQLData的类的对象,则JDBC驱动程序应调用方法SQLData.writeSQL将其写入SQL数据流。 如果,在另一方面,对象是实现一类Ref , Blob , Clob , NClob , Struct , java.net.URL ,或Array ,驾驶员应把它传递给数据库作为相应SQL类型的值。
如果存在歧义,则此方法会引发异常,例如,对象是实现多个上述接口的类的类。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
Object: the object containing the input parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs, this method is called on a closed CallableStatement or if the given Object parameter is ambiguous |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
void setPassword (String password)
将此 RowSet对象的数据库密码设置为给定的 String 。
| 参数(Parameters) | |
|---|---|
password |
String: the password string |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
void setQueryTimeout (int seconds)
将驱动程序等待语句执行的最长时间设置为给定的秒数。 如果超出此限制, SQLException引发SQLException 。
| 参数(Parameters) | |
|---|---|
seconds |
int: the new query timeout limit in seconds; zero means that there is no limit |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
void setReadOnly (boolean value)
设置此 RowSet对象是否只读给定的 boolean 。
| 参数(Parameters) | |
|---|---|
value |
boolean: true if read-only; false if updatable |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
void setRef (int i,
Ref x)
将RowSet对象的命令中的指定参数设置为给定的Ref值。 驱动程序会将其转换为适当的值REF(<structured-type>) 。
| 参数(Parameters) | |
|---|---|
i |
int: the first parameter is 1, the second is 2, ... |
x |
Ref: an object representing data of an SQL REF type |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
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 a database access error occurs |
void setRowId (String parameterName, RowId x)
将指定的参数设置为给定的java.sql.RowId对象。 驱动程序在将它发送到数据库时将其转换为SQL ROWID 。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
RowId: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
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 a database access error occurs, this method is called on a closed result set, the java.xml.transform.Result, Writer or OutputStream has not been closed for the SQLXML object or if there is an error processing the XML value. The getCause method of the exception may provide a more detailed exception, for example, if the stream does not contain valid XML. |
void setSQLXML (String parameterName, SQLXML xmlObject)
将指定的参数设置为给定的java.sql.SQLXML对象。 驱动程序在将它发送到数据库时将其转换为SQL XML值。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
xmlObject |
SQLXML: a SQLXML object that maps an SQL XML value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs, this method is called on a closed result set, the java.xml.transform.Result, Writer or OutputStream has not been closed for the SQLXML object or if there is an error processing the XML value. The getCause method of the exception may provide a more detailed exception, for example, if the stream does not contain valid XML. |
void setShort (int parameterIndex,
short x)
将此RowSet对象的命令中的指定参数设置为给定的Java short值。 驱动程序在将其发送到数据库之前将其转换为SQL SMALLINT值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
short: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setShort (String parameterName, short x)
将指定的参数设置为给定的Java short值。 驱动程序在将它发送到数据库时将其转换为SQL SMALLINT值。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
short: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
void setString (String parameterName, String x)
将指定的参数设置为给定的Java String值。 当驱动程序将它发送到数据库时,它会VARCHAR值转换为SQL VARCHAR或LONGVARCHAR值(具体取决于参数的相对于驱动程序对VARCHAR值的限制)。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
String: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
void setString (int parameterIndex,
String x)
将此RowSet对象的命令中的指定参数设置为给定的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 a database access error occurs |
void setTime (String parameterName, Time x, Calendar cal)
使用给定的Calendar对象将指定参数设置为给定的java.sql.Time值。 该驱动程序使用Calendar对象构造一个SQL TIME值,然后驱动程序TIME值发送到数据库。 通过aa Calendar对象,驱动程序可以计算考虑到自定义时区的时间。 如果未指定Calendar对象,则驱动程序将使用默认时区,该时区是运行应用程序的虚拟机的时区。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
Time: the parameter value |
cal |
Calendar: the Calendar object the driver will use to construct the time |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
void setTime (int parameterIndex,
Time x,
Calendar cal)
将RowSet对象的命令中的指定参数设置为给定的java.sql.Time值。 在将数据发送到数据库之前,驱动程序将使用给定的java.util.Calendar对象将其转换为SQL TIME值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
Time: the parameter value |
cal |
Calendar: the java.util.Calendar object to use for calculating the time |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setTime (String parameterName, Time x)
将指定的参数设置为给定的java.sql.Time值。 驱动程序在将它发送到数据库时将其转换为SQL TIME值。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
Time: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
void setTime (int parameterIndex,
Time x)
将此RowSet对象的命令中的指定参数设置为给定的java.sql.Time值。 驱动程序在将其发送到数据库之前将其转换为SQL TIME值,使用默认的java.util.Calendar来计算它。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
Time: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setTimestamp (int parameterIndex,
Timestamp x,
Calendar cal)
将RowSet对象的命令中的指定参数设置为给定的java.sql.Timestamp值。 在将数据发送到数据库之前,驱动程序将使用给定的java.util.Calendar对象将其转换为SQL TIMESTAMP值。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
Timestamp: the parameter value |
cal |
Calendar: the java.util.Calendar object to use for calculating the timestamp |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setTimestamp (String parameterName, Timestamp x, Calendar cal)
使用给定的Calendar对象将指定参数设置为给定的java.sql.Timestamp值。 该驱动程序使用Calendar对象构造一个SQL TIMESTAMP值,然后驱动程序TIMESTAMP值发送到数据库。 通过aa Calendar对象,驱动程序可以计算考虑到自定义时区的时间戳。 如果未指定Calendar对象,则驱动程序使用默认时区,即运行应用程序的虚拟机的时区。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
Timestamp: the parameter value |
cal |
Calendar: the Calendar object the driver will use to construct the timestamp |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
void setTimestamp (String parameterName, Timestamp x)
将指定参数设置为给定的java.sql.Timestamp值。 驱动程序在将它发送到数据库时将其转换为SQL TIMESTAMP值。
| 参数(Parameters) | |
|---|---|
parameterName |
String: the name of the parameter |
x |
Timestamp: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
void setTimestamp (int parameterIndex,
Timestamp x)
将此RowSet对象的命令中的指定参数设置为给定的java.sql.Timestamp值。 驱动程序在将它发送到数据库之前将其转换为SQL TIMESTAMP值,使用默认的java.util.Calendar来计算它。
| 参数(Parameters) | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
x |
Timestamp: the parameter value |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
void setTransactionIsolation (int level)
设置此 RowSet对象的事务隔离级别。
| 参数(Parameters) | |
|---|---|
level |
int: the transaction isolation level; one of Connection.TRANSACTION_READ_UNCOMMITTED, Connection.TRANSACTION_READ_COMMITTED, Connection.TRANSACTION_REPEATABLE_READ, or Connection.TRANSACTION_SERIALIZABLE |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
void setType (int type)
将此RowSet对象的类型设置为给定类型。 此方法用于更改行集的类型,默认情况下为只读且不可滚动。
| 参数(Parameters) | |
|---|---|
type |
int: one of the ResultSet constants specifying a type: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
void setTypeMap (Map<String, Class<?>> map)
安装给定java.util.Map对象的默认类型映射此RowSet对象。 除非提供另一个类型映射作为方法参数,否则将使用此类型映射。
| 参数(Parameters) | |
|---|---|
map |
Map: a java.util.Map object containing the names of SQL user-defined types and the Java classes to which they are to be mapped |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
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 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 setUrl (String url)
设置RowSet对象在使用DriverManager创建连接时将使用的URL。 设置此属性是可选的。 如果使用URL,则在使用行集连接到数据库之前,必须加载接受URL的JDBC驱动程序。 在读取或写入数据时,行集将内部使用URL来创建数据库连接。 使用URL或数据源名称创建连接,最近将其设置为非空值。
| 参数(Parameters) | |
|---|---|
url |
String: a string value; may be null |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
void setUsername (String name)
将此 RowSet对象的用户名属性设置为给定的 String 。
| 参数(Parameters) | |
|---|---|
name |
String: a user name |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看: