Delete a connection Stay organized with collections Save and categorize content based on your preferences.
Remove credentials to an external source from BigQuery.
Explore further
For detailed documentation that includes this code sample, see the following:
Code sample
Java
Before trying this sample, follow theJava setup instructions in theBigQuery quickstart using client libraries. For more information, see theBigQueryJava API reference documentation.
To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for client libraries.
importcom.google.cloud.bigquery.connection.v1.ConnectionName;importcom.google.cloud.bigquery.connection.v1.DeleteConnectionRequest;importcom.google.cloud.bigqueryconnection.v1.ConnectionServiceClient;importjava.io.IOException;// Sample to delete a connectionpublicclassDeleteConnection{publicstaticvoidmain(String[]args)throwsIOException{// TODO(developer): Replace these variables before running the sample.StringprojectId="MY_PROJECT_ID";Stringlocation="MY_LOCATION";StringconnectionName="MY_CONNECTION_NAME";deleteConnection(projectId,location,connectionName);}staticvoiddeleteConnection(StringprojectId,Stringlocation,StringconnectionName)throwsIOException{try(ConnectionServiceClientclient=ConnectionServiceClient.create()){ConnectionNamename=ConnectionName.of(projectId,location,connectionName);DeleteConnectionRequestrequest=DeleteConnectionRequest.newBuilder().setName(name.toString()).build();client.deleteConnection(request);System.out.println("Connection deleted successfully");}}}What's next
To search and filter code samples for other Google Cloud products, see theGoogle Cloud sample browser.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.