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.
Configure SSL certificates for TCP connection by using Go
Configure SSL (Secure Sockets Layer) certificates for a TCP connection to Cloud SQL for SQL Server by using Go's database/sql package.
Configure SSL certificates for TCP connection by using Python
Configure SSL (Secure Sockets Layer) certificates for a TCP connection to Cloud SQL for SQL Server by using Python's sqlalchemy package.
Create a connection using the Cloud SQL Go Connector
Open a connection to Cloud SQL for SQL Server by using the Cloud SQL Go Connector.
Create a connection using the Cloud SQL Java Connector
Open a connection to Cloud SQL for SQL Server by using the Cloud SQL Java Connector.
Create a connection using the Cloud SQL Python Connector
Open a connection to Cloud SQL for SQL Server by using the Cloud SQL Python Connector.
Create a TCP connection by using Java
Open a TCP connection to Cloud SQL for SQL Server by using Java.
Create a TCP connection by using PHP
Open a TCP connection to Cloud SQL for SQL Server by using PHP.
Create a TCP connection by using Python
Open a TCP connection to Cloud SQL for SQL Server by using Python.
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.
Create a TCP connection when using Go
Demonstrates opening a TCP connection to Cloud SQL for SQL Server using Go's database/sql package.
Create a TCP connection when using Node.js
Demonstrates opening a TCP connection to Cloud SQL for SQL Server using the Node.js mssql module.
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