Learn how to connect Ignition to a MySQL database from the Config section in the Gateway.

Video recorded using: Ignition 7.9


(open in window)

[00:00] In this lesson, we'll take a look at how to connect Ignition to MySql. I'm going to start off in the gateway, I'm in the Configure section, I'll scroll down just a little bit. You can see under the Databases section, I have the Connections page up. Now, I currently don't have any database connections configured at all, so we can change that by clicking on this Create New Database Connection link. I'm going to scroll down a little bit. You can see all of the available JDBC Drivers that are included with Ignition. These basically tell Ignition how to run queries against the database. Since we're focusing on MySql, I'm going to use the MySQL ConnectorJ driver here, I'll select that and I'll click the Next button. Now, let's give this new database connection a name. I'm going to change this to MySql, but use whatever feels appropriate. And I'm going to scroll down just a little bit here, I want to take a look at the Connect URL property. You can see the description on this property gives you little hints as to what you need to enter here. Just to give you a quick overview, I need to enter the IP address or host name of the database server. In my case, MySql and Ignition are on the same server, so I can leave this parameter set to Local Host. Port 3306 is the default port that MySql runs on. If you change that port number during the MySql installation process, or later on, then you can leave this parameter with the default value. And last we need to specify which schema, inside of MySql, should Ignition attempt to connect to. If you followed the example in our Installing MySql video, then you already have a schema named Test in the database. For this connection, I don't make any changes to the URL. So, let's scroll down a little bit further here. And I need to provide Ignition with a username and password to use to connect to MySql. In my case, I'm going to use the Root user, so I'll type that user's password. Just as a reminder, the Root user's password was configured during the MySql installation process. Now, while I'm using Root, if you or your database admin already created user credentials for Ignition to use, then, of course, you'll want to enter those here instead. Now, if we scroll down a little bit further here, we can see, towards the bottom of this page, that there's this Create New Database Connection button. Technically, this is all I have to do to create the connection. Now, while I could stop here, let's take a look at some advanced properties real quick. I'll enable this Show Advanced Properties checkbox, and let's scroll down to the Collection Pooling section over here. I want to point out the Max Active and Max Idle properties over here. Both of them have a default value of eight. This one database connection we're creating can have multiple requests or queries running against the database, at any given time. These requests are called Poolable Connections. So, at any given time, I can have eight maximum poolable connections waiting for requests to come in. And a maximum of eight queries running against the database. In most scenarios, eight should be enough, but in larger systems, you may need to double or even triple these values. Now, I'm not going to make a change to these, I just wanted to point them out. So, I'm going to scroll back on towards the top here. I'm going to uncheck that Show Advanced Properties and click the Create New Database Connection button. And you can see my status is now showing valid. And that's it, we're connected. Now, if your status shows faulted for any reason, there is this little Database Connection Status link over here, it'll take you to the Status section of the gateway and, from there, you can start to look for errors and see why the connection might have failed.

You are editing this transcript.

Make any corrections to improve this transcript. We'll review any changes before posting them.