이 페이지에서는 Google에서 권장하고 승인된 Spanner JDBC 드라이버를 설명합니다.
Google에서는 Spanner용 오픈소스 JDBC 드라이버를 제공합니다. 이 오픈소스 드라이버는 애플리케이션에서 자바 데이터베이스 연결(JDBC) API를 통해 Spanner에 액세스할 수 있도록 합니다.
이 페이지에서는 Spanner JDBC 드라이버와 관련하여 자주 묻는 질문(FAQ)과 그에 대한 답변을 제공합니다.
드라이버 사용 방법은 GoogleSQL 언어 데이터베이스에 JDBC 연결을 참조하세요.
DML 및 데이터 정의 언어(DDL) 지원
Spanner JDBC 드라이버는 DML 및 DDL 문을 지원합니다.
상위-하위 및 인터리브 처리된 테이블 관계
인터리브 처리된 테이블 관계는 JDBC에서 외래 키 관계로 매핑됩니다.
Spanner에서 상위 요소와 함께 인터리브 처리된 하위 테이블의 레코드에는 연결된 상위 테이블 레코드의 기본 키에 종속된 기본 키가 있습니다.
Spanner는 하위 테이블의 기본 키 중 상위 기본 키 부분을 상위 테이블의 기본 키를 참조하는 외래 키로 정의합니다. 따라서 DatabaseMetaData에서 외래 키 메타데이터 호출을 사용하여 인터리브 처리된 테이블 관계를 탐색할 수 있습니다. 자세한 내용은 스키마 정보를 참조하세요.
데이터 유형 지원
Spanner JDBC 드라이버는 Spanner의 STRUCT 데이터 유형을 지원하지 않습니다. 다른 모든 유형에는 그에 맞는 매핑이 있습니다.
색인 지원
적절한 쿼리 구문을 사용하여 SELECT 쿼리에서 색인을 사용할 수 있습니다. 이 오픈소스 드라이버는 색인을 DDL 문으로 만들고 수정할 수도 있습니다. 특정 색인에 대한 정보는 DatabaseMetaData.getIndexInfo() 메서드를 사용하여 액세스할 수 있습니다.
파라미터화된 쿼리 지원
이 드라이버는 위치 기준 파라미터화를 지원합니다.
연결 풀
Spanner JDBC 드라이버는 열려 있는 모든 연결과 연결을 여는 데 사용된 연결 속성을 추적하여 내부적으로 풀링을 처리합니다. 예를 들어 기존 연결과 동일한 연결 속성을 가진 새 연결이 필요한 경우 이러한 풀 연결이 재사용됩니다. 지난 60초 동안 사용되지 않으면 연결이 자동으로 종료됩니다.
자체 풀을 제공하려면 표준 JDBC 연결 풀을 사용하면 됩니다. 드라이버 클래스 com.google.cloud.spanner.jdbc.JdbcDriver를 사용하도록 풀을 구성하고 유효한 Spanner JDBC 연결 URL을 설정합니다.
제한사항
이 드라이버의 기능은 기본 시스템의 정의에 따라 제한됩니다. Spanner의 할당량 및 한도를 참조하세요.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-05(UTC)"],[],[],null,["# Spanner JDBC driver\n\nThis page describes the Spanner JDBC driver,\nwhich is recommended and authored by Google.\n\nGoogle offers an open-source JDBC driver for Spanner. The open-source\ndriver enables applications to access Spanner through the Java Database\nConnectivity (JDBC) API.\n\nThis page answers frequently asked questions about the Spanner JDBC driver.\nTo learn how to use the driver, see\n[Connect JDBC to a GoogleSQL-dialect database](/spanner/docs/use-oss-jdbc).\n\nData Manipulation Language (DML) and Data Definition Language (DDL) support\n---------------------------------------------------------------------------\n\nThe Spanner JDBC driver driver supports DML and DDL statements.\n\nParent-child and interleaved table relationships\n------------------------------------------------\n\nInterleaved table relationships are mapped to foreign key relationships in JDBC.\nIn Spanner, a record in the child table interleaved with a parent has\nits primary key dependent on the associated parent table record's primary key.\nSpanner defines the child table's *parent primary key* portion of its\nprimary key as the foreign key, referencing the parent table's primary key. Thus\nyou can navigate the interleaved table relationships using the foreign key\nmetadata calls in `DatabaseMetaData`. You can read more details in\n[About schemas](/spanner/docs/schema-and-data-model).\n\nData types support\n------------------\n\nThe Spanner JDBC driver doesn't support Spanner's `STRUCT`\ndata type. All other types have appropriate mappings.\n\nIndex support\n-------------\n\nYou can use indexes in `SELECT` queries using the appropriate\n[query syntax](/spanner/docs/reference/standard-sql/query-syntax). The open-source driver can also\ncreate and modify indexes as DDL statements. You can access information about\nparticular indexes using the `DatabaseMetaData.getIndexInfo()` method.\n\nParameterized query support\n---------------------------\n\nThis driver supports positional parameterization.\n\nConnection pools\n----------------\n\nThe Spanner JDBC driver handles pooling internally by keeping track of\nall connections that have been opened, as well as the connection properties that\nwere used to open those connections. These pool connections are re-used, for\nexample, when a new connection is required that has the same connection\nproperties as an existing connection. A connection is closed automatically if it\nhas not been used in the last 60 seconds.\n\nIf you want to provide your own pool, you can use any standard\nJDBC connection pool. Configure the pool to use the driver class\n`com.google.cloud.spanner.jdbc.JdbcDriver` and set a valid Spanner\nJDBC connection URL.\n\nLimitations\n-----------\n\nThis driver's capabilities have limits defined by the underlying system. See the\n[quotas and limits](/spanner/quotas) for Spanner.\n\nSupport\n-------\n\nConsult our [support page](/spanner/docs/getting-support) for support options.\n\nWhat's next\n-----------\n\nLearn how to [Connect JDBC to a GoogleSQL-dialect database](/spanner/docs/use-oss-jdbc)."]]