Configure the maximum number of seconds a connection can persist when connecting to Cloud SQL for MySQL by using the ADO.NET Connection object.
For detailed documentation that includes this code sample, see the following:
// ConnectionLifeTime sets the lifetime of a pooled connection // (in seconds) that a connection lives before it is destroyed // and recreated. Connections that are returned to the pool are // destroyed if it's been more than the number of seconds // specified by ConnectionLifeTime since the connection was // created. The default value is zero (0) which means the // connection always returns to pool. connectionString.ConnectionLifeTime = 1800; // 30 minutes
To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.