[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-05。"],[],[],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)."]]