Set the connection timeout when using Node.js

Demonstrates configuring the connection timeout when connecting to Cloud SQL for SQL Server using the Node.js mssql module.

Documentation pages that include this code sample

To view the code sample used in context, see the following documentation:

Code sample


// 'connectionTimeout` is the maximum number of milliseconds to wait trying to establish an
// initial connection. After the specified amount of time, an exception will be thrown.
config.connectionTimeout = 30000;
// 'acquireTimeoutMillis' is the number of milliseconds before a timeout occurs when acquiring a
// connection from the pool.
config.pool.acquireTimeoutMillis = 30000;
// 'idleTimeoutMillis' is the number of milliseconds a connection must sit idle in the pool
// and not be checked out before it is automatically closed
(config.pool.idleTimeoutMillis = 600000),

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.