This page describes how to test a Database Connection.
After creating or updating a Database Connection, you can test it to check whether it was configured successfully.
Test a Database Connection
To test a Database Connection, do the following:
gcloud
Use the gcloud oracle-database database-connections test command to
test a Database Connection.
gcloud oracle-database database-connections test CONNECTION_ID \
--project=PROJECT_ID \
--location=REGION
Replace the following:
- CONNECTION_ID: the ID of the Database Connection.
- PROJECT_ID: the ID of your Google Cloud project.
- REGION: the region where your Database Connection is located.
API
To test a Database Connection, run the following curl command:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://oracledatabase.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/databaseConnections/CONNECTION_ID:test"
-d '{}'
Replace the following:
- PROJECT_ID: the ID of your Google Cloud project.
- REGION: the region where your Database Connection is located.
- CONNECTION_ID: the ID of the Database Connection.
If the test succeeds, then the response contains {"success": true}.
The test might fail with the following types of errors:
- API errors: Authentication failures, database unavailability, network
errors, and timeouts are returned as standard API errors (HTTP 4xx/5xx), not
as
status: ERROR. - ORA errors: ORA errors occur when the query is invalid. For example,
ORA-00942: table or view does not exist. Oracle rejects the query and the call succeeds withHTTP 200. However, themetadata.statusisERROR. Therefore, check themetadata.statusandmetadata.messageto determine the cause of the error.
For more information, see Troubleshoot Database Connections and SQL runtime issues.