This is the third article in a series that discusses creating a new database connection to the Sage X3 database using the standard Sage CRM features.

I discussed in the previous article "Extending the Sage X3 Integration (Part 2)"  how Sage X3 tables or views can be modelled in Sage CRM in order to create the Lists and Screens that we need to display data not otherwise available to the standard Sage X3 integration.

The first thing that has to be done is to define the connection to the database in the administration screens.

Administration -> Advanced Customisation -> Tables and Databases

To create a new connection click on the button "New Database Connection".

You will need to specify the address of the Sage X3 database server, the port that it is running on and the name of the database to which you are connecting. The description defines how the database will be known in Sage CRM.

You have to connect using SQL Authentication. You can use any login that has rights over the target database; you do not have to use the 'sa' username.

Once the definition is saved the database connection is shown in the list of external database tables.

The definition of the database connection is held in the metadata table custom_databases.

[code language="sql"]
select * from custom_databases;

This will list the database definition within Microsoft SQL Server Management Studio

The next article will describe how to connect to a database table or view and some of the things that must be considered.

Creating a new database connection to Sage X3