# Troubleshooting Guide - [Common Issues](#common-issues) * [Connection Issues](#connection-issues) * [Schema Issues](#schema-issues) * [Query Issues](#query-issues) - [Logs](#logs) ## Common Issues ### Connection Issues #### Invalid host or port number ##### What to look for: - `java.net.ConnectException: Connection refused: connect` ###### Tableau Connection Error ```text An error occurred while communicating with Amazon DocumentDB by Amazon Web Services Bad Connection: Tableau could not connect to the data source. Error Code: FAB9A2C5 Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused: connect}}] Unable to connect to the Amazon DocumentDB by Amazon Web Services server "localhost". Check that the server is running and that you have access privileges to the requested database. Connector Class: documentdbjdbc, Version: ... ``` ###### DbVisualizer Connection Error ```text An error occurred while establishing the connection: Long Message: Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused: connect}}] ``` ##### What to do: This problem suggests that you are unable to reach the DocumentDB cluster. Most commonly, this is because you are outside the cluster's VPC. To connect to an Amazon DocumentDB cluster from outside an Amazon VPC, you can use an SSH tunnel. The driver allows users to set up an SSH tunnel manually or pass additional parameters in the connecting string so that the driver can create one automatically. See [Using an SSH Tunnel to Connect to Amazon DocumentDB](../setup/setup.md#using-an-ssh-tunnel-to-connect-to-amazon-documentdb) for more information on both methods. If this is still an issue after having set up an SSH tunnel, double-check the values of *Port* or *Hostname*. If you have manually set up an SSH tunnel: 1. Ensure the *Port* number in your connection string matches the local port number configured when using an SSH tunnel. In this example, the local port is **27019** not 27017:
ssh -i "ec2Access.pem" -L 27019:sample-cluster.node.us-east-1.docdb.amazonaws.com:27017 ec2-user@ec2.compute-1.amazonaws.com -N
1. Ensure the *Hostname* in your connection string is set to `localhost`.
If you are using the automatically set up SSH tunnel:
1. Ensure the *Port* number in your connection matches the cluster's port number. Typically, this is `27017`.
1. Ensure the *Hostname* in your connection string is set to the cluster hostname and **not** `localhost`.
If the issue is unrelated to SSH tunneling,
double check other parameters in your [connection string](../setup/connection-string.md)
and make sure the cluster is running and available to connect to.
#### Internally Embedded Certificate Authority Issue
##### What to look for:
- `unable to find valid certification path to requested target`
- `Server's certificate with common name ... is not trusted`
###### Tableau Certificate Error
```text
An error occurred while communicating with Amazon DocumentDB by Amazon Web Services
Bad Connection: Tableau could not connect to the data source.
Error Code: FAB9A2C5
Timed out after 30000 ms while waiting to connect.
Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27019, type=UNKNOWN, state=CONNECTING,
exception={com.mongodb.MongoSocketWriteException: Exception sending message},
caused by {javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target},
caused by {sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target},
caused by {sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target}}]
Unable to connect to the Amazon DocumentDB by Amazon Web Services server "localhost".
Check that the server is running and that you have access privileges to the requested database.
Connector Class: documentdbjdbc, Version: ...
```
###### DbVisualizer Certificate Error
```text
Server's certificate with common name ... is not trusted.
The reason a server is not trusted is most likely due to missing certificate authorities in the truststore.
The online security resources may give a pointer how to fix this.
```
#### What to do:
1. Download the latest root certificate authority file.
See [Specifying the Amazon RDS Certificate Authority Certificate File](../setup/setup.md#specifying-the-amazon-rds-certificate-authority-certificate-file).
1. Copy the file to your home directory.
1. Provide the root certificate file name in the connection.
- Tableau: *TLS Certificate Authority File (Optional)* : `~/rds-ca-2019-root.pem`
- DbVisualizer: `jdbc:documentdb://localhost:27017/test?tls=true&tlsAllowInvalidHostnames=true&tlsCAFile=~/rds-ca-2019-root.pem`
### Invalid hostname
#### What to look for:
- `javax.net.ssl.SSLHandshakeException: No subject alternative DNS name matching localhost found.`
#### What to do:
1. Pass the `tlsAllowInvalidHostnames` parameter in your connection string as `true`.
### Invalid username or password
#### What to look for:
- `Invalid username or password or user is not authorized on database '
Unable to parse SQL 'SELECT * FROM database.TESTCOLLECTION'."
Reason: 'From line 1, column 15 to line 1, column 37:"
Object 'TESTCOLLECTION' not found within 'database'; did you mean 'testCollection'?'"
## Logs
When troubleshooting, it can be helpful to view the logs so that you might be able
to resolve the issue on your own or at least have more context to provide when seeking support.
The driver's logs will be written to `~/.documentdb/logs/documentdb-jdbc.log`.
Many BI tools also provide an interface for users to easily view logs. Tableau, for example,
has [Tableau Log Viewer](https://github.com/tableau/tableau-log-viewer).
Tableau Desktop stores the logs in the `Logs` subfolder under `My Tableau Repository` which is typically
under `Documents` although this may vary depending on how Tableau was installed.
The JDBC driver's logs will be in the `jprotocolserver.log` file.
Refer to the documentation of your tool of choice for similar instructions.
### Setting Logging Level and Location
There are the following levels of logging:
| Property Value | Description |
|--------|-------------|
| `FATAL` | Shows messages at a FATAL level only.|
| `ERROR` | Shows messages classified as ERROR and FATAL.|
| `WARNING` | Shows messages classified as WARNING, ERROR and FATAL.|
| `INFO` | Shows messages classified as INFO, WARNING, ERROR and FATAL.|
| `DEBUG` | Shows messages classified as DEBUG, INFO, WARNING, ERROR and FATAL.|
| `TRACE` | Shows messages classified as TRACE, DEBUG, INFO, WARNING, ERROR and FATAL.|
| `ALL` | Shows messages classified as TRACE, DEBUG, INFO, WARNING, ERROR and FATAL.|
| `OFF` | No log messages displayed.|
| Property Name | Description | Default |
|--------|-------------|---------------|
| `documentdb.jdbc.log.level` | The log level for all sources/appenders. | `INFO` |
| `documentdb.jdbc.log.file.path` | The location for file logging. | `~/.documentdb/logs/documentdb-jdbc.log` |
| `documentdb.jdbc.log.file.threshold` | The threshold for file logging. | `ALL` |
| `documentdb.jdbc.log.console.threshold` | The threshold for console logging. | `ERROR` |
To set these properties, use the `JAVA_TOOL_OPTIONS` environment variables with the following format
`-D