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.
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.
- Google Cloud
- Cloud SQL
- Cloud SQL for SQL Server
- Python
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.
- Cloud SQL
- Cloud SQL for SQL Server
- Google Cloud
- C#
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.
- Cloud SQL for SQL Server
- Google Cloud
- Cloud SQL
- C#
Set the connection timeout when using SQLAlchemy
Demonstrates the configuration of a connection timeout when connecting to Cloud SQL for SQL Server using SQLAlchemy.
- Cloud SQL
- Cloud SQL for SQL Server
- Google Cloud
- Python
Create a TCP connection by using Python
Open a TCP connection to Cloud SQL for SQL Server by using Python.
- Google Cloud
- Cloud SQL for SQL Server
- Cloud SQL
- Python
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.
- Cloud SQL for SQL Server
- Cloud SQL
- Google Cloud
- C#
Create a TCP connection by using Java
Open a TCP connection to Cloud SQL for SQL Server by using Java.
- Cloud SQL for SQL Server
- Google Cloud
- Cloud SQL
- Java
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.
- Google Cloud
- Cloud SQL for SQL Server
- Cloud SQL
- JavaScript
- Node JS
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.
- Cloud SQL
- Cloud SQL for SQL Server
- Google Cloud
- C#
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.
- Google Cloud
- Cloud SQL for SQL Server
- Cloud SQL
- Python
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.
- Cloud SQL
- Cloud SQL for SQL Server
- Google Cloud
- Python
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.
- Google Cloud
- Cloud SQL
- Cloud SQL for SQL Server
- C#
Create a TCP connection by using PHP
Open a TCP connection to Cloud SQL for SQL Server by using PHP.
- Google Cloud
- Cloud SQL for SQL Server
- Cloud SQL
- PHP
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.
- Google Cloud
- Cloud SQL
- Cloud SQL for SQL Server
- Go
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.
- Cloud SQL for SQL Server
- Google Cloud
- Cloud SQL
- Node JS
- JavaScript
Create a TCP connection when using Go
Demonstrates opening a TCP connection to Cloud SQL for SQL Server using Go's database/sql package.
- Google Cloud
- Cloud SQL
- Cloud SQL for SQL Server
- Go
Ruby: SQL Server ActiveRecord connection
Demonstrates inserting data using ActiveRecord to manage opening and closing a connection to Cloud SQL for SQL Server.
- Cloud SQL
- Cloud SQL for SQL Server
- Google Cloud
- Ruby
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.
- Google Cloud
- Cloud SQL
- Cloud SQL for SQL Server
- Java
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.
- Cloud SQL
- Google Cloud
- Cloud SQL for SQL Server
- Go
Retrying failed connections using SQLAlchemy
Code comment that explains how failed connections are retried when connecting to Cloud SQL for SQL Server using SQLAlchemy.
- Google Cloud
- Cloud SQL for SQL Server
- Cloud SQL
- 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.
- Google Cloud
- Cloud SQL for SQL Server
- Cloud SQL
- C#
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.
- Google Cloud
- Cloud SQL
- Cloud SQL for SQL Server
- JavaScript
- Node JS
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.
- Cloud SQL for SQL Server
- Google Cloud
- Cloud SQL
- PHP
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.
- Cloud SQL
- Cloud SQL for SQL Server
- Google Cloud
- Node JS
- JavaScript
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.
- Cloud SQL
- Google Cloud
- Cloud SQL for SQL Server
- Go
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.
- Cloud SQL for SQL Server
- Google Cloud
- Cloud SQL
- Go
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.
- Google Cloud
- Cloud SQL for SQL Server
- Cloud SQL
- JavaScript
- Node JS
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.
- Google Cloud
- Cloud SQL
- Cloud SQL for SQL Server
- Go
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.
- Cloud SQL for SQL Server
- Cloud SQL
- Google Cloud
- Python
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.
- Google Cloud
- Cloud SQL for SQL Server
- Cloud SQL
- Python
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.
- Google Cloud
- Cloud SQL for SQL Server
- Cloud SQL
- PHP