Connections
A connection is the database user your reports read data with. Every query you write in the SQL editor, and every query of your datasets and charts, runs as this user. Only you see and use your connections.
Getting a database user
Section titled “Getting a database user”The Defthand team gives you the database user’s name and password. The user can only read, and it sees only your company’s report views. You are not asked for a server or database name; Defthand knows them.
When you ask for the user, say which topics you want to report on (forms, organization, locations, inspections, training). The user reads only the views it is allowed to.
Reports → Connections. The page opens with the title Database connections and shows how many connections you have. Each connection card shows:
- the connection’s name and status,
- User: the database user’s name,
- Last checked: the time (or Never checked),
- the buttons Check, Readiness report, Open in the SQL editor, Edit and Delete.
Statuses:
| Status | Meaning |
|---|---|
| Ready | It passed every check; queries can run. |
| Not checked | It has not been checked yet. |
| Unusable | It failed a check; no query can run. |
If you have no connections yet, the page says No connections yet.
Adding a connection
Section titled “Adding a connection”- Click New connection. The dialog says “The connection is checked as soon as you save it.”
- Fill in the fields:
| Field | What to enter | Rule |
|---|---|---|
| Name | A name you will recognise, e.g. “Field reports”. | Required, at most 100 characters. You cannot have two connections with the same name. |
| Database user | The name the Defthand team gave you, e.g. rpt_ayse. |
Starts with a lower-case letter or an underscore; only a-z, 0-9, _ and $; at most 63 characters. |
| Password | The password you were given. | Required, at most 256 characters. Stored encrypted and never shown again. |
- Click Save. The connection is saved and checked at once:
- If it passes: “The connection is saved and ready.”
- If not: “The connection is saved but did not pass its readiness check. Read the report.”
Checking and the readiness report
Section titled “Checking and the readiness report”Check checks the connection again. The result is either “The connection is ready: it passed every check.” or “The connection did not pass its readiness check. Read the report.”
Readiness report shows each check as Passed, Failed or Not tried:
| Check | What is looked at |
|---|---|
| The password is right and the user can log in | The user name and password. |
| The database can be reached | Whether the database answers. |
| Not a superuser | The user has no extraordinary rights. |
| Does not bypass row security | The user sees only your company’s rows. |
| No admin rights | It cannot create databases or roles, or read or write everything. |
| Only reads | It cannot write a table or create objects. |
| Cannot create temporary tables | — |
| Reads only the report views | It cannot reach other data. |
| Mapped to this company | The user belongs to your company. |
A connection is used only when it passes every check; there is no way to override this. The Defthand team fixes a failed check by changing the user’s rights. If the password or login check fails, check the password and enter it again.
Common messages:
- “The password is wrong or the user cannot log in.”
- “The database could not be reached.”
- “The stored password cannot be opened (its key changed). Edit the connection and enter the password again.”
Editing
Section titled “Editing”- Click Edit. The Edit connection dialog opens.
- Change the name, the user or the password. Leave Password empty to keep the stored password.
- Save. If the user or the password changed, the connection is checked again.
Deleting
Section titled “Deleting”- Click Delete. The Delete connection dialog says “The connection “…” will be deleted. It cannot be deleted while a dataset uses it.”
- Confirm. The message “Connection deleted.” appears.
If datasets use the connection, the message “3 datasets use this connection. Delete them first.” appears. The Datasets of this connection link opens the dataset list filtered to that connection.
Next step: SQL editor.