Události
SQL ve společnosti FabCon Vegas
31. 3. 23 - 2. 4. 23
Největší událost učení SQL, Fabric a Power BI. 31. března – 2. dubna. Pomocí kódu FABINSIDER uložte $400.
Zaregistrovat se ještě dnesTento prohlížeč se už nepodporuje.
Upgradujte na Microsoft Edge, abyste mohli využívat nejnovější funkce, aktualizace zabezpečení a technickou podporu.
The result set is an object that represents a set of data returned from a data source, usually as the result of a query. The result set contains rows and columns to hold the requested data elements, and it is navigated with a cursor. A result set can be updatable, meaning that it can be modified and have those modifications pushed to the original data source. A result set can also have various levels of sensitivity to changes in the underlying data source.
The type of result set is determined when a statement is created, which is when a call to the createStatement method of the SQLServerConnection class is made. The fundamental role of a result set is to provide Java applications with a usable representation of the database data. This task is typically done with the typed getter and setter methods on the result set data elements.
In the following example, which is based on the AdventureWorks2022 sample database, a result set is created by calling the executeQuery method of the SQLServerStatement class. Data from the result set is then displayed by using the getString method of the SQLServerResultSet class.
public static void executeStatement(Connection con){
try(Statement stmt = con.createStatement();) {
String SQL = "SELECT TOP 10 * FROM Person.Contact";
ResultSet rs = stmt.executeQuery(SQL);
while (rs.next()) {
System.out.println(rs.getString("FirstName") + " " + rs.getString("LastName"));
}
}
// Handle any errors that may have occurred.
catch (SQLException e) {
e.printStackTrace();
}
}
The articles in this section describe various aspects of result set usage, including cursor types, concurrency, and row locking.
Article | Description |
---|---|
Understanding cursor types | Describes the different cursor types that the Microsoft JDBC Driver for SQL Server supports. |
Understanding concurrency control | Describes how the JDBC driver supports concurrency control. |
Understanding row locking | Describes how the JDBC driver supports row locking. |
Události
SQL ve společnosti FabCon Vegas
31. 3. 23 - 2. 4. 23
Největší událost učení SQL, Fabric a Power BI. 31. března – 2. dubna. Pomocí kódu FABINSIDER uložte $400.
Zaregistrovat se ještě dnesŠkolení
Dokumentace
Using a SQL statement with parameters - JDBC Driver for SQL Server
To work with a SQL statement that contains IN parameters, use the executeQuery method of the SQLServerPreparedStatement class to return a SQLServerResultSet.
Understanding cursor types - JDBC Driver for SQL Server
Learn about the different cursor types you can use for your application queries and when to use them.
Using a SQL statement with no parameters - JDBC Driver for SQL Server
Learn how to execute SQL statement with no parameters using the Microsoft JDBC Driver for SQL Server.