> For the complete documentation index, see [llms.txt](https://help.qtech.co.nz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.qtech.co.nz/datran/datran-vi-scada/datran-vi/troubleshooting/cannot-connect-to-sql.md).

# DATRAN won't connect to the SQL database

DATRAN VI's Active Connection won't show Connected, often after moving SQL Server. Check the database name, permissions, TCP/IP and encryption.

To determine if the database is connected, DATRAN monitors a parameter in the ADO service called **Active Connection** which polls the database and returns the result. If it receives no response, the **Active Connection** parameter is set to Disconnected.

{% hint style="info" %}
**Applies to:** DATRAN VI with SQL Server. The connection settings are under **Applications\ADO Database Connectivity\Databases\DATRANdatabase\Properties**.
{% endhint %}

## Check these

| Cause                                                                                        | Fix                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| -------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| The database can't be found                                                                  | In V6.78, a "Database schema validation failed" message indicates that the SQL server database schema does not match the expected schema for the DATRAN database. Check that the database is named correctly in the TBD (the **Database** property under Applications\ADO Database Connectivity\Databases\\{database}\Properties, typically expected to be DatranDatabase). Verify that this database exists on your SQL server instance. |
| DATRAN's login doesn't have the right permissions                                            | Ensure the "DATRANService" user account is added as administrator to SQL Server for ADO connectivity.                                                                                                                                                                                                                                                                                                                                     |
| The TCP port used by SQL doesn't match the one configured in DATRAN, or firewalls block data | The TCP port used by SQL must match that configured in DATRAN (typically 1433). Firewalls must allow data to pass between DATRAN and SQL.                                                                                                                                                                                                                                                                                                 |
| DATRAN uses the SQLOLEDB provider                                                            | The SQLOLEDB provider is deprecated and officially only supports SSL 3.0 and TLS 1.0 (in practice what it supports is highly OS dependent). MSOLEDBSQL19 is the current, actively maintained and recommended provider with full support for TLS 1.2+. See Use TLS 1.2 for the SQL Server connection.                                                                                                                                      |
| SQL Server limits the number of connections (V6.78)                                          | IT administrators should be aware of any policies in place on the SQL server configuration which constrain the number of inbound connections to SQL server and either remove the limit or use "Allow Concurrent Connections=0" to limit the connection to one per service. See [SQL connections](https://help.qtech.co.nz/datran/datran-vi-scada/datran-vi/persistent-queues.md#sql-connections).                                         |

## Trending can't use the new database

If the new database is logging but DATRAN Trending says it isn't a valid DATRAN database:

* If the error appears even after the test connection passes, it is probably because there is a problem with the licensing.
* On Windows 10 machines the license is held under the CURRENT\_USER in the registry so the license has to be reapplied (running the app as administrator) each time someone new logs in.

See also [Trending won't start or says it isn't a valid DATRAN database](https://help.qtech.co.nz/datran/datran-vi-scada/datran-trending/troubleshooting/not-a-valid-database.md).

## Still not working? Contact QTech

Email <techsupport@qtech.co.nz> with the error from DATRAN Diagnostics and what changed. If QTech has its own SQL login for support or custom reports, make sure it was moved to the new instance too.
