Not
Bu sayfaya erişim yetkilendirme gerektiriyor. Oturum açmayı veya dizinleri değiştirmeyi deneyebilirsiniz.
Bu sayfaya erişim yetkilendirme gerektiriyor. Dizinleri değiştirmeyi deneyebilirsiniz.
JDBC sürücüsünü indirin
SQL Server'a özgü yöntemler için Microsoft JDBC Sürücüsüne erişim izni vermek üzere belirtilen arabirimi uygulayan bir nesne döndürür.
Sözdizimi
public <T> T unwrap(Class<T> iface)
Parametreler
arayüz
Arabirim tanımlayan T türünde bir sınıf.
Dönüş Değeri
Belirtilen arabirimi uygulayan bir nesne.
Özel durumlar
SQLServerException
Açıklamalar
unwrap yöntemi, JDBC 4.0 Belirtiminde tanıtılan java.sql.Wrapper arabirimi tarafından tanımlanır.
Uygulamaların JDBC API'sinin SQL Server için Microsoft JDBC Sürücüsüne özgü uzantılara erişmesi gerekebilir. unwrap yöntemi, sınıflar satıcı uzantılarını kullanıma sunarsa, bu nesnenin genişletir ortak sınıflar için unwrapping destekler.
SQLServerCallableStatement, ISQLServerStatement'tan genişletilmiş ISQLServerPreparedStatement'ı uygular. Bu yöntem çağrıldığında nesne şu sınıflara doğru çıkar: SQLServerStatement, SQLServerPreparedStatement ve SQLServerCallableStatement.
Daha fazla bilgi için bkz. Sarmalayıcılar ve Arabirimler.
Aşağıdaki kod örneği, sürücü uzantılarını denetlemek ve setResponseBuffering ve getResponseBuffering gibi satıcıya özgü yöntemleri çağırmak için isWrapperFor ve unwrap yöntemlerinin nasıl kullanılacağını gösterir.
public static void executeStoredProcedure(Connection con) {
try {
CallableStatement cstmt =
con.prepareCall("{call dbo.stored_proc_name(?, ?)}");
// The recommended way to access the JDBC
// Driver-specific methods is to use the JDBC 4.0 Wrapper
// functionality.
// The following code statements demonstrates how to use the
// isWrapperFor and unwrap methods
// to access the driver-specific response buffering methods.
if (cstmt.isWrapperFor(
com.microsoft.sqlserver.jdbc.SQLServerCallableStatement.class)) {
// The CallableStatement object can unwrap to
// SQLServerCallableStatement.
SQLServerCallableStatement SQLcstmt =
cstmt.unwrap(
com.microsoft.sqlserver.jdbc.SQLServerCallableStatement.class);
SQLcstmt.setResponseBuffering("adaptive");
System.out.println("Response buffering mode has been set to " +
SQLcstmt.getResponseBuffering());
}
if (cstmt.isWrapperFor(
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.class)) {
// The CallableStatement object can unwrap to
// SQLServerPreparedStatement.
SQLServerPreparedStatement SQLpstmt =
cstmt.unwrap(
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.class);
SQLpstmt.setResponseBuffering("adaptive");
System.out.println("Response buffering mode has been set to " +
SQLpstmt.getResponseBuffering());
}
if (cstmt.isWrapperFor(
com.microsoft.sqlserver.jdbc.SQLServerStatement.class)) {
// The CallableStatement object can unwrap to SQLServerStatement.
SQLServerStatement SQLstmt =
cstmt.unwrap(
com.microsoft.sqlserver.jdbc.SQLServerStatement.class);
SQLstmt.setResponseBuffering("adaptive");
System.out.println("Response buffering mode has been set to " +
SQLstmt.getResponseBuffering());
}
}
catch (Exception e) {
e.printStackTrace();
}
}
Ayrıca Bkz.
isWrapperFor Yöntemi (SQLServerCallableStatement)
SQLServerCallableStatement Üyeleri
SQLServerCallableStatement Sınıfı