Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
The Microsoft JDBC Driver for SQL Server supports interfaces that allow you create a proxy of a class, and wrappers that let you access extensions to the JDBC API that are specific to the Microsoft JDBC Driver for SQL Server through a proxy interface.
The Microsoft JDBC Driver for SQL Server supports the java.sql.Wrapper interface. This interface provides a mechanism to access extensions to the JDBC API that are specific to the Microsoft JDBC Driver for SQL Server through a proxy interface.
The java.sql.Wrapper interface defines two methods: isWrapperFor and unwrap. The isWrapperFor method checks whether the specified input object implements this interface. The unwrap method returns an object that implements this interface to allow access to the Microsoft JDBC Driver for SQL Server specific methods.
isWrapperFor and unwrap methods are exposed as follows:
Beginning in SQL Server JDBC Driver 3.0, interfaces are available for an application server to access a driver-specific method from the associated class. The application server can wrap the class by creating a proxy, exposing the Microsoft JDBC Driver for SQL Server-specific functionality from an interface. The Microsoft JDBC Driver for SQL Server supports interfaces that have the Microsoft JDBC Driver for SQL Server specific methods and constants so an application server can create a proxy of the class.
The interfaces derive from standard Java interfaces so you can use the same object once it is unwrapped to access driver-specific functionality or generic Microsoft JDBC Driver for SQL Server functionality.
The following interfaces are added:
This sample demonstrates how to access to a Microsoft JDBC Driver for SQL Server-specific function from a DataSource object. This DataSource class may have been wrapped by an application server. To access the JDBC driver-specific function or constant, you can unwrap the datasource to an ISQLServerDataSource interface and use the functions declared in this interface.
import javax.sql.*;
import java.sql.*;
import com.microsoft.sqlserver.jdbc.*;
public class UnWrapTest {
public static void main(String[] args) {
// This is a test. This DataSource object could be something from an appserver
// which has wrapped the real SQLServerDataSource with its own wrapper
SQLServerDataSource ds = new SQLServerDataSource();
checkSendStringParametersAsUnicode(ds);
}
// Unwrap to the ISQLServerDataSource interface to access the getSendStringParametersAsUnicode function
static void checkSendStringParametersAsUnicode(DataSource ds) {
try {
final ISQLServerDataSource sqlServerDataSource = ds.unwrap(ISQLServerDataSource.class);
boolean sendStringParametersAsUnicode = sqlServerDataSource.getSendStringParametersAsUnicode();
System.out.println("Send string as parameter value is:-" + sendStringParametersAsUnicode);
} catch (SQLException sqlE) {
System.out.println("Exception:-" + sqlE);
}
}
}
Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register todayTraining
Module
Implement interfaces in Dynamics 365 Business Central - Training
Do you want to know how to implement interfaces in AL? If so, this module will explain how to implement interfaces in AL for use with Microsoft Dynamics 365 Business Central.