|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
public interface RowSet
该接口添加了对 JavaBeansTM 组件模型的 JDBC API 支持。rowset 可用作可视化 Bean 开发环境中的 JavaBeans 组件,它可以在设计时创建和配置并在运行时执行。
RowSet 接口提供一组 JavaBeans 属性,这些属性允许配置一个 RowSet 实例来连接 JDBC 数据源并从中读取某些数据。一组设置方法(setInt、setBytes、setString 等等)提供将输入参数传递到 rowset 命令属性的方式。在一般情况下,此命令是 rowset 从关系数据库获取其数据时所使用的 SQL 查询。
RowSet 接口支持 JavaBeans 事件,允许应用程序中的其他组件在 rowset 发生事件时(如值的更改)得到通知。
RowSet 接口是唯一的,因为需要使用其他 JDBC API 来实现它。换句话说,RowSet 实现是在 JDBC 驱动程序“顶部”执行的软件层。任何人都可以提供 RowSet 接口的实现,包括希望将 RowSet 实现作为其 JDBC 产品的一部分提供的 JDBC 驱动程序供应商。
RowSet 对象可以建立一个与数据源的连接并在其整个生命周期中维持该连接,在此情况下,该对象被称为连接的 rowset。rowset 还可以建立一个与数据源的连接,从其获取数据,然后关闭它。这种 rowset 被称为非连接 rowset。非连接 rowset 可以在断开时更改其数据,然后将这些更改发送回原始数据源,不过它必须重新建立连接才能完成此操作。
非连接 rowset 可以具有与之关联的 reader(RowSetReader 对象)和 writer(RowSetWriter 对象)。可以多种方式实现 reader 来使用数据填充 rowset,包括从非关系型数据源获取数据。也可以多种方式实现 writer 来将对 rowset 的数据所做的更改传回底层数据源。
Rowset 易于使用。RowSet 接口扩展了标准 java.sql.ResultSet 接口。RowSetMetaData 接口扩展了 java.sql.ResultSetMetaData 接口。因此,熟悉 JDBC API 的开发人员必须学习少数几个新 API 才能使用 rowset。此外,与 JDBC ResultSet 对象配套使用的第三方软件工具也可以方便地用于 rowset。
| 字段摘要 |
|---|
| 方法摘要 | |
|---|---|
void |
addRowSetListener(RowSetListener listener)
注册给定侦听器,以便此 RowSet 对象上发生事件时将得到通知。 |
void |
clearParameters()
清除为此 RowSet 对象命令设置的参数。 |
void |
execute()
使用数据填充此 RowSet 对象。 |
String |
getCommand()
获取此 RowSet 对象的命令属性。 |
String |
getDataSourceName()
获取标识此 RowSet 对象的数据源的逻辑名称。 |
boolean |
getEscapeProcessing()
获取是否为此 RowSet 对象启用转义处理。 |
int |
getMaxFieldSize()
获取可以对某些列值返回的最大字节数。 |
int |
getMaxRows()
获取此 RowSet 对象可以包含的最大行数。 |
String |
getPassword()
获取用于创建数据库连接的密码。 |
int |
getQueryTimeout()
获取驱动程序等待语句执行的最大秒数。 |
int |
getTransactionIsolation()
获取为此 RowSet 对象设置的事务隔离级别。 |
Map<String,Class<?>> |
getTypeMap()
获取与此 RowSet 对象关联的 Map 对象,该对象指定 SQL 用户定义类型的自定义映射关系(如果有)。 |
String |
getUrl()
如果此 RowSet 对象使用 DriverManager 而非 DataSource 对象建立连接,则获取创建连接时将使用的 url 属性。 |
String |
getUsername()
获取用于创建此 RowSet 对象的数据库连接的用户名。 |
boolean |
isReadOnly()
获取此 RowSet 对象是否是只读的。 |
void |
removeRowSetListener(RowSetListener listener)
从在此 RowSet 对象上发生事件时得到通知的组件所组成的列表中移除指定的侦听器。 |
void |
setArray(int i,
Array x)
使用给定 Array 值设置此 RowSet 对象命令中的指定参数。 |
void |
setAsciiStream(int parameterIndex,
InputStream x)
将此 RowSet 对象命令中的指定参数设置为给定输入流。 |
void |
setAsciiStream(int parameterIndex,
InputStream x,
int length)
将此 RowSet 对象命令中的指定参数设置为给定的 java.io.InputStream 值。 |
void |
setAsciiStream(String parameterName,
InputStream x)
将指定参数设置为给定输入流。 |
void |
setAsciiStream(String parameterName,
InputStream x,
int length)
将指定参数设置为给定输入流,该输入流将拥有指定字节数。 |
void |
setBigDecimal(int parameterIndex,
BigDecimal x)
将此 RowSet 对象命令中的指定参数设置为给定的 java.math.BigDeciaml 值。 |
void |
setBigDecimal(String parameterName,
BigDecimal x)
将指定参数设置为给定的 java.math.BigDecimal 值。 |
void |
setBinaryStream(int parameterIndex,
InputStream x)
将此 RowSet 对象命令中的指定参数设置为给定输入流。 |
void |
setBinaryStream(int parameterIndex,
InputStream x,
int length)
将此 RowSet 对象命令中的指定参数设置为给定的 java.io.InputStream 值。 |
void |
setBinaryStream(String parameterName,
InputStream x)
将指定参数设置为给定输入流。 |
void |
setBinaryStream(String parameterName,
InputStream x,
int length)
将指定参数设置为给定输入流,该输入流将拥有给定字节数。 |
void |
setBlob(int i,
Blob x)
使用给定 Blob 值设置此 RowSet 对象命令中的指定参数。 |
void |
setBlob(int parameterIndex,
InputStream inputStream)
将指定参数设置为 InputStream 对象。 |
void |
setBlob(int parameterIndex,
InputStream inputStream,
long length)
将指定参数设置为 InputStream 对象。 |
void |
setBlob(String parameterName,
Blob x)
将指定参数设置为给定的 java.sql.Blob 对象。 |
void |
setBlob(String parameterName,
InputStream inputStream)
将指定参数设置为 InputStream 对象。 |
void |
setBlob(String parameterName,
InputStream inputStream,
long length)
将指定参数设置为 InputStream 对象。 |
void |
setBoolean(int parameterIndex,
boolean x)
将此 RowSet 对象命令中的指定参数设置为给定的 Java boolean 值。 |
void |
setBoolean(String parameterName,
boolean x)
将指定参数设置为给定的 Java boolean 值。 |
void |
setByte(int parameterIndex,
byte x)
将此 RowSet 对象命令中的指定参数设置为给定的 Java byte 值。 |
void |
setByte(String parameterName,
byte x)
将指定参数设置为给定的 Java byte 值。 |
void |
setBytes(int parameterIndex,
byte[] x)
将此 RowSet 对象命令中的指定参数设置为给定的 Java byte 值数组。 |
void |
setBytes(String parameterName,
byte[] x)
将指定参数设置为给定的 Java byte 数组。 |
void |
setCharacterStream(int parameterIndex,
Reader reader)
将此 RowSet 对象命令中的指定参数设置为给定 Reader 对象。 |
void |
setCharacterStream(int parameterIndex,
Reader reader,
int length)
将此 RowSet 对象命令中的指定参数设置为给定的 java.io.Reader 值。 |
void |
setCharacterStream(String parameterName,
Reader reader)
将指定参数设置为给定 Reader 对象。 |
void |
setCharacterStream(String parameterName,
Reader reader,
int length)
将指定参数设置为给定 Reader 对象,该对象是给定的字符长度数目。 |
void |
setClob(int i,
Clob x)
使用给定 Clob 值设置此 RowSet 对象命令中的指定参数。 |
void |
setClob(int parameterIndex,
Reader reader)
将指定参数设置为 Reader 对象。 |
void |
setClob(int parameterIndex,
Reader reader,
long length)
将指定参数设置为 Reader 对象。 |
void |
setClob(String parameterName,
Clob x)
将指定参数设置为给定的 java.sql.Clob 对象。 |
void |
setClob(String parameterName,
Reader reader)
将指定参数设置为 Reader 对象。 |
void |
setClob(String parameterName,
Reader reader,
long length)
将指定参数设置为 Reader 对象。 |
void |
setCommand(String cmd)
将此 RowSet 对象的命令属性设置为给定的 SQL 查询。 |
void |
setConcurrency(int concurrency)
将此 RowSet 对象的并发性设置为给定的并发级别。 |
void |
setDataSourceName(String name)
将此 RowSet 对象的数据源名称属性设置为给定的 String。 |
void |
setDate(int parameterIndex,
Date x)
将此 RowSet 对象命令中的指定参数设置为给定的 java.sql.Date 值。 |
void |
setDate(int parameterIndex,
Date x,
Calendar cal)
使用给定 java.sql.Date 值设置此 RowSet 对象命令中的指定参数。 |
void |
setDate(String parameterName,
Date x)
使用运行应用程序的虚拟机所在的默认时区将指定参数设置为给定的 java.sql.Date 值。 |
void |
setDate(String parameterName,
Date x,
Calendar cal)
使用给定 Calendar 对象将指定参数设置为给定的 java.sql.Date 值。 |
void |
setDouble(int parameterIndex,
double x)
将此 RowSet 对象命令中的指定参数设置为给定的 Java double 值。 |
void |
setDouble(String parameterName,
double x)
将指定参数设置为给定的 Java double 值。 |
void |
setEscapeProcessing(boolean enable)
将此 RowSet 对象的转义处理设置为开或关。 |
void |
setFloat(int parameterIndex,
float x)
将此 RowSet 对象命令中的指定参数设置为给定的 Java float 值。 |
void |
setFloat(String parameterName,
float x)
将指定参数设置为给定的 Java float 值。 |
void |
setInt(int parameterIndex,
int x)
将此 RowSet 对象命令中的指定参数设置为给定的 Java int 值。 |
void |
setInt(String parameterName,
int x)
将指定参数设置为给定的 Java int 值。 |
void |
setLong(int parameterIndex,
long x)
将此 RowSet 对象命令中的指定参数设置为给定的 Java long 值。 |
void |
setLong(String parameterName,
long x)
将指定参数设置为给定的 Java long 值。 |
void |
setMaxFieldSize(int max)
将可以对列值返回的最大字节数设置为给定的字节数。 |
void |
setMaxRows(int max)
将此 RowSet 对象可以包含的最大行数设置为指定数。 |
void |
setNCharacterStream(int parameterIndex,
Reader value)
将此 RowSet 对象命令中的指定参数设置为 Reader 对象。 |
void |
setNCharacterStream(int parameterIndex,
Reader value,
long length)
将指定参数设置为 Reader 对象。 |
void |
setNCharacterStream(String parameterName,
Reader value)
将指定参数设置为 Reader 对象。 |
void |
setNCharacterStream(String parameterName,
Reader value,
long length)
将指定参数设置为 Reader 对象。 |
void |
setNClob(int parameterIndex,
NClob value)
将指定参数设置为 java.sql.NClob 对象。 |
void |
setNClob(int parameterIndex,
Reader reader)
将指定参数设置为 Reader 对象。 |
void |
setNClob(int parameterIndex,
Reader reader,
long length)
将指定参数设置为 Reader 对象。 |
void |
setNClob(String parameterName,
NClob value)
将指定参数设置为 java.sql.NClob 对象。 |
void |
setNClob(String parameterName,
Reader reader)
将指定参数设置为 Reader 对象。 |
void |
setNClob(String parameterName,
Reader reader,
long length)
将指定参数设置为 Reader 对象。 |
void |
setNString(int parameterIndex,
String value)
将指定参数设置为给定的 String 对象。 |
void |
setNString(String parameterName,
String value)
将指定参数设置为给定的 String 对象。 |
void |
setNull(int parameterIndex,
int sqlType)
将此 RowSet 对象的 SQL 命令中的指定参数设置为 SQL NULL。 |
void |
setNull(int paramIndex,
int sqlType,
String typeName)
将此 RowSet 对象的 SQL 命令中的指定参数设置为 SQL NULL。 |
void |
setNull(String parameterName,
int sqlType)
将指定参数设置为 SQL NULL。 |
void |
setNull(String parameterName,
int sqlType,
String typeName)
将指定参数设置为 SQL NULL。 |
void |
setObject(int parameterIndex,
Object x)
使用 Java Object 设置此 RowSet 对象命令中的指定参数。 |
void |
setObject(int parameterIndex,
Object x,
int targetSqlType)
使用 Java Object 设置此 RowSet 对象命令中的指定参数。 |
void |
setObject(int parameterIndex,
Object x,
int targetSqlType,
int scaleOrLength)
使用给定 Java Object 设置此 RowSet 对象命令中的指定参数。 |
void |
setObject(String parameterName,
Object x)
使用给定对象设置指定参数的值。 |
void |
setObject(String parameterName,
Object x,
int targetSqlType)
使用给定对象设置指定参数的值。 |
void |
setObject(String parameterName,
Object x,
int targetSqlType,
int scale)
使用给定对象设置指定参数的值。 |
void |
setPassword(String password)
将此 RowSet 对象的数据库密码设置为给定的 String。 |
void |
setQueryTimeout(int seconds)
将驱动程序等待语句执行的最大秒数设置为给定的秒数。 |
void |
setReadOnly(boolean value)
将此 RowSet 对象的只读性设置为给定的 boolean 值。 |
void |
setRef(int i,
Ref x)
使用给定 Ref 值设置此 RowSet 对象命令中的指定参数。 |
void |
setRowId(int parameterIndex,
RowId x)
将指定参数设置为给定的 java.sql.RowId 对象。 |
void |
setRowId(String parameterName,
RowId x)
将指定参数设置为给定的 java.sql.RowId 对象。 |
void |
setShort(int parameterIndex,
short x)
将此 RowSet 对象命令中的指定参数设置为给定的 Java short 值。 |
void |
setShort(String parameterName,
short x)
将指定参数设置为给定的 Java short 值。 |
void |
setSQLXML(int parameterIndex,
SQLXML xmlObject)
将指定参数设置为给定 java.sql.SQLXML 对象。 |
void |
setSQLXML(String parameterName,
SQLXML xmlObject)
将指定参数设置为给定的 java.sql.SQLXML 对象。 |
void |
setString(int parameterIndex,
String x)
将此 RowSet 对象命令中的指定参数设置为给定的 Java String 值。 |
void |
setString(String parameterName,
String x)
将指定参数设置为给定的 Java String 值。 |
void |
setTime(int parameterIndex,
Time x)
将此 RowSet 对象命令中的指定参数设置为给定的 java.sql.Time 值。 |
void |
setTime(int parameterIndex,
Time x,
Calendar cal)
使用给定 java.sql.Time 值设置此 RowSet 对象命令中的指定参数。 |
void |
setTime(String parameterName,
Time x)
将指定参数设置为给定的 java.sql.Time 值。 |
void |
setTime(String parameterName,
Time x,
Calendar cal)
使用给定 Calendar 对象将指定参数设置为给定的 java.sql.Time 值。 |
void |
setTimestamp(int parameterIndex,
Timestamp x)
将此 RowSet 对象命令中的指定参数设置为给定的 java.sql.Timestamp 值。 |
void |
setTimestamp(int parameterIndex,
Timestamp x,
Calendar cal)
使用给定 java.sql.Timestamp 值设置此 RowSet 对象命令中的指定参数。 |
void |
setTimestamp(String parameterName,
Timestamp x)
将指定参数设置为给定的 java.sql.Timestamp 值。 |
void |
setTimestamp(String parameterName,
Timestamp x,
Calendar cal)
使用给定 Calendar 对象将指定参数设置为给定的 java.sql.Timestamp 值。 |
void |
setTransactionIsolation(int level)
设置此 RowSet 对象的事务隔离级别。 |
void |
setType(int type)
将此 RowSet 对象的类型设置为给定的类型。 |
void |
setTypeMap(Map<String,Class<?>> map)
将给定 java.util.Map 对象安装为此 RowSet 对象的默认类型映射表。 |
void |
setURL(int parameterIndex,
URL x)
将指定参数设置为给定的 java.net.URL 值。 |
void |
setUrl(String url)
设置此 RowSet 对象在使用 DriverManager 创建连接时将使用的 URL。 |
void |
setUsername(String name)
将此 RowSet 对象的用户名属性设置为给定的 String。 |
| 从接口 java.sql.Wrapper 继承的方法 |
|---|
isWrapperFor, unwrap |
| 方法详细信息 |
|---|
String getUrl() throws SQLException
RowSet 对象使用 DriverManager 而非 DataSource 对象建立连接,则获取创建连接时将使用的 url 属性。默认值为 null。
SQLException - 如果发生数据库访问错误setUrl(java.lang.String)void setUrl(String url) throws SQLException
RowSet 对象在使用 DriverManager 创建连接时将使用的 URL。
设置此属性是可选的。如果使用 URL,则在使用 rowset 连接到数据库之前,必须加载接受 URL 的 JDBC 驱动程序。在读取或写入数据时,rowset 将在内部使用 URL 创建数据库连接。创建连接时可能使用 URL,也可能使用数据源名称,具体取决于最近一次设置为非 null 值的是哪一个。
url - 字符串值;可以为 null
SQLException - 如果发生数据库访问错误getUrl()String getDataSourceName()
RowSet 对象的数据源的逻辑名称。
setDataSourceName(java.lang.String),
setUrl(java.lang.String)void setDataSourceName(String name) throws SQLException
RowSet 对象的数据源名称属性设置为给定的 String。
可以使用数据源名称属性的值来查找已经在命名服务中注册的 DataSource 对象。完成检索后,可以使用 DataSource 对象创建到它所表示的数据源的连接。
name - 此 RowSet 对象数据源的逻辑名称;可以为 null
SQLException - 如果发生数据库访问错误getDataSourceName()String getUsername()
RowSet 对象的数据库连接的用户名。用户名属性是在调用 execute 方法前在运行时设置的。它通常不是 RowSet 对象的序列化状态的一部分。
setUsername(java.lang.String)void setUsername(String name) throws SQLException
RowSet 对象的用户名属性设置为给定的 String。
name - 用户名
SQLException - 如果发生数据库访问错误getUsername()String getPassword()
execute 方法前在运行时设置的。它通常不是 RowSet 对象的序列化状态的一部分。
setPassword(java.lang.String)void setPassword(String password) throws SQLException
RowSet 对象的数据库密码设置为给定的 String。
password - 密码字符串
SQLException - 如果发生数据库访问错误getPassword()int getTransactionIsolation()
RowSet 对象设置的事务隔离级别。
Connection.TRANSACTION_READ_UNCOMMITTED、Connection.TRANSACTION_READ_COMMITTED、Connection.TRANSACTION_REPEATABLE_READ 或 Connection.TRANSACTION_SERIALIZABLE 之一setTransactionIsolation(int)
void setTransactionIsolation(int level)
throws SQLException
RowSet 对象的事务隔离级别。
level - 事务隔离级别;Connection.TRANSACTION_READ_UNCOMMITTED、Connection.TRANSACTION_READ_COMMITTED、Connection.TRANSACTION_REPEATABLE_READ 或 Connection.TRANSACTION_SERIALIZABLE 之一
SQLException - 如果发生数据库访问错误getTransactionIsolation()Map<String,Class<?>> getTypeMap() throws SQLException
RowSet 对象关联的 Map 对象,该对象指定 SQL 用户定义类型的自定义映射关系(如果有)。默认类型映射为空。
java.util.Map 对象,该对象包含 SQL 用户定义类型的名称及其映射到的 Java 类
SQLException - 如果发生数据库访问错误setTypeMap(java.util.Map>) void setTypeMap(Map<String,Class<?>> map) throws SQLException
java.util.Map 对象安装为此 RowSet 对象的默认类型映射表。在通过方法参数提供另一个类型映射表之前,将一直使用此类型映射表。
map - 一个 java.util.Map 对象,该对象包含 SQL 用户定义类型的名称及其映射到的 Java 类
SQLException - 如果发生数据库访问错误getTypeMap()String getCommand()
RowSet 对象的命令属性。
命令属性包含命令字符串,该字符串必须为 SQL 查询,执行该查询可以使用数据填充 rowset。默认值为 null。
nullsetCommand(java.lang.String)void setCommand(String cmd) throws SQLException
RowSet 对象的命令属性设置为给定的 SQL 查询。
当 rowset 从不支持命令的数据源(如电子表格)获取数据时,此属性是可选的。
cmd - 将用于为此 RowSet 对象获取数据的 SQL 查询;可以为 null
SQLException - 如果发生数据库访问错误getCommand()boolean isReadOnly()
RowSet 对象是否是只读的。如果能够进行更新,则默认 rowset 为可更新。
试图更新只读 rowset 将导致抛出 SQLException。
RowSet 对象是只读的,则返回 true;如果它是可更新的,则返回 falsesetReadOnly(boolean)
void setReadOnly(boolean value)
throws SQLException
RowSet 对象的只读性设置为给定的 boolean 值。
value - 如果只读,则该值为 true;如果可更新,则为 false
SQLException - 如果发生数据库访问错误isReadOnly()
int getMaxFieldSize()
throws SQLException
BINARY、VARBINARY、LONGVARBINARYBINARY、CHAR、VARCHAR、LONGVARCHAR、NCHAR 和 NVARCHAR 列。如果超过了该限制,则默认丢弃多出的数据。
SQLException - 如果发生数据库访问错误setMaxFieldSize(int)
void setMaxFieldSize(int max)
throws SQLException
BINARY、VARBINARY、LONGVARBINARYBINARY、CHAR、VARCHAR、LONGVARCHAR、NCHAR 和 NVARCHAR 列。如果超过了该限制,则默认丢弃多出的数据。为了获得最大的可移植性,应该使用大于 256 的值。
max - 以字节为单位的新最大列大小限制;零表示没有任何限制
SQLException - 如果发生数据库访问错误getMaxFieldSize()
int getMaxRows()
throws SQLException
RowSet 对象可以包含的最大行数。如果超过了该限制,则正常撤消多出的行。
RowSet 对象可以包含的当前最大行数;零表示不存在任何限制
SQLException - 如果发生数据库访问错误setMaxRows(int)
void setMaxRows(int max)
throws SQLException
RowSet 对象可以包含的最大行数设置为指定数。如果超过了该限制,则正常撤消多出的行。
max - 新最大行数;零表示没有任何限制
SQLException - 如果发生数据库访问错误getMaxRows()
boolean getEscapeProcessing()
throws SQLException
RowSet 对象启用转义处理。如果启用转义扫描(默认值),则驱动程序在将 SQL 语句发送到数据库之前将执行转义替换。
true;如果禁用,则返回 false
SQLException - 如果发生数据库访问错误setEscapeProcessing(boolean)
void setEscapeProcessing(boolean enable)
throws SQLException
RowSet 对象的转义处理设置为开或关。如果转义扫描为开启(默认值),则驱动程序在将 SQL 语句发送到数据库之前将执行转义替换。
enable - 为 true 表示启用转义处理;为 false 表示禁用转义处理
SQLException - 如果发生数据库访问错误getEscapeProcessing()
int getQueryTimeout()
throws SQLException
SQLException。
SQLException - 如果发生数据库访问错误setQueryTimeout(int)
void setQueryTimeout(int seconds)
throws SQLException
SQLException。
seconds - 以秒为单位的新查询超时限制;零表示不存在任何限制
SQLException - 如果发生数据库访问错误getQueryTimeout()
void setType(int type)
throws SQLException
RowSet 对象的类型设置为给定的类型。此方法用于更改 rowset 的类型,默认情况下该类型为只读且不可滚动。
type - 以下指定类型的 ResultSet 常量之一:ResultSet.TYPE_FORWARD_ONLY、ResultSet.TYPE_SCROLL_INSENSITIVE 或 ResultSet.TYPE_SCROLL_SENSITIVE
SQLException - 如果发生数据库访问错误ResultSet.getType()
void setConcurrency(int concurrency)
throws SQLException
RowSet 对象的并发性设置为给定的并发级别。此方法用于更改 rowset 的并发级别,默认情况下为 ResultSet.CONCUR_READ_ONLY。
concurrency - 以下指定并发级别的 ResultSet 常量之一:ResultSet.CONCUR_READ_ONLY 或 ResultSet.CONCUR_UPDATABLE
SQLException - 如果发生数据库访问错误ResultSet.getConcurrency()
void setNull(int parameterIndex,
int sqlType)
throws SQLException
RowSet 对象的 SQL 命令中的指定参数设置为 SQL NULL。
注: 必须指定参数的 SQL 类型。
parameterIndex - 第一个参数的索引是 1,第二个参数的索引是 2 ……sqlType - 由 java.sql.Types 定义的 SQL 类型代码
SQLException - 如果发生数据库访问错误void setNull(String parameterName, int sqlType) throws SQLException
NULL。
注: 必须指定该参数的 SQL 类型。
parameterName - 参数的名称sqlType - java.sql.Types 中定义的 SQL 类型代码
SQLException - 如果发生数据库访问错误或者在关闭的 CallableStatement 上调用此方法
SQLFeatureNotSupportedException - 如果 JDBC 驱动程序不支持此方法
void setNull(int paramIndex,
int sqlType,
String typeName)
throws SQLException
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 参数。
paramIndex - 第一个参数是 1,第二个参数是 2 ……sqlType - 取自 java.sql.Types 的值typeName - SQL UDT 的完全限定名或 REF 类型引用的 SQL 结构化类型的名称;如果不是 UDT 或 REF 类型,则忽略该参数
SQLException - 如果发生数据库访问错误void setNull(String parameterName, int sqlType, String typeName) throws SQLException
NULL。这种 setNull 方法应该用于用户定义类型和 REF 类型参数。用户定义类型的示例有:STRUCT、DISTINCT、JAVA_OBJECT 和指定数组类型。
注: 为了便于移植,在指定 NULL 用户定义参数或 REF 参数时,应用程序必须提供 SQL 类型代码和完全限定的 SQL 类型名称。 在用户定义类型的情况下,名称是参数本身的类型名称。对于 REF 参数,名称是所引用类型的类型名称。如果 JDBC 驱动程序不需要类型代码或类型名称信息,那么它可以忽略这些信息。 尽管此方法供用户定义参数和 Ref 参数使用,但也可以使用它设置任何 JDBC 类型的 null 参数。如果该参数不具有用户定义类型或 REF 类型,则忽略给定 typeName。
parameterName - 参数的名称sqlType - 取自 java.sql.Types 的值typeName - SQL 用户定义类型的完全限定名称;如果该参数不是用户定义类型或 SQL REF 值,则忽略它
SQLException - 如果发生数据库访问错误或者在关闭的 CallableStatement 上调用此方法
SQLFeatureNotSupportedException - 如果 JDBC 驱动程序不支持此方法
void setBoolean(int parameterIndex,
boolean x)
throws SQLException
RowSet 对象命令中的指定参数设置为给定的 Java boolean 值。在将此值发送到数据库之前,驱动程序将其转换为 SQL BIT 值。
parameterIndex - 第一个参数的索引是 1,第二个参数的索引是 2 ……x - 参数值
SQLException - 如果发生数据库访问错误void setBoolean(String parameterName, boolean x) throws SQLException
boolean 值。在将此值发送到数据库时,驱动程序将其转换为 SQL BIT 或 BOOLEAN 值。
parameterName - 参数的名称x - 参数值
SQLException - 如果发生数据库访问错误或者在关闭的 CallableStatement 上调用此方法
SQLFeatureNotSupportedException - 如果 JDBC 驱动程序不支持此方法ResultSet.getBoolean(int)
void setByte(int parameterIndex,
byte x)
throws SQLException
RowSet 对象命令中的指定参数设置为给定的 Java byte 值。在将此值发送到数据库之前,驱动程序将其转换为 SQL TINYINT 值。
parameterIndex - 第一个参数的索引是 1,第二个参数的索引是 2 ……x - 参数值
SQLException - 如果发生数据库访问错误void setByte(String parameterName, byte x) throws SQLException
byte 值。在将此值发送到数据库时,驱动程序将其转换为 SQL TINYINT 值。
parameterName - 参数的名称x - 参数值
SQLException - 如果发生数据库访问错误或者在关闭的 CallableStatement 上调用此方法
SQLFeatureNotSupportedException - 如果 JDBC 驱动程序不支持此方法ResultSet.getByte(int)
void setShort(int parameterIndex,
short x)
throws SQLException
RowSet 对象命令中的指定参数设置为给定的 Java short 值。在将此值发送到数据库之前,驱动程序将其转换为 SQL SMALLINT 值。
parameterIndex - 第一个参数的索引是 1,第二个参数的索引是 2 ……x - 参数值
SQLException - 如果发生数据库访问错误void setShort(String parameterName, short x) throws SQLException
short 值。在将此值发送到数据库时,驱动程序将其转换为 SQL SMALLINT 值。
parameterName - 参数的名称x - 参数值
SQLException - 如果发生数据库访问错误或者在关闭的 CallableStatement 上调用此方法
SQLFeatureNotSupportedException - 如果 JDBC 驱动程序不支持此方法ResultSet.getShort(int)
void setInt(int parameterIndex,
int x)
throws SQLException
RowSet 对象命令中的指定参数设置为给定的 Java int 值。在将此值发送到数据库之前,驱动程序将其转换为 SQL INTEGER 值。
parameterIndex - 第一个参数的索引是 1,第二个参数的索引是 2 ……x - 参数值
SQLException - 如果发生数据库访问错误void setInt(String parameterName, int x) throws SQLException
int 值。在将此值发送到数据库时,驱动程序将其转换为 SQL INTEGER 值。
parameterName - 参数的名称x - 参数值
SQLException - 如果发生数据库访问错误或者在关闭的 CallableStatement 上调用此方法
SQLFeatureNotSupportedException - 如果 JDBC 驱动程序不支持此方法ResultSet.getInt(int)
void setLong(int parameterIndex,
long x)
throws SQLException
RowSet 对象命令中的指定参数设置为给定的 Java long 值。在将此值发送到数据库之前,驱动程序将其转换为 SQL BIGINT 值。
parameterIndex - 第一个参数的索引是 1,第二个参数的索引是 2 ……x - 参数值
SQLException - 如果发生数据库访问错误void setLong(String parameterName, long x) throws SQLException
long 值。在将此值发送到数据库时,驱动程序将其转换为 SQL BIGINT 值。
parameterName - 参数的名称x - 参数值
SQLException - 如果发生数据库访问错误或者在关闭的 CallableStatement 上调用此方法
SQLFeatureNotSupportedException - 如果 JDBC 驱动程序不支持此方法ResultSet.getLong(int)
void setFloat(int parameterIndex,
float x)
throws SQLException
RowSet 对象命令中的指定参数设置为给定的 Java float 值。在将此值发送到数据库之前,驱动程序将其转换为 SQL REAL 值。
parameterIndex - 第一个参数的索引是 1,第二个参数的索引是 2 ……x - 参数值
SQLException - 如果发生数据库访问错误void setFloat(String parameterName, float x) throws SQLException
float 值。在将此值发送到数据库时,驱动程序将其转换为 SQL FLOAT 值。
parameterName - 参数的名称x - 参数值
SQLException - 如果发生数据库访问错误或者在关闭的 CallableStatement 上调用此方法
SQLFeatureNotSupportedException - 如果 JDBC 驱动程序不支持此方法ResultSet.getFloat(int)
void setDouble(int parameterIndex,
double x)
throws SQLException
RowSet 对象命令中的指定参数设置为给定的 Java double 值。在将此值发送到数据库之前,驱动程序将其转换为 SQL DOUBLE 值。
parameterIndex - 第一个参数的索引是 1,第二个参数的索引是 2 ……x - 参数值
SQLException - 如果发生数据库访问错误void setDouble(String parameterName, double x) throws SQLException
double 值。在将此值发送到数据库时,驱动程序将其转换为 SQL DOUBLE 值。
parameterName - 参数的名称x - 参数值
SQLException - 如果发生数据库访问错误或者在关闭的 CallableStatement 上调用此方法
SQLFeatureNotSupportedException - 如果 JDBC 驱动程序不支持此方法ResultSet.getDouble(int)
void setBigDecimal(int parameterIndex,
BigDecimal x)
throws SQLException
RowSet 对象命令中的指定参数设置为给定的 java.math.BigDeciaml 值。在将此值发送到数据库之前,驱动程序将其转换为 SQL NUMERIC 值。
parameterIndex - 第一个参数的索引是 1,第二个参数的索引是 2 ……x - 参数值
SQLException - 如果发生数据库访问错误void setBigDecimal(String parameterName, BigDecimal&nbs