public interface CallableStatement
implements PreparedStatement
| java.sql.CallableStatement |
用于执行SQL存储过程的接口。 JDBC API提供了一种存储过程SQL转义语法,允许以标准方式为所有RDBMS调用存储过程。 这种转义语法有一种形式,其中包含一个结果参数,另一种不包含结果参数。 如果使用,结果参数必须注册为OUT参数。 其他参数可用于输入,输出或两者。 参数按数字顺序参考,第一个参数为1。
{?= call <procedure-name>[(<arg1>,<arg2>, ...)]}
{call <procedure-name>[(<arg1>,<arg2>, ...)]}
IN参数值是使用所设定的set从继承的方法PreparedStatement 。 所有OUT参数的类型必须在执行存储过程之前注册; 它们的值在执行后通过此处提供的get方法检索。
一个CallableStatement可以返回一个ResultSet对象或多个ResultSet对象。 使用从Statement继承的操作处理多个ResultSet对象。
为了最大的可移植性,调用的 ResultSet对象和更新计数应该在获得输出参数的值进行处理。
也可以看看:
Inherited constants |
|---|
java.sql.Statement
|
Public methods |
|
|---|---|
abstract Array |
getArray(int parameterIndex) 以Java编程语言中的 |
abstract Array |
getArray(String parameterName) |
abstract BigDecimal |
getBigDecimal(String parameterName) 以 |
abstract BigDecimal |
getBigDecimal(int parameterIndex, int scale) 此方法在API级别1中已弃用。请使用 |
abstract BigDecimal |
getBigDecimal(int parameterIndex) 以 |
abstract Blob |
getBlob(int parameterIndex) 以Java编程语言中的 |
abstract Blob |
getBlob(String parameterName) 以Java编程语言中的 |
abstract boolean |
getBoolean(String parameterName) 以Java编程语言中的 |
abstract boolean |
getBoolean(int parameterIndex) 以Java编程语言中的 |
abstract byte |
getByte(String parameterName) 检索JDBC的价值 |
abstract byte |
getByte(int parameterIndex) 获取指定的JDBC的价值 |
abstract byte[] |
getBytes(String parameterName) 以Java编程语言中 |
abstract byte[] |
getBytes(int parameterIndex) 以Java编程语言中 |
abstract Reader |
getCharacterStream(int parameterIndex) 以Java编程语言中的 |
abstract Reader |
getCharacterStream(String parameterName) 以Java编程语言中的 |
abstract Clob |
getClob(int parameterIndex) 以Java编程语言中的 |
abstract Clob |
getClob(String parameterName) 以Java编程语言中的 |
abstract Date |
getDate(int parameterIndex) 以 |
abstract Date |
getDate(String parameterName) 以 |
abstract Date |
getDate(String parameterName, Calendar cal) 使用给定的 |
abstract Date |
getDate(int parameterIndex, Calendar cal) 使用给定的 |
abstract double |
getDouble(int parameterIndex) 获取指定的JDBC的价值 |
abstract double |
getDouble(String parameterName) 以Java编程语言 |
abstract float |
getFloat(String parameterName) 检索JDBC的价值 |
abstract float |
getFloat(int parameterIndex) 以Java编程语言 |
abstract int |
getInt(int parameterIndex) 以Java编程语言中的 |
abstract int |
getInt(String parameterName) 以Java编程语言中的 |
abstract long |
getLong(String parameterName) 检索JDBC的价值 |
abstract long |
getLong(int parameterIndex) 以Java编程语言 |
abstract Reader |
getNCharacterStream(int parameterIndex) 以Java编程语言中的 |
abstract Reader |
getNCharacterStream(String parameterName) 以Java编程语言中的 |
abstract NClob |
getNClob(String parameterName) 以Java编程语言中的 |
abstract NClob |
getNClob(int parameterIndex) 以Java编程语言中的 |
abstract String |
getNString(String parameterName) 检索指定的值 |
abstract String |
getNString(int parameterIndex) 检索指定的值 |
abstract Object |
getObject(int parameterIndex) 以Java编程语言中的 |
abstract Object |
getObject(String parameterName) 以Java编程语言中的 |
abstract Object |
getObject(int parameterIndex, Map<String, Class<?>> map) 返回表示OUT参数值 |
abstract Object |
getObject(String parameterName, Map<String, Class<?>> map) 返回表示OUT参数值 |
abstract Ref |
getRef(int parameterIndex) 以Java编程语言中的 |
abstract Ref |
getRef(String parameterName) 以Java编程语言中的 |
abstract RowId |
getRowId(int parameterIndex) 以 |
abstract RowId |
getRowId(String parameterName) 以 |
abstract SQLXML |
getSQLXML(String parameterName) 以Java编程语言中的 |
abstract SQLXML |
getSQLXML(int parameterIndex) 以Java编程语言中的 |
abstract short |
getShort(String parameterName) 检索JDBC的价值 |
abstract short |
getShort(int parameterIndex) 获取指定的JDBC的价值 |
abstract String |
getString(int parameterIndex) 获取指定的JDBC的价值 |
abstract String |
getString(String parameterName) 检索JDBC的价值 |
abstract Time |
getTime(String parameterName) 以 |
abstract Time |
getTime(String parameterName, Calendar cal) 使用给定的 |
abstract Time |
getTime(int parameterIndex) 以 |
abstract Time |
getTime(int parameterIndex, Calendar cal) 使用给定的 |
abstract Timestamp |
getTimestamp(int parameterIndex, Calendar cal) 检索指定JDBC的值 |
abstract Timestamp |
getTimestamp(int parameterIndex) 以 |
abstract Timestamp |
getTimestamp(String parameterName, Calendar cal) 检索JDBC的值 |
abstract Timestamp |
getTimestamp(String parameterName) 以 |
abstract URL |
getURL(int parameterIndex) 以 |
abstract URL |
getURL(String parameterName) 以 |
abstract void |
registerOutParameter(int parameterIndex, int sqlType) 将序号为 |
abstract void |
registerOutParameter(String parameterName, int sqlType, String typeName) 注册指定的输出参数。 |
abstract void |
registerOutParameter(int parameterIndex, int sqlType, String typeName) 注册指定的输出参数。 |
abstract void |
registerOutParameter(int parameterIndex, int sqlType, int scale) 将顺序位置 |
abstract void |
registerOutParameter(String parameterName, int sqlType, int scale) 将名为 |
abstract void |
registerOutParameter(String parameterName, int sqlType) 将名为 |
abstract void |
setAsciiStream(String parameterName, InputStream x, int length) 将指定的参数设置为给定的输入流,该输入流将具有指定的字节数。 |
abstract void |
setAsciiStream(String parameterName, InputStream x, long length) 将指定的参数设置为给定的输入流,该输入流将具有指定的字节数。 |
abstract void |
setAsciiStream(String parameterName, InputStream x) 将指定的参数设置为给定的输入流。 |
abstract void |
setBigDecimal(String parameterName, BigDecimal x) 将指定参数设置为给定的 |
abstract void |
setBinaryStream(String parameterName, InputStream x) 将指定的参数设置为给定的输入流。 |
abstract void |
setBinaryStream(String parameterName, InputStream x, long length) 将指定的参数设置为给定的输入流,该输入流将具有指定的字节数。 |
abstract void |
setBinaryStream(String parameterName, InputStream x, int length) 将指定的参数设置为给定的输入流,该输入流将具有指定的字节数。 |
abstract void |
setBlob(String parameterName, Blob x) 将指定参数设置为给定的 |
abstract void |
setBlob(String parameterName, InputStream inputStream, long length) 将指定参数设置为 |
abstract void |
setBlob(String parameterName, InputStream inputStream) 将指定的参数设置为 |
abstract void |
setBoolean(String parameterName, boolean x) 将指定的参数设置为给定的Java |
abstract void |
setByte(String parameterName, byte x) 将指定参数设置为给定的Java |
abstract void |
setBytes(String parameterName, byte[] x) 将指定参数设置为给定的Java字节数组。 |
abstract void |
setCharacterStream(String parameterName, Reader reader, int length) 将指定的参数设置为给定的 |
abstract void |
setCharacterStream(String parameterName, Reader reader, long length) 将指定的参数设置为给定的 |
abstract void |
setCharacterStream(String parameterName, 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 |
setDate(String parameterName, Date x, Calendar cal) 使用给定的 |
abstract void |
setDate(String parameterName, Date x) 使用运行应用程序的虚拟机的默认时区将指定参数设置为给定的 |
abstract void |
setDouble(String parameterName, double x) 将指定参数设置为给定的Java |
abstract void |
setFloat(String parameterName, float x) 将指定的参数设置为给定的Java |
abstract void |
setInt(String parameterName, int x) 将指定的参数设置为给定的Java |
abstract void |
setLong(String parameterName, long x) 将指定的参数设置为给定的Java |
abstract void |
setNCharacterStream(String parameterName, 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(String parameterName, Reader reader) 将指定的参数设置为 |
abstract void |
setNString(String parameterName, String value) 将指定参数设置为给定的 |
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(String parameterName, Object x, int targetSqlType) 用给定的对象设置指定参数的值。 |
abstract void |
setObject(String parameterName, Object x) 用给定的对象设置指定参数的值。 |
abstract void |
setRowId(String parameterName, RowId x) 将指定参数设置为给定的 |
abstract void |
setSQLXML(String parameterName, SQLXML xmlObject) 将指定参数设置为给定的 |
abstract void |
setShort(String parameterName, short x) 将指定的参数设置为给定的Java |
abstract void |
setString(String parameterName, String x) 将指定参数设置为给定的Java |
abstract void |
setTime(String parameterName, Time x, Calendar cal) 使用给定的 |
abstract void |
setTime(String parameterName, Time x) 将指定参数设置为给定的 |
abstract void |
setTimestamp(String parameterName, Timestamp x, Calendar cal) 使用给定的 |
abstract void |
setTimestamp(String parameterName, Timestamp x) 将指定参数设置为给定的 |
abstract void |
setURL(String parameterName, URL val) 将指定参数设置为给定的 |
abstract boolean |
wasNull() 检索读取的最后一个OUT参数是否具有SQL |
Inherited methods |
|
|---|---|
java.sql.PreparedStatement
|
|
java.sql.Statement
|
|
java.sql.Wrapper
|
|
java.lang.AutoCloseable
|
|
Array getArray (int parameterIndex)
以Java编程语言中的 Array对象的形式检索指定的JDBC ARRAY参数的值。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
| Returns | |
|---|---|
Array |
the parameter value as an Array object in the Java programming language. If the value was SQL NULL, the value null is returned. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; 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 |
Array getArray (String parameterName)
以Java编程语言中的 Array对象的 Array检索JDBC ARRAY参数的值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
Array |
the parameter value as an Array object in Java programming language. If the value was SQL NULL, the value null is returned. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
BigDecimal getBigDecimal (String parameterName)
以 java.math.BigDecimal对象的形式检索JDBC NUMERIC参数的值,该值包含小数点右侧的位数。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
BigDecimal |
the parameter value in full precision. If the value is SQL NULL, the result is null. |
| Throws | |
|---|---|
|
parameterName does not correspond to a named parameter; 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 |
SQLException |
|
BigDecimal getBigDecimal (int parameterIndex, int scale)
此方法在API级别1中已弃用。
请使用getBigDecimal(int parameterIndex)或getBigDecimal(String parameterName)
以 java.math.BigDecimal对象的小数点右侧的 刻度位数检索指定的JDBC NUMERIC参数的值。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
scale |
int: the number of digits to the right of the decimal point |
| Returns | |
|---|---|
BigDecimal |
the parameter value. If the value is SQL NULL, the result is null. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; 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 |
BigDecimal getBigDecimal (int parameterIndex)
以 java.math.BigDecimal对象的形式检索指定的JDBC NUMERIC参数的值,该值包含小数点右侧的位数。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
| Returns | |
|---|---|
BigDecimal |
the parameter value in full precision. If the value is SQL NULL, the result is null. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
Blob getBlob (int parameterIndex)
以Java编程语言中的 Blob对象的形式检索指定的JDBC BLOB参数的值。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
| Returns | |
|---|---|
Blob |
the parameter value as a Blob object in the Java programming language. If the value was SQL NULL, the value null is returned. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; 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 |
Blob getBlob (String parameterName)
以Java编程语言中的 Blob对象的形式检索JDBC BLOB参数的值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
Blob |
the parameter value as a Blob object in the Java programming language. If the value was SQL NULL, the value null is returned. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
boolean getBoolean (String parameterName)
以Java编程语言中的 boolean检索JDBC BIT或 BOOLEAN参数的值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
boolean |
the parameter value. If the value is SQL NULL, the result is false. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
也可以看看:
boolean getBoolean (int parameterIndex)
以Java编程语言中的 boolean检索指定的JDBC BIT或 BOOLEAN参数的值。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
| Returns | |
|---|---|
boolean |
the parameter value. If the value is SQL NULL, the result is false. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
也可以看看:
byte getByte (String parameterName)
以Java编程语言 byte检索JDBC TINYINT参数的值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
byte |
the parameter value. If the value is SQL NULL, the result is 0. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
也可以看看:
byte getByte (int parameterIndex)
以Java编程语言 byte检索指定的JDBC TINYINT参数的值。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
| Returns | |
|---|---|
byte |
the parameter value. If the value is SQL NULL, the result is 0. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
也可以看看:
byte[] getBytes (String parameterName)
以Java编程语言中 byte值的数组形式检索JDBC BINARY或 VARBINARY参数的值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
byte[] |
the parameter value. If the value is SQL NULL, the result is null. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
也可以看看:
byte[] getBytes (int parameterIndex)
以Java编程语言中的 byte值的数组形式检索指定的JDBC BINARY或 VARBINARY参数的值。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
| Returns | |
|---|---|
byte[] |
the parameter value. If the value is SQL NULL, the result is null. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
也可以看看:
Reader getCharacterStream (int parameterIndex)
以Java编程语言中的 java.io.Reader对象检索指定参数的值。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
| Returns | |
|---|---|
Reader |
a java.io.Reader object that contains the parameter value; if the value is SQL NULL, the value returned is null in the Java programming language. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
Reader getCharacterStream (String parameterName)
以Java编程语言中的 java.io.Reader对象检索指定参数的值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
Reader |
a java.io.Reader object that contains the parameter value; if the value is SQL NULL, the value returned is null in the Java programming language |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
Clob getClob (int parameterIndex)
以Java编程语言中的 java.sql.Clob对象的形式检索指定的JDBC CLOB参数的值。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
| Returns | |
|---|---|
Clob |
the parameter value as a Clob object in the Java programming language. If the value was SQL NULL, the value null is returned. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; 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 |
Clob getClob (String parameterName)
以Java编程语言中的 java.sql.Clob对象的形式检索JDBC CLOB参数的值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
Clob |
the parameter value as a Clob object in the Java programming language. If the value was SQL NULL, the value null is returned. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
Date getDate (int parameterIndex)
以 java.sql.Date对象的形式检索指定的JDBC DATE参数的值。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
| Returns | |
|---|---|
Date |
the parameter value. If the value is SQL NULL, the result is null. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
也可以看看:
Date getDate (String parameterName)
以 java.sql.Date对象的形式检索JDBC DATE参数的值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
Date |
the parameter value. If the value is SQL NULL, the result is null. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
也可以看看:
Date getDate (String parameterName, Calendar cal)
使用给定的Calendar对象构造日期,以java.sql.Date对象的形式检索JDBC DATE参数的值。 使用Calendar对象时,驱动程序可以计算考虑到自定义时区和区域设置的日期。 如果未指定Calendar对象,则该驱动程序使用默认的时区和区域设置。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
cal |
Calendar: the Calendar object the driver will use to construct the date |
| Returns | |
|---|---|
Date |
the parameter value. If the value is SQL NULL, the result is null. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
也可以看看:
Date getDate (int parameterIndex, Calendar cal)
使用给定的Calendar对象构造日期,以java.sql.Date对象的形式检索指定的JDBC DATE参数的值。 使用Calendar对象时,驱动程序可以计算考虑到自定义时区和区域设置的日期。 如果未指定Calendar对象,则该驱动程序使用默认的时区和区域设置。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
cal |
Calendar: the Calendar object the driver will use to construct the date |
| Returns | |
|---|---|
Date |
the parameter value. If the value is SQL NULL, the result is null. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
也可以看看:
double getDouble (int parameterIndex)
获取指定的JDBC的价值 DOUBLE作为参数 double Java编程语言。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
| Returns | |
|---|---|
double |
the parameter value. If the value is SQL NULL, the result is 0. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
也可以看看:
double getDouble (String parameterName)
检索JDBC的价值 DOUBLE作为参数 double Java编程语言。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
double |
the parameter value. If the value is SQL NULL, the result is 0. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
也可以看看:
float getFloat (String parameterName)
检索JDBC的价值 FLOAT作为参数 float Java编程语言。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
float |
the parameter value. If the value is SQL NULL, the result is 0. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
也可以看看:
float getFloat (int parameterIndex)
获取指定的JDBC的价值 FLOAT作为参数 float Java编程语言。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
| Returns | |
|---|---|
float |
the parameter value. If the value is SQL NULL, the result is 0. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
也可以看看:
int getInt (int parameterIndex)
以Java编程语言 int检索指定的JDBC INTEGER参数的值。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
| Returns | |
|---|---|
int |
the parameter value. If the value is SQL NULL, the result is 0. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
也可以看看:
int getInt (String parameterName)
以Java编程语言中的 int检索JDBC INTEGER参数的值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
int |
the parameter value. If the value is SQL NULL, the result is 0. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
也可以看看:
long getLong (String parameterName)
检索JDBC的价值 BIGINT作为参数 long Java编程语言。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
long |
the parameter value. If the value is SQL NULL, the result is 0. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
也可以看看:
long getLong (int parameterIndex)
获取指定的JDBC的价值 BIGINT作为参数 long Java编程语言。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
| Returns | |
|---|---|
long |
the parameter value. If the value is SQL NULL, the result is 0. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
也可以看看:
Reader getNCharacterStream (int parameterIndex)
以Java编程语言中的java.io.Reader对象检索指定参数的值。 访问时,它适用于使用NCHAR , NVARCHAR和LONGNVARCHAR参数。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, ... |
| Returns | |
|---|---|
Reader |
a java.io.Reader object that contains the parameter value; if the value is SQL NULL, the value returned is null in the Java programming language. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; 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 |
Reader getNCharacterStream (String parameterName)
以Java编程语言中的java.io.Reader对象检索指定参数的值。 访问时,它适用于使用NCHAR , NVARCHAR和LONGNVARCHAR参数。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
Reader |
a java.io.Reader object that contains the parameter value; if the value is SQL NULL, the value returned is null in the Java programming language |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
NClob getNClob (String parameterName)
以Java编程语言中的 java.sql.NClob对象的形式检索JDBC NCLOB参数的值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
NClob |
the parameter value as a NClob object in the Java programming language. If the value was SQL NULL, the value null is returned. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
NClob getNClob (int parameterIndex)
以Java编程语言中的 java.sql.NClob对象的形式检索指定的JDBC NCLOB参数的值。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
| Returns | |
|---|---|
NClob |
the parameter value as a NClob object in the Java programming language. If the value was SQL NULL, the value null is returned. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; 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 |
String getNString (String parameterName)
检索指定的值 NCHAR , NVARCHAR或者 LONGNVARCHAR参数为 String的Java编程语言。
对于固定长度类型的JDBC NCHAR ,返回的 String对象与SQL NCHAR值在数据库中的值完全相同,包括数据库添加的所有填充。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
String |
a String object that maps an NCHAR, NVARCHAR or LONGNVARCHAR value |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
也可以看看:
String getNString (int parameterIndex)
检索指定的值 NCHAR , NVARCHAR或者 LONGNVARCHAR参数为 String的Java编程语言。
对于固定长度类型的JDBC NCHAR ,返回的 String对象与SQL NCHAR值在数据库中的值完全相同,包括数据库添加的任何填充。
| Parameters | |
|---|---|
parameterIndex |
int: index of the first parameter is 1, the second is 2, ... |
| Returns | |
|---|---|
String |
a String object that maps an NCHAR, NVARCHAR or LONGNVARCHAR value |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; 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 |
也可以看看:
Object getObject (int parameterIndex)
以Java编程语言中的Object检索指定参数的值。 如果该值为SQL NULL ,则该驱动程序将返回Java null 。
此方法返回一个Java对象,其类型与使用方法registerOutParameter为此参数注册的JDBC类型相对应。 通过将目标JDBC类型注册为java.sql.Types.OTHER ,此方法可用于读取数据库特定的抽象数据类型。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
| Returns | |
|---|---|
Object |
A java.lang.Object holding the OUT parameter value |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
也可以看看:
Object getObject (String parameterName)
以Java编程语言中的Object检索参数的值。 如果该值是SQL NULL ,则该驱动程序将返回Java null 。
此方法返回一个Java对象,其类型与使用方法registerOutParameter为此参数注册的JDBC类型相对应。 通过将目标JDBC类型注册为java.sql.Types.OTHER ,可以使用此方法读取数据库特定的抽象数据类型。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
Object |
A java.lang.Object holding the OUT parameter value. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
也可以看看:
Object getObject (int parameterIndex, Map<String, Class<?>> map)
返回表示OUT参数值 parameterIndex的对象,并使用 map作为参数值的自定义映射。
此方法返回一个Java对象,其类型与使用方法registerOutParameter为此参数注册的JDBC类型相对应。 通过将目标JDBC类型注册为java.sql.Types.OTHER ,可以使用此方法读取数据库特定的抽象数据类型。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
map |
Map: the mapping from SQL type names to Java classes |
| Returns | |
|---|---|
Object |
a java.lang.Object holding the OUT parameter value |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; 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 |
也可以看看:
Object getObject (String parameterName, Map<String, Class<?>> map)
返回表示OUT参数值 parameterName的对象,并使用 map作为参数值的自定义映射。
此方法返回一个Java对象,其类型与使用方法registerOutParameter为此参数注册的JDBC类型相对应。 通过注册目标JDBC类型为java.sql.Types.OTHER ,此方法可用于读取数据库特定的抽象数据类型。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
map |
Map: the mapping from SQL type names to Java classes |
| Returns | |
|---|---|
Object |
a java.lang.Object holding the OUT parameter value |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
也可以看看:
Ref getRef (int parameterIndex)
以Java编程语言中的 Ref对象的形式检索指定的JDBC REF(<structured-type>)参数的值。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
| Returns | |
|---|---|
Ref |
the parameter value as a Ref object in the Java programming language. If the value was SQL NULL, the value null is returned. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; 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 |
Ref getRef (String parameterName)
以Java编程语言中的 Ref对象的形式检索JDBC REF(<structured-type>)参数的值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
Ref |
the parameter value as a Ref object in the Java programming language. If the value was SQL NULL, the value null is returned. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
RowId getRowId (int parameterIndex)
以 java.sql.RowId对象的形式检索指定的JDBC ROWID参数的值。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2,... |
| Returns | |
|---|---|
RowId |
a RowId object that represents the JDBC ROWID value is used as the designated parameter. If the parameter contains a SQL NULL, then a null value is returned. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; 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 |
RowId getRowId (String parameterName)
以 java.sql.RowId对象的形式检索指定的JDBC ROWID参数的值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
RowId |
a RowId object that represents the JDBC ROWID value is used as the designated parameter. If the parameter contains a SQL NULL, then a null value is returned. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
SQLXML getSQLXML (String parameterName)
以Java编程语言中的 java.sql.SQLXML对象的形式检索指定的 SQL XML参数的值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
SQLXML |
a SQLXML object that maps an SQL XML value |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
SQLXML getSQLXML (int parameterIndex)
以Java编程语言中的 java.sql.SQLXML对象的形式检索指定的 SQL XML参数的值。
| Parameters | |
|---|---|
parameterIndex |
int: index of the first parameter is 1, the second is 2, ... |
| Returns | |
|---|---|
SQLXML |
a SQLXML object that maps an SQL XML value |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; 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 |
short getShort (String parameterName)
检索JDBC的价值 SMALLINT作为参数 short Java编程语言。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
short |
the parameter value. If the value is SQL NULL, the result is 0. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
也可以看看:
short getShort (int parameterIndex)
以Java编程语言 short检索指定的JDBC SMALLINT参数的值。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
| Returns | |
|---|---|
short |
the parameter value. If the value is SQL NULL, the result is 0. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
也可以看看:
String getString (int parameterIndex)
获取指定的JDBC的价值 CHAR , VARCHAR ,或 LONGVARCHAR参数为 String的Java编程语言。
对于固定长度类型的JDBC CHAR ,返回的 String对象与SQL CHAR值在数据库中具有完全相同的值,包括数据库添加的任何填充。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
| Returns | |
|---|---|
String |
the parameter value. If the value is SQL NULL, the result is null. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
也可以看看:
String getString (String parameterName)
检索JDBC的价值 CHAR , VARCHAR ,或 LONGVARCHAR参数为 String的Java编程语言。
对于固定长度类型的JDBC CHAR ,返回的 String对象与SQL CHAR值在数据库中具有完全相同的值,包括数据库添加的所有填充。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
String |
the parameter value. If the value is SQL NULL, the result is null. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
也可以看看:
Time getTime (String parameterName)
以 java.sql.Time对象的形式检索JDBC TIME参数的值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
Time |
the parameter value. If the value is SQL NULL, the result is null. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
也可以看看:
Time getTime (String parameterName, Calendar cal)
使用给定的Calendar对象构造时间,以java.sql.Time对象的形式检索JDBC TIME参数的值。 使用Calendar对象时,驱动程序可以计算考虑到自定义时区和区域设置的时间。 如果未指定Calendar对象,则该驱动程序使用默认时区和区域设置。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
cal |
Calendar: the Calendar object the driver will use to construct the time |
| Returns | |
|---|---|
Time |
the parameter value; if the value is SQL NULL, the result is null. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
也可以看看:
Time getTime (int parameterIndex)
以 java.sql.Time对象的形式检索指定的JDBC TIME参数的值。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
| Returns | |
|---|---|
Time |
the parameter value. If the value is SQL NULL, the result is null. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
也可以看看:
Time getTime (int parameterIndex, Calendar cal)
使用给定的Calendar对象构造时间,以java.sql.Time对象的形式检索指定的JDBC TIME参数的值。 使用Calendar对象时,驱动程序可以计算考虑到自定义时区和区域设置的时间。 如果未指定Calendar对象,则该驱动程序使用默认的时区和区域设置。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
cal |
Calendar: the Calendar object the driver will use to construct the time |
| Returns | |
|---|---|
Time |
the parameter value; if the value is SQL NULL, the result is null. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
也可以看看:
Timestamp getTimestamp (int parameterIndex, Calendar cal)
检索指定JDBC的值TIMESTAMP参数作为java.sql.Timestamp对象,使用给定Calendar对象构造Timestamp对象。 通过Calendar对象,驱动程序可以计算考虑到自定义时区和区域设置的时间戳。 如果未指定Calendar对象,则该驱动程序使用默认的时区和区域设置。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
cal |
Calendar: the Calendar object the driver will use to construct the timestamp |
| Returns | |
|---|---|
Timestamp |
the parameter value. If the value is SQL NULL, the result is null. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
也可以看看:
Timestamp getTimestamp (int parameterIndex)
以 java.sql.Timestamp对象的形式检索指定的JDBC TIMESTAMP参数的值。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
| Returns | |
|---|---|
Timestamp |
the parameter value. If the value is SQL NULL, the result is null. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
也可以看看:
Timestamp getTimestamp (String parameterName, Calendar cal)
检索JDBC的值TIMESTAMP参数作为java.sql.Timestamp对象,使用给定Calendar对象构造Timestamp对象。 使用Calendar对象时,驱动程序可以计算考虑到自定义时区和区域设置的时间戳。 如果未指定Calendar对象,则该驱动程序使用默认的时区和区域设置。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
cal |
Calendar: the Calendar object the driver will use to construct the timestamp |
| Returns | |
|---|---|
Timestamp |
the parameter value. If the value is SQL NULL, the result is null. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
也可以看看:
Timestamp getTimestamp (String parameterName)
以 java.sql.Timestamp对象的形式检索JDBC TIMESTAMP参数的值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
Timestamp |
the parameter value. If the value is SQL NULL, the result is null. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 |
也可以看看:
URL getURL (int parameterIndex)
以 java.net.URL对象的形式检索指定的JDBC DATALINK参数的值。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2,... |
| Returns | |
|---|---|
URL |
a java.net.URL object that represents the JDBC DATALINK value used as the designated parameter |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs, this method is called on a closed CallableStatement, or if the URL being returned is not a valid URL on the Java platform |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
URL getURL (String parameterName)
以 java.net.URL对象的形式检索JDBC DATALINK参数的值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
| Returns | |
|---|---|
URL |
the parameter value as a java.net.URL object in the Java programming language. If the value was SQL NULL, the value null is returned. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; if a database access error occurs, this method is called on a closed CallableStatement, or if there is a problem with the URL |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
void registerOutParameter (int parameterIndex,
int sqlType)
将序号为parameterIndex的OUT参数注册到JDBC类型sqlType 。 在执行存储过程之前,所有OUT参数都必须注册。
对于OUT参数,由 sqlType指定的JDBC类型决定了在 get方法中必须用于读取该参数值的Java类型。
如果期望返回到此输出参数的JDBC类型特定于此特定数据库,则sqlType应为java.sql.Types.OTHER 。 方法getObject(int)检索值。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
sqlType |
int: the JDBC type code defined by java.sql.Types. If the parameter is of JDBC type NUMERIC or DECIMAL, the version of registerOutParameter that accepts a scale value should be used. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
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 registerOutParameter (String parameterName, int sqlType, String typeName)
注册指定的输出参数。 该版本的方法registerOutParameter应该用于用户命名或REF输出参数。 用户命名类型的示例包括:STRUCT,DISTINCT,JAVA_OBJECT和命名数组类型。
在执行存储过程之前,所有OUT参数都必须注册。
对于用户命名的参数,还应该给出参数的完全限定的SQL类型名称,而REF参数要求给出所引用类型的完全限定类型名称。 不需要类型代码和类型名称信息的JDBC驱动程序可能会忽略它。 但是,为了便于携带,应用程序应始终为用户命名和REF参数提供这些值。 虽然它用于用户命名和REF参数,但此方法可用于注册任何JDBC类型的参数。 如果该参数没有用户名或REF类型,则忽略typeName参数。
注意:读取out参数的值时,必须使用Java类型XXX对应于参数的注册SQL类型的 getXXX方法。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
sqlType |
int: a value from Types |
typeName |
String: the fully-qualified name of an SQL structured type |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; if a database access error occurs or this method is called on a closed CallableStatement |
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 registerOutParameter (int parameterIndex,
int sqlType,
String typeName)
注册指定的输出参数。 该版本的方法registerOutParameter应该用于用户定义的或REF输出参数。 的用户定义类型的实例包括: STRUCT , DISTINCT , JAVA_OBJECT ,和指定数组类型。
在执行存储过程之前,所有OUT参数都必须注册。
对于用户定义的参数,还应给出参数的完全限定的SQL类型名称,而REF参数要求提供所引用类型的完全限定类型名称。 不需要类型代码和类型名称信息的JDBC驱动程序可能会忽略它。 然而,为了便于携带,应用程序应始终为用户定义的参数和REF参数提供这些值。 虽然它是针对用户定义的参数和REF参数的,但可以使用此方法来注册任何JDBC类型的参数。 如果参数没有用户定义或REF类型,则忽略typeName参数。
注意:读取out参数的值时,必须使用其Java类型与参数的注册SQL类型相对应的getter方法。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2,... |
sqlType |
int: a value from Types |
typeName |
String: the fully-qualified name of an SQL structured type |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
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 registerOutParameter (int parameterIndex,
int sqlType,
int scale)
在顺序位置parameterIndex注册参数为JDBC类型sqlType 。 在执行存储过程之前,所有OUT参数都必须注册。
sqlType为OUT参数指定的JDBC类型决定了在 get方法中必须用于读取该参数值的Java类型。
这个版本 registerOutParameter当参数是JDBC类型应使用 NUMERIC或 DECIMAL 。
| Parameters | |
|---|---|
parameterIndex |
int: the first parameter is 1, the second is 2, and so on |
sqlType |
int: the SQL type code defined by java.sql.Types. |
scale |
int: the desired number of digits to the right of the decimal point. It must be greater than or equal to zero. |
| Throws | |
|---|---|
SQLException |
if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed CallableStatement |
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 registerOutParameter (String parameterName, int sqlType, int scale)
将名为parameterName的参数注册为JDBC类型sqlType 。 在执行存储过程之前,所有OUT参数都必须注册。
sqlType为OUT参数指定的JDBC类型决定了在 get方法中必须用于读取该参数值的Java类型。
这个版本 registerOutParameter当参数是JDBC类型应使用 NUMERIC或 DECIMAL 。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
sqlType |
int: SQL type code defined by java.sql.Types. |
scale |
int: the desired number of digits to the right of the decimal point. It must be greater than or equal to zero. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; if a database access error occurs or this method is called on a closed CallableStatement |
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 registerOutParameter (String parameterName, int sqlType)
将名为parameterName的OUT参数注册到JDBC类型sqlType 。 在执行存储过程之前,所有OUT参数都必须注册。
由 sqlType为OUT参数指定的JDBC类型决定了在 get方法中必须用于读取该参数值的Java类型。
如果期望返回到此输出参数的JDBC类型特定于此特定数据库,则sqlType应为java.sql.Types.OTHER 。 方法getObject(int)检索值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
sqlType |
int: the JDBC type code defined by java.sql.Types. If the parameter is of JDBC type NUMERIC or DECIMAL, the version of registerOutParameter that accepts a scale value should be used. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; if a database access error occurs or this method is called on a closed CallableStatement |
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 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 parameterName does not correspond to a named parameter; 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 (String parameterName, InputStream x, long 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 |
long: the number of bytes in the stream |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 (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 parameterName does not correspond to a named parameter; 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 (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 parameterName does not correspond to a named parameter; 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 parameterName does not correspond to a named parameter; 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, long 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 |
long: the number of bytes in the stream |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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, 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 parameterName does not correspond to a named parameter; 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, 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 parameterName does not correspond to a named parameter; 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 parameterName does not correspond to a named parameter; 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 (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 parameterName does not correspond to a named parameter; 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 parameterName does not correspond to a named parameter; 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 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 parameterName does not correspond to a named parameter; 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 parameterName does not correspond to a named parameter; 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, 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 parameterName does not correspond to a named parameter; 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, long 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 |
long: the number of characters in the stream |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 parameterName does not correspond to a named parameter; 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, 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 parameterName does not correspond to a named parameter; 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 parameterName does not correspond to a named parameter; 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 parameterName does not correspond to a named parameter; 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, Calendar cal)
使用给定的Calendar对象将指定参数设置为给定的java.sql.Date值。 该驱动程序使用Calendar对象构造一个SQL DATE值,驱动程序随后DATE值发送到数据库。 通过一个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 parameterName does not correspond to a named parameter; 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 parameterName does not correspond to a named parameter; 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 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 parameterName does not correspond to a named parameter; 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 (String parameterName, float x)
将指定的参数设置为给定的Java float值。 驱动程序在将其发送到数据库时将其转换为SQL FLOAT值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
x |
float: the parameter value |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 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 parameterName does not correspond to a named parameter; 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 (String parameterName, long x)
将指定参数设置为给定的Java long值。 驱动程序在将它发送到数据库时将其转换为SQL BIGINT值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
x |
long: the parameter value |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 setNCharacterStream (String parameterName, Reader value, long length)
将指定的参数设置为Reader对象。 Reader读取数据直到达到文件结尾。 驱动程序将从Java字符格式转换为数据库中的国家字符集。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter to be set |
value |
Reader: the parameter value |
length |
long: the number of characters in the parameter data. |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 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 parameterName does not correspond to a named parameter; 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 parameterName does not correspond to a named parameter; 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 parameter to be set |
value |
NClob: the parameter value |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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)
将指定的参数设置为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 parameterName does not correspond to a named parameter; 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 setNString (String parameterName, String value)
将指定参数设置为给定的String对象。 驱动程序将其转换为SQL NCHAR或NVARCHAR或LONGNVARCHAR
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter to be set |
value |
String: the parameter value |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 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 parameterName does not correspond to a named parameter; 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参数,名称是引用类型的类型名称。
虽然它用于用户定义和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 parameterName does not correspond to a named parameter; 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 parameterName does not correspond to a named parameter; 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 (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 parameterName does not correspond to a named parameter; 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 (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类型的值。
如果存在歧义,则此方法会引发异常,例如,对象是实现多个上述接口的类的类。
注意:并非所有数据库都允许将非类型的Null发送到后端。 为了获得最大可移植性,应该使用setNull或setObject(String parameterName, Object x, int sqlType)方法而不是setObject(String parameterName, Object x) 。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
x |
Object: the object containing the input parameter value |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 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 parameterName does not correspond to a named parameter; 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 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 parameterName does not correspond to a named parameter; if a database access error occurs; this method is called on a closed CallableStatement 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 (String parameterName, short x)
将指定的参数设置为给定的Java short值。 驱动程序在将它发送到数据库时将其转换为SQL SMALLINT值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
x |
short: the parameter value |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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值。 当驱动程序将其发送到数据库时,该驱动程序将其转换为SQL VARCHAR或LONGVARCHAR值(取决于驱动程序对VARCHAR值的限制,参数的大小)。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
x |
String: the parameter value |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; 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 (String parameterName, Time x, Calendar cal)
使用给定的Calendar对象将指定参数设置为给定的java.sql.Time值。 该驱动程序使用Calendar对象构造一个SQL TIME值,然后驱动程序TIME值发送到数据库。 通过一个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 parameterName does not correspond to a named parameter; 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 (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 parameterName does not correspond to a named parameter; 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, 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 parameterName does not correspond to a named parameter; 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 parameterName does not correspond to a named parameter; 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 setURL (String parameterName, URL val)
将指定参数设置为给定的java.net.URL对象。 驱动程序在将它发送到数据库时将其转换为SQL DATALINK值。
| Parameters | |
|---|---|
parameterName |
String: the name of the parameter |
val |
URL: the parameter value |
| Throws | |
|---|---|
SQLException |
if parameterName does not correspond to a named parameter; if a database access error occurs; this method is called on a closed CallableStatement or if a URL is malformed |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
boolean wasNull ()
检索读取的最后一个OUT参数是否具有SQL NULL的值。 请注意,只有在调用getter方法后才应调用此方法; 否则,在确定它是否为null没有null 。
| Returns | |
|---|---|
boolean |
true if the last parameter read was SQL NULL; false otherwise |
| Throws | |
|---|---|
SQLException |
if a database access error occurs or this method is called on a closed CallableStatement |