Skip to content

Commit ebcc275

Browse files
committed
review fix changes
1 parent 50e972a commit ebcc275

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

articles/mysql/concepts-connectivity.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The first and second case are fairly straight forward to handle. Try to open the
3131
* For each following retry, the increase the wait exponentially, up to 60 seconds.
3232
* Set a max number of retries at which point your application considers the operation failed.
3333

34-
When a connection with an active transaction fails, it is more difficult to handle the recovery correctly. There are two cases: If the transaction was read-only in nature, it is safe to reopen the connection and to retry the transaction. If however if the transaction was also writing to the database, you must determine if the transaction was rolled back, or if it succeeded before the transient error happened. In that case, you might just not have received the commit acknowledgment from the database server.
34+
When a connection with an active transaction fails, it is more difficult to handle the recovery correctly. There are two cases: If the transaction was read-only in nature, it is safe to reopen the connection and to retry the transaction. If however the transaction was also writing to the database, you must determine if the transaction was rolled back, or if it succeeded before the transient error happened. In that case, you might just not have received the commit acknowledgment from the database server.
3535

3636
One way of doing this, is to generate a unique ID on the client that is used for all the retries. You pass this unique ID as part of the transaction to the server and to store it in a column with a unique constraint. This way you can safely retry the transaction. It will succeed if the previous transaction was rolled back and the client-generated unique ID does not yet exist in the system. It will fail indicating a duplicate key violation if the unique ID was previously stored because the previous transaction completed successfully.
3737

@@ -50,7 +50,7 @@ Managing database connections can have a significant impact on the performance o
5050
For better illustration, this article provides [a piece of sample code](./sample-scripts-java-connection-pooling.md) that uses JAVA as an example. For more information, see [Apache common DBCP](http://commons.apache.org/proper/commons-dbcp/).
5151

5252
> [!NOTE]
53-
> The server configures a timeout mechanism to close a connection that has been in an idle state for some time to free up resources. Be sure to set up the verification system to ensure the effectiveness of persistent connections when you are using them. For more information, see [Configure verification systems on the client side to ensure the effectiveness of persistent connections](https://review.docs.microsoft.com/azure/mysql/concepts-connectivity?branch=pr-en-us-91864#configure-verification-mechanisms-in-clients-to-confirm-the-effectiveness-of-persistent-connections).
53+
> The server configures a timeout mechanism to close a connection that has been in an idle state for some time to free up resources. Be sure to set up the verification system to ensure the effectiveness of persistent connections when you are using them. For more information, see [Configure verification systems on the client side to ensure the effectiveness of persistent connections](concepts-connectivity.md#configure-verification-mechanisms-in-clients-to-confirm-the-effectiveness-of-persistent-connections).
5454
5555
## Access databases by using persistent connections (recommended)
5656

@@ -68,7 +68,7 @@ By setting the TestOnBorrow parameter, when there's a new request, the connectio
6868

6969
For information on the specific settings, see the [JDBC connection pool official introduction document](https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#Common_Attributes). You mainly need to set the following three parameters: TestOnBorrow (set to true), ValidationQuery (set to SELECT 1), and ValidationQueryTimeout (set to 1). The specific sample code is shown below:
7070

71-
```
71+
```java
7272
public class SimpleTestOnBorrowExample {
7373
public static void main(String[] args) throws Exception {
7474
PoolProperties p = new PoolProperties();

articles/mysql/sample-scripts-java-connection-pooling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ms.date: 02/28/2018
1111

1212
The below sample code illustrates connection pooling in java.
1313

14-
```
14+
```java
1515
import java.sql.Connection;
1616
import java.sql.DriverManager;
1717
import java.sql.ResultSet;

0 commit comments

Comments
 (0)