Upload
duongkhanh
View
236
Download
2
Embed Size (px)
Citation preview
24/08/2011 Connecting to SQL server 1/17
Micromedia International
Technical study
Author: Pierre Chevrier
Company: Micromedia International
Date: 24/08/2011
Number of pages: 17
Connecting to SQL server
Réf. : ETT_20110624_000001.docx
This document specifies how to connect ALERT to SQL server via ODBC or OLEBD
Distribution TO CC Company
Attachments:
24/08/2011 Connecting to SQL server 3/17
Summary Introduction ............................................................................................................................................. 4
Configuration SQL Server ........................................................................................................................ 4
Windows Authentification .................................................................................................................. 6
SQL Authentification ........................................................................................................................... 7
Alert side configuration ......................................................................................................................... 11
OLEDB connection, export database ................................................................................................ 12
ODBC connection, message processor............................................................................................. 12
24/08/2011 Connecting to SQL server 4/17
Introduction
Connecting Alert to an SQL database is used to export databases or from a message
processor.
It is therefore necessary to perform configurations on the machine where Alert is
installed and on SQL server. To simplify the configuration, it is advisable to use a UDL file to test the
connection. Once the connection is made via the UDL, the link from Alert is carefree.
Configuration SQL Server
Access to SQL Server is done either with Windows authentication, or SQL authentication.
For a local connection, connection protocols are configured by default. However, for a remote
connection, you must enable IP connections. To do this, you will use the tool “SQL Server
Configuration Manager“.
We will enable the protocols of the IP connections.
First, enable the TCP/IP connection of “SQL Server Network” as follows.
Then, one must specify properties for ports. Double click on “TCP/IP“.
Ensure that the configuration is similar to the following captures:
24/08/2011 Connecting to SQL server 5/17
We are only interested in the properties of ”IP All".
One must then change the properties of "Clients Protocols". The following screenshots show the
system requirements: "TCP / IP" must be enabled and must be the first in the order of the protocols.
To do this, it may be necessary to disable the "Shared Memory".
24/08/2011 Connecting to SQL server 6/17
Following these changes, it is necessary to restart the SQL Server service:
A reboot can also be useful if the connections are always rejected after these changes.
Now that remote connections are set up, the authentications need to de defined.
Windows Authentification Connecting via Windows authentication is preferred if Alert and SQL server are on the same machine.
For a remote installation, make sure that the access right of the operator who is owner of the Alert
task allows a connection to SQL Server.
24/08/2011 Connecting to SQL server 7/17
SQL Authentification SQL Server options should allow connection via SQL Server Authentication. To access the connection
properties, check the SQL server options with the tool "SQL Server Management Studio".
For general properties: Right click the root of SQL Server.
The options of interest are in "security."
24/08/2011 Connecting to SQL server 8/17
Check that the authentication mode accepts the SQL Server Authentication.
Furthermore, if the connection is made from a remote station, it must be allowed. To do this,
validate the permission to remote connection in the "connections" page.
Once the global parameters are defined, we need to define the connection login.
The login used for connection must be added to the list of logins.
24/08/2011 Connecting to SQL server 9/17
In the following screenshot, we have a login "Alert" that has access to a database "Alert" by default.
In this example, the password policy has not been strengthened.
The operator must have read/write access to the database (here Alert), as shown in the following
screenshot.
24/08/2011 Connecting to SQL server 10/17
Finally, the login must be enabled and have access to the database engine.
SQL Server is thus properly configured. Now for the client configuration.
24/08/2011 Connecting to SQL server 11/17
Alert side configuration To perform this configuration, we will use a UDL file. This way, the connection can be tested
independently of Alert.
We will create a UDL file with two types of connections:
- Connection for the export database of Alert (OLEDB)
- Connection for the message processor (ODBC)
To create a UDL, right-click, new text file and rename it ".udl".
For our example we will use a file named AlertSql.udl.
Once the file is created, double-click on it. Select the "Supplier" tab. The following window opens:
We will now choose the data provider that will depend on the use of data from Alert.
24/08/2011 Connecting to SQL server 12/17
OLEDB connection, export database The preferred connector is "SQL Native Client." Once this choice is made, validated with "Next>>".
A new configuration box is displayed. We then need to fill in the connection settings, that is to say
the login previously defined: either the SQL login or Windows login.
For our example, the server used is SQLEXPRESS installed on the machine called PORTPC. Note the
syntax of the location of the data source: Name_Machine\sqlexpess for our example.
We use the login information that we have created on the server, ie the login "Alert".
To check whether the connection is valid, click "Test Connection". The result must be positive!
This UDL file will need to be referenced in Alert.
ODBC connection, message processor The connector to be chosen for an ODBC connection is "Microsoft OLE DB Provider for ODBC
Drivers". We will then use a connection string that will be the information to inform for the message
processor connections.
Here we describe the configuration of the connection string from scratch. If an ODBC data source for
the desired server is already configured, create the connection string will be simpler.
24/08/2011 Connecting to SQL server 13/17
After validating the supplier, the following screen appears:
Select "Use connection string" and click on "Create ...".
Then select the tab "Machine Data Source".
No source corresponds to our server; we will create a new data source machine. To do this, click on
"New ...".
24/08/2011 Connecting to SQL server 14/17
The following wizard appears:
Select "System data source" and “Next >”. Then select "SQL Server":
Validate with “Next >”, then “Finish”.
24/08/2011 Connecting to SQL server 15/17
Finally, we must give a name to the data source (here AlertSQLServer) and enter the SQL server
name, in our example portpc\ sqlexpress.
Validate with “Finish”.
The new data source has been added to the list of data sources machines. Just select it.
24/08/2011 Connecting to SQL server 16/17
And press ”OK”.
To complete the connection string, enter the login and password to connect to SQL server.
For our example, the login defined on the SQL Server is "Alert".