Data sources and queries


  1. Presentation
    1. Connection to Data Sources
      1. Connection LDAP
      2. Connection SQL
    2. Create a query LDAP or SQL
      1. Request LDAP
      2. Request SQL

Presentation

The Data Sources tool enables users with appropriate rights (usually a webmaster or administrator) to manage connections to SQL databases or LDAP directories. These users can then define queries associated with one of these sources to obtain specific information that contributors can insert into the rich text fields of content.

Warning
Queries must be written using the syntax SQL or LDAP syntax (depending on the associated data source); knowledge of these areas is required to be able to create queries.

Examples of feasible queries:

  • Get a list of teachers and their contacts
  • Obtain a list of personnel in service
  • Get the secretariat's telephone number

This page describes how to create and parameterize data sources. To find out how to use these queries in rich-text content fields, see the page on inserting queries.

Connection to Data Sources

plugin provides a Data Sources tool located in the Back-Office admin, which allows you to define connections to SQL or LDAP.

Click on the Data sources button in the Administration tab to open the tool.

The tool opens and displays existing connections. 

It takes the form of an accordion, and you can click on the icon to open it.  or  to display, or retract, existing connections SQL or LDAP.

From this tool, you can create, modify or delete LDAP or SQL connections.

Connection LDAP

To create a new data source LDAP, click on the New directory button LDAP.

A dialog box opens, prompting you to enter the following parameters:

Field

 Description

 Mandatory

Name

Data source name

Yes

Description

Connection source description

No

Url

Url server LDAP

Yes

Secure connection

Check the box if you wish to use the 'LDAPS' protocol rather than 'LDAP' to establish the directory connection.

No

Basic DN

Basic DN for directory access

No

Dereferencing aliases

Set the dereference mode for alias entries:
- Always: always dereference aliases

- During resolution: dereference aliases only during name resolution.

- After resolution: dereference aliases only after name resolution.

No

Follow references

Check this option to track references in search results (mainly for dynamic LDAP groups).

No

Authorize sorting

Check this parameter if you want results to be sorted by the server LDAP. Uncheck this option if sorted searches are too slow.

No

Authentication method 

Select the type of authentication used between the application and the LDAP directory, anonymous or simple.

No

Private source

Check this box if you want this data source to be private. It will only be visible in the administrator area if this is the case.

No

Connection SQL

To create a new data source SQL, click on the New database button SQL.

A dialog box opens, prompting you to enter the following parameters:

Field

 Description

 Mandatory

Name

Data source name. It is displayed when a data source is requested.

Yes

Description

Data source description

No

Database type

Choose the type of database to connect to:

- MySQL 

- Derby 

- Oracle 

- PostGreSQL

- or HSQLDB

Yes

Url

Url connection to the database server

Yes

User

Enter the user ID to be used when connecting to the database server 

No

Password

Enter the password associated with the database user

No

Create a query LDAP or SQL

plugin provides the Data Sources tool located in the back-office to allow you to query data sources LDAP or SQL.

Click on the Data sources button in the Home tab to open the tool.

The tool takes the form of a tree with existing connections and queries.

From this tool, you can create, modify or delete LDAP or SQL queries.

Request LDAP

To add a query LDAP, select a data source LDAP then click on the New query button.

A dialog box opens, prompting you to enter the following parameters:

Field

 Description

 Mandatory

Data source

Select the data source used by the query 

Yes 

Name

Query name

Yes

Description

Enter a description for this query

No

Result type

Choose the type of result you want:

- Simple, if the query only returns a simple value to be inserted into a text (a person's name, for example)

or

- Multiple, if the query returns a list of results, which can be displayed in tabular form.

Yes

Research DN

Name of context or object to be searched (for example: ou=people)

No

Search type

Select the type of directory search you require LDAP :

- Object 

- One level

- or Sub tree

Yes

Returned attributes

The list of returned LDAP attributes and their labels, separated by commas (for example: sn[lastname], givenName[firstname], mail

Yes

Constraints

The parameters are entered when the query is inserted into the content.

- Non-configurable constraint: (mail=*.com)

- Contrainte configurable, les paramètres commencent par le signe '$' suivi d'un jeu d'accolades : (uid = ${uid})

No

Request SQL

To add a query SQL, select a data source SQL then click on the New query button.

A dialog box opens, prompting you to enter the following parameters:

Field

 Description

 Mandatory

Data source

Select the data source used by the query 

 Yes

Name

Query name

Yes

Description

Enter a description for this query

No

Result type

Choose the type of result you want:

- Simple, if the query only returns a simple value to be inserted into a text (a person's name, for example)

or

- Multiple, if the query returns a list of results, which can be displayed in tabular form.

Yes

Request

The parameters are entered when the query is inserted into the content.

- Non-configurable constraint: SELECT firstname AS 'Firstname', lastname AS 'LastName', mail AS 'E-Mail address', service FROM Staff

- Contrainte configurable, les paramètres commencent par le signe '$' suivi d'un jeu d'accolades : SELECT firstname AS 'Firstname', lastname AS 'LastName', mail AS 'E-Mail address' FROM Staff WHERE service=${service}

No

Back to top