Skip to content

Commit 0c4af68

Browse files
committed
Cleaning up duplicated code sample pages
1 parent fd8bdd3 commit 0c4af68

35 files changed

Lines changed: 282 additions & 1548 deletions

.openpublishing.redirection.json

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15672,7 +15672,92 @@
1567215672
},
1567315673
{
1567415674
"source_path": "docs/connect/jdbc/code-samples/index.md",
15675-
"redirect_url": "/sql/connect/jdbc/code-samples/sample-jdbc-driver-applications",
15675+
"redirect_url": "/sql/connect/jdbc/sample-jdbc-driver-applications",
15676+
"redirect_document_id": false
15677+
},
15678+
{
15679+
"source_path": "docs/connect/jdbc/code-samples/basic-data-types-sample.md",
15680+
"redirect_url": "/sql/connect/jdbc/basic-data-types-sample",
15681+
"redirect_document_id": false
15682+
},
15683+
{
15684+
"source_path": "docs/connect/jdbc/code-samples/caching-result-set-data-sample.md",
15685+
"redirect_url": "/sql/connect/jdbc/caching-result-set-data-sample",
15686+
"redirect_document_id": false
15687+
},
15688+
{
15689+
"source_path": "docs/connect/jdbc/code-samples/connecting-and-retrieving-data.md",
15690+
"redirect_url": "/sql/connect/jdbc/connecting-and-retrieving-data",
15691+
"redirect_document_id": false
15692+
},
15693+
{
15694+
"source_path": "docs/connect/jdbc/code-samples/connection-url-sample.md",
15695+
"redirect_url": "/sql/connect/jdbc/connection-url-sample",
15696+
"redirect_document_id": false
15697+
},
15698+
{
15699+
"source_path": "docs/connect/jdbc/code-samples/data-discovery-and-classification-sample.md",
15700+
"redirect_url": "/sql/connect/jdbc/data-discovery-classification-sample",
15701+
"redirect_document_id": false
15702+
},
15703+
{
15704+
"source_path": "docs/connect/jdbc/code-samples/data-source-sample.md",
15705+
"redirect_url": "/sql/connect/jdbc/data-source-sample",
15706+
"redirect_document_id": false
15707+
},
15708+
{
15709+
"source_path": "docs/connect/jdbc/code-samples/modifying-result-set-data-sample.md",
15710+
"redirect_url": "/sql/connect/jdbc/modifying-result-set-data-sample",
15711+
"redirect_document_id": false
15712+
},
15713+
{
15714+
"source_path": "docs/connect/jdbc/code-samples/reading-large-data-sample.md",
15715+
"redirect_url": "/sql/connect/jdbc/reading-large-data-sample",
15716+
"redirect_document_id": false
15717+
},
15718+
{
15719+
"source_path": "docs/connect/jdbc/code-samples/reading-large-data-with-stored-procedures-sample.md",
15720+
"redirect_url": "/sql/connect/jdbc/reading-large-data-with-stored-procedures-sample",
15721+
"redirect_document_id": false
15722+
},
15723+
{
15724+
"source_path": "docs/connect/jdbc/code-samples/retrieving-result-set-data-sample.md",
15725+
"redirect_url": "/sql/connect/jdbc/retrieving-result-set-data-sample",
15726+
"redirect_document_id": false
15727+
},
15728+
{
15729+
"source_path": "docs/connect/jdbc/code-samples/sample-jdbc-driver-applications.md",
15730+
"redirect_url": "/sql/connect/jdbc/sample-jdbc-driver-applications",
15731+
"redirect_document_id": false
15732+
},
15733+
{
15734+
"source_path": "docs/connect/jdbc/code-samples/spatial-data-types-sample.md",
15735+
"redirect_url": "/sql/connect/jdbc/spatial-data-types-sample",
15736+
"redirect_document_id": false
15737+
},
15738+
{
15739+
"source_path": "docs/connect/jdbc/code-samples/sqlxml-data-type-sample.md",
15740+
"redirect_url": "/sql/connect/jdbc/sqlxml-data-type-sample",
15741+
"redirect_document_id": false
15742+
},
15743+
{
15744+
"source_path": "docs/connect/jdbc/code-samples/updating-large-data-sample.md",
15745+
"redirect_url": "/sql/connect/jdbc/updating-large-data-sample",
15746+
"redirect_document_id": false
15747+
},
15748+
{
15749+
"source_path": "docs/connect/jdbc/code-samples/working-with-data-types-jdbc.md",
15750+
"redirect_url": "/sql/connect/jdbc/working-with-data-types-jdbc",
15751+
"redirect_document_id": false
15752+
},
15753+
{
15754+
"source_path": "docs/connect/jdbc/code-samples/working-with-large-data.md",
15755+
"redirect_url": "/sql/connect/jdbc/working-with-large-data",
15756+
"redirect_document_id": false
15757+
},
15758+
{
15759+
"source_path": "docs/connect/jdbc/code-samples/working-with-result-sets.md",
15760+
"redirect_url": "/sql/connect/jdbc/working-with-result-sets",
1567615761
"redirect_document_id": false
1567715762
},
1567815763
{

docs/connect/jdbc/basic-data-types-sample.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
title: "Basic data types sample | Microsoft Docs"
2+
title: "Basic data types sample"
3+
description: "This Microsoft JDBC Driver for SQL Server sample application demonstrates how to use result set methods to retrieve and update values in the database."
34
ms.custom: ""
45
ms.date: "08/12/2019"
56
ms.prod: sql
@@ -18,26 +19,26 @@ ms.author: v-daenge
1819

1920
This [!INCLUDE[jdbcNoVersion](../../includes/jdbcnoversion_md.md)] sample application demonstrates how to use result set getter methods to retrieve basic [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] data type values, and how to use result set update methods to update those values.
2021

21-
The code file for this sample is named BasicDT.java, and it can be found in the following location:
22+
The code file for this sample is named BasicDataTypes.java, and it can be found in the following location:
2223

2324
```bash
2425
\<installation directory>\sqljdbc_<version>\<language>\samples\datatypes
2526
```
2627

2728
## Requirements
2829

29-
To run this sample application, you must set the classpath to include the mssql-jdbc jar file. You'll also need access to the [!INCLUDE[ssSampleDBnormal](../../includes/sssampledbnormal_md.md)] sample database. For more information about how to set the classpath, see [Using the JDBC Driver](../../connect/jdbc/using-the-jdbc-driver.md).
30+
To run this sample application, you must set the classpath to include the mssql-jdbc jar file. You'll also need access to the [!INCLUDE[ssSampleDBnormal](../../includes/sssampledbnormal_md.md)] sample database. For more information about how to set the classpath, see [Using the JDBC Driver](using-the-jdbc-driver.md).
3031

3132
The sample will create the required table and insert sample data in the [!INCLUDE[ssSampleDBnormal](../../includes/sssampledbnormal_md.md)] sample database:
3233

3334
> [!NOTE]
34-
> The [!INCLUDE[jdbcNoVersion](../../includes/jdbcnoversion_md.md)] provides mssql-jdbc class library files to be used depending on your preferred Java Runtime Environment (JRE) settings. For more information about which JAR file to choose, see [System Requirements for the JDBC Driver](../../connect/jdbc/system-requirements-for-the-jdbc-driver.md).
35+
> The [!INCLUDE[jdbcNoVersion](../../includes/jdbcnoversion_md.md)] provides mssql-jdbc class library files to be used depending on your preferred Java Runtime Environment (JRE) settings. For more information about which JAR file to choose, see [System Requirements for the JDBC Driver](system-requirements-for-the-jdbc-driver.md).
3536
3637
## Example
3738

38-
In the following example, the sample code makes a connection to the [!INCLUDE[ssSampleDBnormal](../../includes/sssampledbnormal_md.md)] database, and then retrieves a single row of data from the DataTypesTable test table. The custom displayRow method is then called to display all the data in the result set using various get\<Type> methods of the [SQLServerResultSet](../../connect/jdbc/reference/sqlserverresultset-class.md) class.
39+
In the following example, the sample code makes a connection to the [!INCLUDE[ssSampleDBnormal](../../includes/sssampledbnormal_md.md)] database, and then retrieves a single row of data from the DataTypesTable test table. The custom displayRow method is then called to display all the data in the result set using various get\<Type> methods of the [SQLServerResultSet](reference/sqlserverresultset-class.md) class.
3940

40-
Next, the sample uses various update\<Type> methods of the SQLServerResultSet class to update the data in the result set, and then calls the [updateRow](../../connect/jdbc/reference/updaterow-method-sqlserverresultset.md) method to persist that data back to the database.
41+
Next, the sample uses various update\<Type> methods of the SQLServerResultSet class to update the data in the result set, and then calls the [updateRow](reference/updaterow-method-sqlserverresultset.md) method to persist that data back to the database.
4142

4243
Finally, the sample refreshes the data in the result set and then calls the custom displayRow method again to display the data in the result set.
4344

@@ -149,9 +150,8 @@ public class BasicDataTypes {
149150
}
150151
}
151152
}
152-
153153
```
154154

155155
## See also
156156

157-
[Working with data types &#40;JDBC&#41;](../../connect/jdbc/working-with-data-types-jdbc.md)
157+
[Working with data types &#40;JDBC&#41;](working-with-data-types-jdbc.md)

docs/connect/jdbc/caching-result-set-data-sample.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
title: "Caching result set data sample | Microsoft Docs"
2+
title: "Caching result set data sample"
3+
description: "This Microsoft JDBC Driver for SQL Server sample application demonstrates how to retrieve a large set of data from a database and control the number of rows cached."
34
ms.custom: ""
45
ms.date: "08/12/2019"
56
ms.prod: sql
@@ -16,15 +17,15 @@ ms.author: v-daenge
1617

1718
[!INCLUDE[Driver_JDBC_Download](../../includes/driver_jdbc_download.md)]
1819

19-
This [!INCLUDE[jdbcNoVersion](../../includes/jdbcnoversion_md.md)] sample application demonstrates how to retrieve a large set of data from a database, and then control the number of rows of data that are cached on the client by using the [setFetchSize](../../connect/jdbc/reference/setfetchsize-method-sqlserverresultset.md) method of the [SQLServerResultSet](../../connect/jdbc/reference/sqlserverresultset-class.md) object.
20+
This [!INCLUDE[jdbcNoVersion](../../includes/jdbcnoversion_md.md)] sample application demonstrates how to retrieve a large set of data from a database, and then control the number of rows of data that are cached on the client by using the [setFetchSize](reference/setfetchsize-method-sqlserverresultset.md) method of the [SQLServerResultSet](reference/sqlserverresultset-class.md) object.
2021

21-
> [!NOTE]
22-
> Limiting the number of rows cached on the client is different from limiting the total number of rows that a result set can contain. To control the total number of rows that are contained in a result set, use the [setMaxRows](../../connect/jdbc/reference/setmaxrows-method-sqlserverstatement.md) method of the [SQLServerStatement](../../connect/jdbc/reference/sqlserverstatement-class.md) object, which is inherited by both the [SQLServerPreparedStatement](../../connect/jdbc/reference/sqlserverpreparedstatement-class.md) and [SQLServerCallableStatement](../../connect/jdbc/reference/sqlservercallablestatement-class.md) objects.
22+
> [!NOTE]
23+
> Limiting the number of rows cached on the client is different from limiting the total number of rows that a result set can contain. To control the total number of rows that are contained in a result set, use the [setMaxRows](reference/setmaxrows-method-sqlserverstatement.md) method of the [SQLServerStatement](reference/sqlserverstatement-class.md) object, which is inherited by both the [SQLServerPreparedStatement](reference/sqlserverpreparedstatement-class.md) and [SQLServerCallableStatement](reference/sqlservercallablestatement-class.md) objects.
2324
2425
To set a limit on the number of rows cached on the client, you must first use a server-side cursor when you create one of the Statement objects by specifically stating the cursor type to use when creating the Statement object. For example, the JDBC driver provides the TYPE_SS_SERVER_CURSOR_FORWARD_ONLY cursor type, which is a fast forward-only, read-only server-side cursor for use with [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] databases.
2526

26-
> [!NOTE]
27-
> An alternative to using the SQL Server specific cursor type is to use the selectMethod connection string property, setting its value to "cursor". For more information about the cursor types supported by the JDBC driver, see [Understanding cursor types](../../connect/jdbc/understanding-cursor-types.md).
27+
> [!NOTE]
28+
> An alternative to using the SQL Server specific cursor type is to use the selectMethod connection string property, setting its value to "cursor". For more information about the cursor types supported by the JDBC driver, see [Understanding cursor types](understanding-cursor-types.md).
2829
2930
After you have run the query contained in the Statement object and the data is returned to the client as a result set, you can call the setFetchSize method to control how much data is retrieved from the database at one time. For example, if you have a table that contains 100 rows of data, and you set the fetch size to 10, only 10 rows of data will be cached on the client at any point in time. Although this will slow down the speed at which the data is processed, it has the advantage of using less memory on the client, which can be especially useful when you need to process large amounts of data.
3031

@@ -36,14 +37,14 @@ The code file for this sample is named CacheResultSet.java, and it can be found
3637

3738
## Requirements
3839

39-
To run this sample application, you must set the classpath to include the mssql-jdbc jar file. You will also need access to the [!INCLUDE[ssSampleDBnormal](../../includes/sssampledbnormal_md.md)] sample database. For more information about how to set the classpath, see [Using the JDBC Driver](../../connect/jdbc/using-the-jdbc-driver.md).
40+
To run this sample application, you must set the classpath to include the mssql-jdbc jar file. You will also need access to the [!INCLUDE[ssSampleDBnormal](../../includes/sssampledbnormal_md.md)] sample database. For more information about how to set the classpath, see [Using the JDBC Driver](using-the-jdbc-driver.md).
4041

4142
> [!NOTE]
42-
> The [!INCLUDE[jdbcNoVersion](../../includes/jdbcnoversion_md.md)] rovides mssql-jdbc class library files to be used depending on your preferred Java Runtime Environment (JRE) settings. For more information about which JAR file to choose, see [System Requirements for the JDBC Driver](../../connect/jdbc/system-requirements-for-the-jdbc-driver.md).
43+
> The [!INCLUDE[jdbcNoVersion](../../includes/jdbcnoversion_md.md)] provides mssql-jdbc class library files to be used depending on your preferred Java Runtime Environment (JRE) settings. For more information about which JAR file to choose, see [System Requirements for the JDBC Driver](system-requirements-for-the-jdbc-driver.md).
4344
4445
## Example
4546

46-
In the following example, the sample code makes a connection to the [!INCLUDE[ssSampleDBnormal](../../includes/sssampledbnormal_md.md)] sample database. Then it uses an SQL statement with the [SQLServerStatement](../../connect/jdbc/reference/sqlserverstatement-class.md) object, specifies the server-side cursor type, and then runs the SQL statement and places the data that it returns into a SQLServerResultSet object.
47+
In the following example, the sample code makes a connection to the [!INCLUDE[ssSampleDBnormal](../../includes/sssampledbnormal_md.md)] sample database. Then it uses an SQL statement with the [SQLServerStatement](reference/sqlserverstatement-class.md) object, specifies the server-side cursor type, and then runs the SQL statement and places the data that it returns into a SQLServerResultSet object.
4748

4849
Next, the sample code calls the custom timerTest method, passing as arguments the fetch size to use and the result set. The timerTest method then sets the fetch size of the result set by using the setFetchSize method, sets the start time of the test, and then iterates through the result set with a `While` loop. As soon as the `While` loop is exited, the code sets the stop time of the test, and then displays the result of the test including the fetch size, the number of rows processed, and the time it took to execute the test.
4950

@@ -117,9 +118,8 @@ public class CacheResultSet {
117118
System.out.println();
118119
}
119120
}
120-
121121
```
122122

123123
## See also
124124

125-
[Working with result sets](../../connect/jdbc/working-with-result-sets.md)
125+
[Working with result sets](working-with-result-sets.md)

0 commit comments

Comments
 (0)