Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit ef7f254

Browse files
authored
Merge pull request #6712 from MicrosoftDocs/master
8/1 PM Publish
2 parents 2e038db + aac1893 commit ef7f254

8 files changed

Lines changed: 196 additions & 15 deletions

docs/connect/php/connection-pooling-microsoft-drivers-for-php-for-sql-server.md

Lines changed: 72 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Connection Pooling (Microsoft Drivers for PHP for SQL Server) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "07/10/2017"
4+
ms.date: "08/01/2018"
55
ms.prod: sql
66
ms.prod_service: connectivity
77
ms.reviewer: ""
@@ -24,7 +24,7 @@ The following are important points to note about connection pooling in the [!INC
2424

2525
- The [!INCLUDE[ssDriverPHP](../../includes/ssdriverphp_md.md)] uses ODBC connection pooling.
2626

27-
- By default, connection pooling is enabled in Windows. In Linux and Mac OS X, connections are pooled only if connection pooling is enabled for ODBC. When connection pooling is enabled and you connect to a server, the driver attempts to use a pooled connection before it creates a new one. If an equivalent connection is not found in the pool, a new connection is created and added to the pool. The driver determines whether connections are equivalent based on a comparison of connection strings.
27+
- By default, connection pooling is enabled in Windows. In Linux and macOS, connections are pooled only if connection pooling is enabled for ODBC (see [Enabling/Disabling connection pooling](#enablingdisabling-connection-pooling)). When connection pooling is enabled and you connect to a server, the driver attempts to use a pooled connection before it creates a new one. If an equivalent connection is not found in the pool, a new connection is created and added to the pool. The driver determines whether connections are equivalent based on a comparison of connection strings.
2828

2929
- When a connection from the pool is used, the connection state is reset.
3030

@@ -39,25 +39,89 @@ You can force the driver to create a new connection (instead of looking for an e
3939
If the *ConnectionPooling* attribute is omitted from the connection string or if it is set to **true** (or 1), the driver only creates a new connection if an equivalent connection does not exist in the connection pool.
4040

4141
For information about other connection attributes, see [Connection Options](../../connect/php/connection-options.md).
42-
### Linux and Mac OS X
43-
*ConnectionPooling* attribute cannot be used to enable/disable connection pooling.
42+
### Linux and macOS
43+
The *ConnectionPooling* attribute cannot be used to enable/disable connection pooling.
4444

45-
Connection pooling can be enabled/disabled by editing odbcinst.ini configuration file. The driver should be reloaded for the changes to take effect.
45+
Connection pooling can be enabled/disabled by editing the odbcinst.ini configuration file. The driver should be reloaded for the changes to take effect.
4646

47-
Setting `Pooling` to `Yes` and a positive `CPTimeout`value in odbcinst.ini enables connection pooling.
47+
Setting `Pooling` to `Yes` and a positive `CPTimeout` value in the odbcinst.ini file enables connection pooling.
4848
```
4949
[ODBC]
5050
Pooling=Yes
5151
5252
[ODBC Driver 13 for SQL Server]
5353
CPTimeout=<int value>
5454
```
55-
Setting `Pooling` to `No` in odbcinst.ini forces the driver to create a new connection.
55+
56+
Minimally, the odbcinst.ini file should look something like this example:
57+
58+
```
59+
[ODBC]
60+
Pooling=Yes
61+
62+
[ODBC Driver 13 for SQL Server]
63+
Description=Microsoft ODBC Driver 13 for SQL Server
64+
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.3.0
65+
UsageCount=1
66+
CPTimeout=120
67+
```
68+
69+
Setting `Pooling` to `No` in the odbcinst.ini file forces the driver to create a new connection.
5670
```
5771
[ODBC]
5872
Pooling=No
5973
```
60-
74+
75+
## Remarks
76+
- In Linux or macOS, all connections will be pooled if pooling is enabled in the odbcinst.ini file. This means the ConnectionPooling connection option has no effect. To disable pooling, set Pooling=No in the odbcinst.ini file and reload the drivers.
77+
- unixODBC <= 2.3.4 (Linux and macOS) might not return proper diagnostic information, such as error messages, warnings and informative messages
78+
- for this reason, SQLSRV and PDO_SQLSRV drivers might not be able to properly fetch long data (such as xml, binary) as strings. Long data can be fetched as streams as a workaround. See the example below for SQLSRV.
79+
80+
```
81+
<?php
82+
$connectionInfo = array("Database"=>"test", "UID"=>"username", "PWD"=>"password");
83+
84+
$conn1 = sqlsrv_connect("servername", $connectionInfo);
85+
86+
$longSample = str_repeat("a", 8500);
87+
$xml1 =
88+
'<ParentXMLTag>
89+
<ChildTag01>'.$longSample.'</ChildTag01>
90+
</ParentXMLTag>';
91+
92+
// Create table and insert xml string into it
93+
sqlsrv_query($conn1, "CREATE TABLE xml_table (field xml)");
94+
sqlsrv_query($conn1, "INSERT into xml_table values ('$xml1')");
95+
96+
// retrieve the inserted xml
97+
$column1 = getColumn($conn1);
98+
99+
// return the connection to the pool
100+
sqlsrv_close($conn1);
101+
102+
// This connection is from the pool
103+
$conn2 = sqlsrv_connect("servername", $connectionInfo);
104+
$column2 = getColumn($conn2);
105+
106+
sqlsrv_query($conn2, "DROP TABLE xml_table");
107+
sqlsrv_close($conn2);
108+
109+
function getColumn($conn)
110+
{
111+
$tsql = "SELECT * from xml_table";
112+
$stmt = sqlsrv_query($conn, $tsql);
113+
sqlsrv_fetch($stmt);
114+
// This might fail in Linux and macOS
115+
// $column = sqlsrv_get_field($stmt, 0, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR));
116+
// The workaround is to fetch it as a stream
117+
$column = sqlsrv_get_field($stmt, 0, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_CHAR));
118+
sqlsrv_free_stmt($stmt);
119+
return ($column);
120+
}
121+
?>
122+
```
123+
124+
61125
## See Also
62126
[How to: Connect Using Windows Authentication](../../connect/php/how-to-connect-using-windows-authentication.md)
63127

docs/connect/php/pdo-query.md

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "PDO::query | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "01/19/2017"
4+
ms.date: "08/01/2018"
55
ms.prod: sql
66
ms.prod_service: connectivity
77
ms.reviewer: ""
@@ -113,8 +113,56 @@ while ( $stmt->fetch() ){
113113
114114
$stmt = null;
115115
?>
116-
```
117-
116+
```
117+
118+
## Example
119+
This code sample shows how to create a table of [sql_variant](https://docs.microsoft.com/sql/t-sql/data-types/sql-variant-transact-sql) types and fetch the inserted data.
120+
121+
```
122+
<?php
123+
$server = 'serverName';
124+
$dbName = 'databaseName';
125+
$uid = 'yourUserName';
126+
$pwd = 'yourPassword';
127+
128+
$conn = new PDO("sqlsrv:server=$server; database = $dbName", $uid, $pwd);
129+
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
130+
131+
try {
132+
$tableName = 'testTable';
133+
$query = "CREATE TABLE $tableName ([c1_int] sql_variant, [c2_varchar] sql_variant)";
134+
135+
$stmt = $conn->query($query);
136+
unset($stmt);
137+
138+
$query = "INSERT INTO [$tableName] (c1_int, c2_varchar) VALUES (1, 'test_data')";
139+
$stmt = $conn->query($query);
140+
unset($stmt);
141+
142+
$query = "SELECT * FROM $tableName";
143+
$stmt = $conn->query($query);
144+
145+
$result = $stmt->fetch(PDO::FETCH_ASSOC);
146+
print_r($result);
147+
148+
unset($stmt);
149+
unset($conn);
150+
} catch (Exception $e) {
151+
echo $e->getMessage();
152+
}
153+
?>
154+
```
155+
156+
The expected output would be:
157+
158+
```
159+
Array
160+
(
161+
[c1_int] => 1
162+
[c2_varchar] => test_data
163+
)
164+
```
165+
118166
## See Also
119167
[PDO Class](../../connect/php/pdo-class.md)
120168

docs/connect/php/sqlsrv-query.md

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "sqlsrv_query | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "05/22/2018"
4+
ms.date: "08/01/2018"
55
ms.prod: sql
66
ms.prod_service: connectivity
77
ms.reviewer: ""
@@ -186,6 +186,63 @@ sqlsrv_close($conn);
186186
?>
187187
```
188188
189+
## Example
190+
This code sample shows how to create a table of [sql_variant](https://docs.microsoft.com/sql/t-sql/data-types/sql-variant-transact-sql) types and fetch the inserted data.
191+
192+
```
193+
<?php
194+
$server = 'serverName';
195+
$dbName = 'databaseName';
196+
$uid = 'yourUserName';
197+
$pwd = 'yourPassword';
198+
199+
$options = array("Database"=>$dbName, "UID"=>$uid, "PWD"=>$pwd);
200+
$conn = sqlsrv_connect($server, $options);
201+
if($conn === false) {
202+
die(print_r(sqlsrv_errors(), true));
203+
}
204+
205+
$tableName = 'testTable';
206+
$query = "CREATE TABLE $tableName ([c1_int] sql_variant, [c2_varchar] sql_variant)";
207+
208+
$stmt = sqlsrv_query($conn, $query);
209+
if($stmt === false) {
210+
die(print_r(sqlsrv_errors(), true));
211+
}
212+
sqlsrv_free_stmt($stmt);
213+
214+
$query = "INSERT INTO [$tableName] (c1_int, c2_varchar) VALUES (1, 'test_data')";
215+
$stmt = sqlsrv_query($conn, $query);
216+
if($stmt === false) {
217+
die(print_r(sqlsrv_errors(), true));
218+
}
219+
sqlsrv_free_stmt($stmt);
220+
221+
$query = "SELECT * FROM $tableName";
222+
$stmt = sqlsrv_query($conn, $query);
223+
224+
if(sqlsrv_fetch($stmt) === false) {
225+
die(print_r(sqlsrv_errors(), true));
226+
}
227+
228+
$col1 = sqlsrv_get_field($stmt, 0);
229+
echo "First field: $col1 \n";
230+
231+
$col2 = sqlsrv_get_field($stmt, 1);
232+
echo "Second field: $col2 \n";
233+
234+
sqlsrv_free_stmt($stmt);
235+
sqlsrv_close($conn);
236+
237+
?>
238+
```
239+
240+
The expected output would be:
241+
242+
```
243+
First field: 1
244+
Second field: test_data
245+
```
189246
190247
## See Also
191248
[SQLSRV Driver API Reference](../../connect/php/sqlsrv-driver-api-reference.md)

docs/includes/ss-linux-cluster-pacemaker-configure-rhel.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
sudo pcs cluster auth <node1> <node2> <node3> -u hacluster -p <password for hacluster>
3737
sudo pcs cluster setup --name <clusterName> <node1> <node2> <node3>
3838
sudo pcs cluster start --all
39+
sudo pcs cluster enable --all
3940
```
4041

4142
>[!NOTE]

docs/linux/sql-server-linux-availability-group-cluster-sles.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ crm configure property cluster-recheck-interval=2min
210210
211211
For more information on Pacemaker cluster properties, see [Configuring Cluster Resources](https://www.suse.com/documentation/sle_ha/book_sleha/data/sec_ha_config_crm_resources.html).
212212
213-
# Configure fencing (STONITH)
213+
## Configure fencing (STONITH)
214214
Pacemaker cluster vendors require STONITH to be enabled and a fencing device configured for a supported cluster setup. When the cluster resource manager cannot determine the state of a node or of a resource on a node, fencing is used to bring the cluster to a known state again.
215215
216216
Resource level fencing ensures mainly that there is no data corruption during an outage by configuring a resource. You can use resource level fencing, for instance, with DRBD (Distributed Replicated Block Device) to mark the disk on a node as outdated when the communication link goes down.
@@ -233,6 +233,16 @@ sudo crm configure property stonith-enabled=true
233233
234234
Refer to [SLES Administration Guid](https://www.suse.com/documentation/sle-ha-12/singlehtml/book_sleha/book_sleha.html#cha.ha.manual_config)
235235
236+
## Enable Pacemaker
237+
238+
Enable Pacemaker so that it automatically starts.
239+
240+
Run the following command on every node in the cluster.
241+
242+
```bash
243+
systemctl enable pacemaker
244+
```
245+
236246
### Create availability group resource
237247
238248
The following command creates and configures the availability group resource for three replicas of availability group [ag1]. The monitor operations and timeouts have to be specified explicitly in SLES based on the fact that timeouts are highly workload-dependent and need to be carefully adjusted for each deployment.

docs/relational-databases/backup-restore/piecemeal-restores-sql-server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ manager: craigg
2222
---
2323
# Piecemeal Restores (SQL Server)
2424
[!INCLUDE[appliesto-ss-xxxx-xxxx-xxx-md](../../includes/appliesto-ss-xxxx-xxxx-xxx-md.md)]
25-
This topic is relevant only for databases in the Enterprise edition of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] that contain multiple files or filegroups; and, under the simple model, only for read-only filegroups.
25+
This topic is relevant for databases in the Enterprise edition of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] (online restore) or Standard edition (offline restore) that contain multiple files or filegroups; and, under the simple model, only for read-only filegroups.
2626

2727
For information about piecemeal restore and memory-optimized tables, see [Piecemeal Restore of Databases With Memory-Optimized Tables](../../relational-databases/in-memory-oltp/piecemeal-restore-of-databases-with-memory-optimized-tables.md).
2828

docs/relational-databases/indexes/columnstore-indexes-overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ When you create a table with the `CREATE TABLE` statement, you can create the ta
141141
|Create a table as a columnstore.|[CREATE TABLE &#40;Transact-SQL&#41;](../../t-sql/statements/create-table-transact-sql.md)|Beginning with [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)], you can create the table as a clustered columnstore index. You don't have to first create a rowstore table and then convert it to columnstore.|
142142
|Create a memory table with a columnstore index.|[CREATE TABLE &#40;Transact-SQL&#41;](../../t-sql/statements/create-table-transact-sql.md)|Beginning with [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)], you can create a memory-optimized table with a columnstore index. The columnstore index can also be added after the table is created by using the `ALTER TABLE ADD INDEX` syntax.|
143143
|Convert a rowstore table to a columnstore.|[CREATE COLUMNSTORE INDEX &#40;Transact-SQL&#41;](../../t-sql/statements/create-columnstore-index-transact-sql.md)|Convert an existing heap or binary tree to a columnstore. Examples show how to handle existing indexes and also the name of the index when performing this conversion.|
144-
|Convert a columnstore table to a rowstore.|[CREATE COLUMNSTORE INDEX &#40;Transact-SQL&#41;](../../t-sql/statements/create-columnstore-index-transact-sql.md)|Usually this conversion isn't necessary, but there can be times when you need to convert. Examples show how to convert a columnstore to a heap or clustered index.|
144+
|Convert a columnstore table to a rowstore.|[CREATE CLUSTERED INDEX &#40;Transact-SQL&#41;OR DROP INDEX](../../relational-databases/indexes/create-clustered-indexes.md)|Usually this conversion isn't necessary, but there can be times when you need to convert. Examples show how to convert a columnstore to a heap or clustered index.|
145145
|Create a columnstore index on a rowstore table.|[CREATE COLUMNSTORE INDEX &#40;Transact-SQL&#41;](../../t-sql/statements/create-columnstore-index-transact-sql.md)|A rowstore table can have one columnstore index. Beginning with [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)], the columnstore index can have a filtered condition. Examples show the basic syntax.|
146146
|Create performant indexes for operational analytics.|[Get started with columnstore for real-time operational analytics](../../relational-databases/indexes/get-started-with-columnstore-for-real-time-operational-analytics.md)|Describes how to create complementary columnstore and btree indexes, so that OLTP queries use btree indexes and analytics queries use columnstore indexes.|
147147
|Create performant columnstore indexes for data warehousing.|[Columnstore indexes for data warehousing](~/relational-databases/indexes/columnstore-indexes-data-warehouse.md)|Describes how to use btree indexes on columnstore tables to create performant data warehousing queries.|

docs/relational-databases/toc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
href: sql-server-guides.md
77
items:
88
- name: Always On Availability Groups Troubleshooting and Monitoring Guide
9+
href: ../database-engine/availability-groups/windows/always-on-availability-groups-troubleshooting-and-monitoring-guide.md
910
- name: Index Architecture and Design
1011
href: sql-server-index-design-guide.md
1112
- name: Memory Management Architecture

0 commit comments

Comments
 (0)