Stay organized with collections Save and categorize content based on your preferences.
JdbcThe JDBC service allows scripts to connect to Google Cloud SQL, MySQL, Microsoft SQL Server, and Oracle databases. For more information, see the guide to JDBC.
Detailed documentationgetCloudSqlConnection(url)
Attempts to establish a connection to the given Google Cloud SQL URL.
Parameters Name Type Descriptionurl
String
A database URL of the form jdbc:google:mysql://subname
. Return
JdbcConnection
— A JdbcConnection object.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/sqlservice
getCloudSqlConnection(url, info)
Attempts to establish a connection to the given Google Cloud SQL URL.
Parameters Name Type Descriptionurl
String
A database URL of the form jdbc:google:mysql://subname
. info
Object
Optional JavaScript object specifying advanced parameters as defined below. Advanced parameters Name Type Description connectTimeoutSeconds
Integer
connection timeout in seconds database
String
the database to connect to instance
String
the name of a Google SQL Service instance password
String
the user's password queryTimeoutSeconds
Integer
query timeout in seconds user
String
the username to pass to the database Return
JdbcConnection
— A JdbcConnection object.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/sqlservice
getCloudSqlConnection(url, userName, password)
Attempts to establish a connection to the given Google Cloud SQL URL.
Parameters Name Type Descriptionurl
String
A database URL of the form jdbc:google:mysql://subname
. userName
String
The username to pass to the database. password
String
The user's password. Return
JdbcConnection
— A JdbcConnection object.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/sqlservice
getConnection(url)
Attempts to establish a connection to the given database URL.
const conn = Jdbc.getConnection( 'jdbc:mysql://yoursqlserver.example.com:3306/database_name', );Parameters Name Type Description
url
String
A database URL of the form jdbc:subprotocol:subname
. Return
JdbcConnection
— A JdbcConnection object.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/script.external_request
getConnection(url, info)
Attempts to establish a connection to the given database URL.
const conn = Jdbc.getConnection( 'jdbc:mysql://yoursqlserver.example.com:3306/database_name', {user: 'username', password: 'password'}, );Parameters Name Type Description
url
String
A database URL of the form jdbc:subprotocol:subname
. info
Object
Optional JavaScript object specifying advanced parameters as defined below. Advanced parameters Name Type Description databaseName
String
the database to connect to password
String
the user's password useJDBCCompliantTimeZoneShift
Boolean
whether or not the connection should comply with JDBC rules when converting time zones. The default is false
. user
String
the username to pass to the database _serverSslCertificate
String
the server's SSL certificate _clientSslCertificate
String
the client's SSL certificate _clientSslKey
String
the client's SSL key Return
JdbcConnection
— A JdbcConnection object.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/script.external_request
getConnection(url, userName, password)
Attempts to establish a connection to the given database using a username and password.
const conn = Jdbc.getConnection( 'jdbc:mysql://yoursqlserver.example.com:3306/database_name', 'username', 'password', );Parameters Name Type Description
url
String
A database URL of the form jdbc:subprotocol:subname
. userName
String
The username to pass to the database. password
String
The user's password. Return
JdbcConnection
— A JdbcConnection object.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/script.external_request
newDate(milliseconds)
Create a date from milliseconds since epoch.
Parameters Name Type Descriptionmilliseconds
Integer
Milliseconds since epoch. Return
JdbcDate
— A JdbcDate object.
newTime(milliseconds)
Create a time from milliseconds since epoch.
Parameters Name Type Descriptionmilliseconds
Integer
Milliseconds since epoch. Return
JdbcTime
— A JdbcTime object.
newTimestamp(milliseconds)
Create a timestamp from milliseconds since epoch.
Parameters Name Type Descriptionmilliseconds
Integer
Milliseconds since epoch. Return
JdbcTimestamp
— A JdbcTimestamp object.
parseDate(date)
Create a date by parsing the SQL date string.
Parameters Name Type Descriptiondate
String
A string containing a SQL date string. Return
JdbcDate
— A JdbcDate object.
parseTime(time)
Create a time by parsing the SQL time string.
Parameters Name Type Descriptiontime
String
A string containing a SQL time string. Return
JdbcTime
— A JdbcTime object.
parseTimestamp(timestamp)
Create a timestamp by parsing the SQL timestamp string.
Parameters Name Type Descriptiontimestamp
String
A string containing a SQL timestamp string. Return
JdbcTimestamp
— A JdbcTimestamp object.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-05 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-05 UTC."],[[["The JDBC service enables scripts to connect to Google Cloud SQL, MySQL, Microsoft SQL Server, and Oracle databases."],["It provides methods to establish connections to databases using URLs and credentials, along with functionalities to manage SQL dates and times."],["You can use specific methods like `getCloudSqlConnection` to connect to Google Cloud SQL and `getConnection` for other database types."],["The service requires specific authorization scopes depending on the chosen connection method and target database."],["It includes utilities for creating and parsing SQL date, time, and timestamp objects for database interactions."]]],["The JDBC service facilitates script connections to various databases, including Google Cloud SQL, MySQL, SQL Server, and Oracle. It offers methods to establish connections via database URLs, optionally with usernames, passwords, and advanced parameters. It can connect to google cloud sql with the `getCloudSqlConnection` method, and with `getConnection` to other databases. Additional functions create `JdbcDate`, `JdbcTime`, and `JdbcTimestamp` objects from milliseconds or by parsing SQL strings. Scripts must be authorized with appropriate scopes to use these methods.\n"]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4