All Cloud SQL for SQL Server code samples

This page contains code samples for Cloud SQL for SQL Server. To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.

C#: SQL Server ADO.NET connection

Demonstrates executing a SQL INSERT statement by opening and closing a connection to Cloud SQL for SQL Server using the ADO.NET System.Data.Common package.

View in documentation

Create a TCP connection when using ADO.NET

Demonstrates opening a TCP connection to Cloud SQL for SQL Server using an ADO.NET Connection object.

Go: SQL Server database sql connection

Demonstrates executing a SQL INSERT statement by opening and closing a connection to Cloud SQL for SQL Server using Go's database/sql package.

View in documentation

Implement exponential backoff when using ADO.NET

Demonstrates how to implement exponential backoff to retry failed connections when connecting to Cloud SQL for SQL Server using ADO.NET with the Polly .NET library.

View in documentation

Node.js: SQL Server - mssql connection

Demonstrates executing a SQL INSERT statement by opening and closing a connection to Cloud SQL for SQL Server using the Node.js mssql module.

View in documentation

PHP: SQL Server PDO connection

Demonstrates executing a SQL INSERT statement by opening and closing a connection to Cloud SQL for SQL Server using the PHP Data Objects (PDO) extension.

View in documentation

Python: SQL Server SQLAlchemy opening and closing connections

Demonstrates executing a SQL INSERT statement by opening and closing a connection to Cloud SQL for SQL Server using SQLAlchemy.

View in documentation

Retrying failed connections using SQLAlchemy

Code comment that explains how failed connections are retried when connecting to Cloud SQL for SQL Server using SQLAlchemy.

View in documentation

Retrying failed connections using the Node.js mssql module

Code comment that explains how failed connections are retried when connecting to Cloud SQL for SQL Server using the Node.js mssql module.

View in documentation

Ruby: SQL Server ActiveRecord connection

Demonstrates inserting data using ActiveRecord to manage opening and closing a connection to Cloud SQL for SQL Server.

View in documentation

Set connection pool and overflow limits when using ADO.NET

Demonstrates configuring the connection pool size and overflow when connecting to Cloud SQL for SQL Server using the ADO.NET Connection object.

View in documentation

Set connection pool and overflow limits when using Go

Demonstrates configuring the connection pool size and overflow when connecting to Cloud SQL for SQL Server using Go's database/sql package.

View in documentation

Set connection pool and overflow limits when using Node.js

Demonstrates configuring the connection pool size and overflow when connecting to Cloud SQL for SQL Server using the Node.js mssql module.

View in documentation

Set connection pool and overflow limits when using SQLAlchemy

Demonstrates the configuration of a connection pool size and overflow when connecting to Cloud SQL for SQL Server using SQLAlchemy.

View in documentation

Set the connection duration when using ADO.NET

Demonstrates the configuration of the maximum number of seconds a connection can persist when connecting to Cloud SQL for SQL Server using the ADO.NET Connection object.

View in documentation

Set the connection duration when using SQLAlchemy

Demonstrates the configuration of the maximum number of seconds a connection can persist when connecting to Cloud SQL for SQL Server using SQLAlchemy.

View in documentation

Set the connection timeout when using ADO.NET

Demonstrates configuring the connection timeout when connecting to Cloud SQL for SQL Server using the ADO.NET Connection object.

View in documentation

Set the connection timeout when using Go

Demonstrates configuring the connection timeout when connecting to Cloud SQL for SQL Server using Go's database/sql package.

View in documentation

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.

View in documentation

Set the connection timeout when using PHP

Demonstrates the configuration of a connection timeout when connecting to Cloud SQL for SQL Server using the PHP Data Objects (PDO) extension.

View in documentation

Set the connection timeout when using SQLAlchemy

Demonstrates the configuration of a connection timeout when connecting to Cloud SQL for SQL Server using SQLAlchemy.

View in documentation