Applies To:
  • CitectSCADA/CitectHMI 5.xx, 6.xx, 7.xx 
  • VijeoCitect 6.10, 7.xx

I am trying to log alarms to an SQL server using ODBC. When I use Windows Authentication, it connects correctly to the SQL Server, but does not connect when I try to use the SQL Server Authentication. I have input my SQL user ID and password into the DSN configuration in Windows.


The Windows DSN configuration does not store the password in the password box after the initial connection, and must be input on each connection. The definition of the password box from the Microsoft website is shown below: 

"Password box: Specifies the password the SQL Server uses when connecting to SQL Server if With SQL Server authentication using a login ID and password entered by the user is selected. This only applies to the connection made to determine the server default settings; it does not apply to subsequent connections made using the new data source"

To set-up the Citect connection to the SQL Server using SQL Server Authentication, you will need to add the username and password into the header field of the device. this header field represents the connection string. An example is shown below:

"DSN=myDSN; Uid=myUid; pwd=myPwd;"  





Other tips for connecting to SQL Server:
When creating the DSN in Windows Admin Tools, for SQL 2008 Express:
In the ODBC Data Source Administrator, when adding a new DSN
-Scroll through the list of drivers and select SQL Server.
-click Finish.
-Enter the
    * Name: enter the name for the DSN
    * Description: enter a description for the DSN (Optional)
    * Server: enter the IP address of your server, followed by \SQLEXPRESS eg localhost\SQLEXPRESS
-click Next x 2
-at this point, if it makes the connection you can "Change the default database" as needed.

You will need to enable remote connections
: open the SQL Server Configuration Manager. Click Start -> Programs -> Microsoft SQL Server 2008 -> Configuration Tools -> SQL Server Configuration Manager. Select Items:
-SQL Server Services -ensure the SQL Service is running. On SQL Server Browser Properties, move to Service tab and change Start Mode to Automatic.
-SQL Server Network Configuration -> SQL Native Client 10.0 Configuration -> -in Protocols for SQLEXPRESS - ensure TCP/IP is ENABLED.

Set user permissions:
in SQL Server Management Studio, log in as "sa"
right click the SQLEXPRESS root object, select Properties, in Connections select Allow remote connections to this server.
right click the SQLEXPRESS root object, select Properties, in Permissions, double click the user and Grant Connect SQL, and other permissions as needed.

Set security for the user:
in SQL Server Management Studio, select Security -> Logins, double click the user. Select Server Roles and User Mapping. Grant access as needed. In User Mapping, beware of the db_denydatareader and db_denydatawriter checkboxes.






 SQL Server authentication,DSN, Windows Authentication, SQL