Skip to content

Commit d2dbabd

Browse files
committed
added region tags for connection timeout
1 parent 5ed8d98 commit d2dbabd

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

cloud_sql/mysql/pdo/src/app.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,14 @@
6262
}
6363

6464
// Connect to the database.
65+
# [START cloud_sql_mysql_pdo_timeout]
6566
// Here we set the connection timeout to five seconds and ask PDO to
6667
// throw an exception if any errors occur.
6768
$conn = new PDO($dsn, $username, $password, [
6869
PDO::ATTR_TIMEOUT => 5,
6970
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
7071
]);
72+
# [END cloud_sql_mysql_pdo_timeout]
7173
# [END cloud_sql_mysql_pdo_create]
7274
} catch (TypeError $e) {
7375
throw new RuntimeException(

cloud_sql/sqlserver/pdo/src/app.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,14 @@
5050
$dsn = sprintf('sqlsrv:server=%s;Database=%s', $hostname, $dbName);
5151

5252
// Connect to the database.
53+
# [START cloud_sql_sqlserver_pdo_timeout]
5354
// Here we set the connection timeout to five seconds and ask PDO to
5455
// throw an exception if any errors occur.
5556
$conn = new PDO($dsn, $username, $password, [
5657
PDO::ATTR_TIMEOUT => 5,
5758
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
5859
]);
60+
# [END cloud_sql_sqlserver_pdo_timeout]
5961
# [END cloud_sql_sqlserver_pdo_create]
6062
} catch (TypeError $e) {
6163
throw new RuntimeException(

0 commit comments

Comments
 (0)