Skip to content

Fix BigQuery JDBC manual commit mode region mismatch for non-US locations#13285

Open
yagudin10 wants to merge 1 commit into
googleapis:mainfrom
yagudin10:main
Open

Fix BigQuery JDBC manual commit mode region mismatch for non-US locations#13285
yagudin10 wants to merge 1 commit into
googleapis:mainfrom
yagudin10:main

Conversation

@yagudin10
Copy link
Copy Markdown

Problem

Manual commit mode fails when using BigQuery JDBC with non-US datasets.

STR (Steps to Reproduce)

  1. Create BigQuery JDBC connection
  2. Set a non-US location (e.g. EU) via Location property
  3. Enable session mode (EnableSession = 1)
  4. Disable auto-commit:
    conn.setAutoCommit(false);
  5. Execute a simple query:
SELECT 1;

ER (Expected Result)

  • Query executes successfully in manual commit mode
  • BigQuery uses configured Location (e.g. EU)
  • No region mismatch errors occur

AR (Actual Result)

Query execution fails with:

GoogleJsonResponseException: 400 Bad Request
INVALID_ARGUMENT
Error: 3848323

Sample java code:

String jdbcUrl = "jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443";

Properties props = new Properties();
props.put("OAuthType", "0");
props.put("OAuthPvtKeyPath", "<key-file-path>");
props.put("ProjectId", "<project-id>");
props.put("Location", "EU");
props.put("EnableSession", "1");

try (Connection conn = DriverManager.getConnection(jdbcUrl, props)) {
    conn.setAutoCommit(false);

    try (PreparedStatement ps = conn.prepareStatement("SELECT 1;")) {
        ps.execute();
    }
}

@yagudin10 yagudin10 requested review from a team as code owners May 28, 2026 10:08
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates BigQueryImpl.java to explicitly set the location for a new job using the configured options when generating a default JobId. This prevents jobs from being created with an incorrect location, such as when running in transaction mode outside the US. Additionally, telemetry tests in HttpBigQueryRpcTest.java have been updated to reflect the inclusion of the location in the job ID. No review comments were provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant