Connecting to Microsoft SQL Server Express
To connect Ignition to Microsoft SQL Server
-
From the Gateway, go to the Configure section.
-
From the menu on the left, select Databases > Connections.
The Database Connections page is displayed. -
Look for the orange arrow, click on Create new Database Connection....
-
Select Microsoft SQLServer JDBC Driver and click Next.
The New Database Connection page is displayed.
-
On the New Database Connection page, enter the following information:
Name: SQLServer
Connect URL: jdbc:sqlserver://localhost\SQLEXPRESS
Note: We are connecting to the express edition of SQL Server using the default instance name. If you have the full SQL Server with default settings, replace SQLEXPRESS with MSSQLSERVER.
username: sa
password: sqlserver (password is what you entered during the SQL Server installation. For this example, password is sqlserver) -
At the bottom of the form, click on Create New Database Connection.
Your connection is now created and the Database Connections page is displayed showing the Status of your connection as Valid. -
To display the details about the status of your database connection, see the Note on the above window and click on the Database Connection Status link.
Microsoft SQL Server Connection Guide
This guide helps you with any difficulties you may have in getting the correct settings and parameters when connecting Ignition to Microsoft SQL Server, a popular and robust relational database.
Multiple Instances of Database
Microsoft SQL Server supports multiple instances of the database running concurrently on the same computer. Each instance has its own name and set of system and user databases that are not shared between instances.
Applications, such as Ignition, can connect to each instance on a computer in much the same way they connect to databases running on different computers.
By default, each instance gets assigned a dynamic TCP/IP port on startup that listens for any incoming requests. Since the port is dynamic and the application does not know what the new port is, it must connect using the instance name.
So if the communication is over TCP/IP and the application knows the instance name, how does the application find which port to communicate to? The answer is the Microsoft SQL Server Browser service. The Microsoft SQL Server Browser program runs as a Windows service and listens for all incoming requests for resources and provides information, such as the TCP/IP port, about each instance installed on the computer. Microsoft SQL Server Browser also contributes to these two actions: browsing a list of available servers and connecting to the correct server instance.
If the Microsoft SQL Server Browser service is not running, you can still connect to SQL Server if you provide the correct port number. For example, you can connect to the default instance of SQL Server with TCP/IP if it is running on port 1433.
Check 1: Make Sure the Database has TCP/IP is Enabled
Ignition connects using TCP/IP, therefore make sure your database has TCP/IP enabled.
To check if TCP/IP is enabled
-
Open the SQL Server Configuration Manager from Start > All Programs > Microsoft SQL Server Version # > Configuration Tools > SQL Server Configuration Manager
The Sql Server Configuration Manager window is displayed. -
To see all the instances setup on that machine, expand SQL Server Network Configuration.
-
Find the database (or instance) you plan on using. To the right, all of the protocols the database supports are shown. Find the TCP/IP protocol and select it.
-
Make sure the Status next to TCP/IP is Enabled. If not, double-click TCP/IP and choose Yes from the drop-down next to Enabled and click OK.
Check 2: Make Sure Microsoft SQL Server Browser is Running
If you ARE connecting to your database using a NAMED INSTANCE, you must make sure that the Microsoft SQL Server Browser is running. As mentioned earlier, the Microsoft SQL Server Browser translates the instance name to a TCP/IP port in order for Ignition to connect to it.
To check if Microsoft SQL Server Browser is running
-
Open the SQL Server Configuration Manager from Start > All Programs > Microsoft SQL Server Version # > Configuration Tools > SQL Server Configuration Manager
-
Select the SQL Server Services section.
-
On the right, see all of the services installed. One of the services is SQL Server Browser. Make sure this service is in fact running. If the service is not running, right-click and select Start.
Note: The service could be disabled, so you may need to double-click it to enable the service before starting it up.
Different Ways of Connecting to SQL Server
Now that you have ensured that TCP/IP is enables and the Microsoft SQL Server Browser is running, you can connect to Microsoft SQL Server in four different ways (all using TCP/IP communication) as follows:
-
Connect using an Instance Name and SQL Authentication
-
Connect using an Instance Name and Windows Authentication (this is the most common method)
-
Connect using a Port and SQL Authentication
-
Connect using a Port and Windows Authentication
Scenario 2: Connect By Using Instance Name and Windows Authentication
In Windows authentication mode, the username and password used to connect comes from the Ignition Windows Service logon. By default, the Ignition Windows Service is set to local system account which usually doesn't have privileges to connect.
To set up the service to use Windows Authentication
-
You must install the Microsoft JDBC driver package (version 3) before attempting to connect using Windows Authentication. You can download the file here.
-
Extract the files to your desktop. Locate the sqljdbc_auth.dll file from the correct architecture folder (x86 for 32-bit and x64 for 64-bit) inside of the enu/auth folders in the zip file.
-
Copy the sqljdbc_auth.dll file to the lib folder in your install directory. If you have the default install directory, it's in the following location:
C:\Program Files\Inductive Automation\Ignition\lib\ -
The account used to connect will be the account that Ignition is running under in the services menu. To setup Ignition to logon using the right Windows account, open the Services Control Panel from Start > Control Panel > Administrative Tools > Services
-
Right-click the Ignition service and choose Properties.
-
Select the Log On tab.
-
Choose the This account radio button and enter in your Windows username and password.
-
Click OK to save.
-
Now restart the Ignition service to make this change take effect. Click the Action > Restart button in the menubar to restart the Ignition service (or your can stop and start from the right-click menu).
To configure the database connection in Ignition
-
Go to and login to the Ignition Gateway configuration page from your webbrowser at http://hostname:8088/main/web/config/
-
Select Databases > Connections from the menu.
-
Click on Create new Database Connection.
-
Select Microsoft SQL Server JDBC Driver and click Next.
-
On the New Database Connection page, enter the following information:
Name: SQLServer_WinAuth (no spaces)
Connect URL: jdbc:sqlserver://Hostname\InstanceName
where Hostname is your databases IP address or hostname and InstanceName is your databases instance name, for example:
jdbc:sqlserver://localhost\SQLEXPRESS
jdbc:sqlserver://10.10.1.5\MSSQLSERVER
username: leave blank
password: leave blank
Extra Connection Properties:
databaseName=test; integratedSecurity=true; (replace test with your database name) -
Click on Create New Database Connection.
The Status should be Valid after a couple of seconds. Again, if the connection is Faulted, click the Database Connection Status link to find out why.
Scenario 3: Connect By Using Port and SQL Authentication
Connecting by using a port and SQL authentication is just like scenario 1 above except you specify a port instead of the instance name in the New Database Connection page.
Enter the following:
Connect URL: jdbc:sqlserver://Hostname:Port
where Hostname is your databases IP address or hostname and Port is your databases TCP/IP port (SQLSERVER default port is 1433), for example:
jdbc:sqlserver://localhost:1433
jdbc:sqlserver://10.10.1.5:1433
Scenario 4: Connect By Using Port and Windows Authentication
Connecting by using a port and Windows authentication is just like scenario 2 above except you specify a port instead of the instance name in the New Database Connection page.
Enter the following:
Connect URL: jdbc:sqlserver://Hostname:Port
where Hostname is your databases IP address or hostname and Port is your databases TCP/IP port (SQLSERVER default port is 1433), for example:
jdbc:sqlserver://localhost:1433
jdbc:sqlserver://10.10.1.5:1433
Troubleshooting
TCP/IP Communication Not Enabled
SQL Server requires that you explicitly turn on TCP connectivity. To do this, use the SQL Server Configuration Manager, located in the Start menu under Microsoft SQL Server > Configuration Tools. Under SQL Server Network Configuration, select your instance, and then enable TCP/IP in the panel to the right. You need to restart the server for the change to take affect.
Window Firewall
When connecting remotely, make sure that Windows Firewall is disabled, or set up to allow the necessary ports. Normally ports 1434 and 1433 must be open for TCP traffic, but other ports may be required based on configuration.
SQL Server Browser Process Not Running
To connect to a named instance, the SQL Server Browser service must be running. It is occasionally disabled by default, so you need to verify that the service is not only running, but set to
start automatically on bootup. The service can be found in the Windows Service Manager (Control Panel > Administrative Tools > Services).
Mixed Mode Authentication Not Enabled
Unless selected during setup, mixed mode or SQL authentication is not enabled by default. This mode of authentication is the username/password scheme that most users are used to. When not enabled, SQL Server only allows connections using Windows Authentication. Due to the ease of using SQL Authentication over Windows Authentication, we recommend enabling this option and defining a user account for Ignition.
To enable this, open the SQL Server Management Studio and connect to the server. Right click on the instance and select Properties. Under Security, select SQL Sever and Windows
Authentication mode.