intermediate5 min read

Connection Troubleshooting

Connection Troubleshooting

This page covers the most common connection issues and how to resolve them.

Connection Timed Out

Cause: AI for Database cannot reach your database server on the network.

Fixes:

  • Verify the host and port are correct.
  • Check firewall rules and security groups. Ensure the AI for Database IP range is allowed. Find your IP ranges in Settings > Connection Info.
  • If the database is in a private network, set up an SSH tunnel.
  • For cloud databases (RDS, Cloud SQL, Atlas), check the network access or authorized network settings.

Authentication Failed

Cause: The username or password is incorrect, or the user does not have permission to connect.

Fixes:

  • Double-check the credentials. Passwords are case-sensitive.
  • Verify the user exists: connect to the database directly using the same credentials.
  • For PostgreSQL, check pg_hba.conf to ensure the authentication method matches (e.g., md5 vs scram-sha-256).
  • For MySQL, ensure the user's host restriction matches the connecting IP.

SSL / TLS Errors

Cause: The database requires SSL but the certificate is missing or invalid.

Fixes:

  • Set SSL Mode to require instead of verify-full as a first step.
  • Upload the CA certificate provided by your cloud provider.
  • For self-signed certificates, upload the server's CA certificate in the Advanced section.
  • Ensure the certificate has not expired.

Permission Denied for Table

Cause: The database user does not have SELECT access on the table.

Fixes:

  • Run the appropriate GRANT SELECT statement for your database type.
  • For PostgreSQL, also run ALTER DEFAULT PRIVILEGES to cover future tables.
  • For SQL Server, ensure the user is in the db_datareader role.

Connection Drops After a Few Minutes

Cause: Idle connections are being terminated by a firewall, load balancer, or database setting.

Fixes:

  • Enable connection keep-alive in the Advanced settings.
  • Check your database's idle timeout setting (e.g., idle_in_transaction_session_timeout in PostgreSQL).
  • If using a cloud load balancer, increase the idle timeout.

Still Stuck?

Contact support at hello@aifordatabase.com with your connection type, error message, and any relevant logs. We typically respond within a few hours.