You can help by commenting or suggesting your edit directly into the transcript. We'll review any changes before posting them. All comments are completely anonymous. For any comments that need a reply, consider emailing docs@inductiveautomation.com.
LESSON
SQLite is a light-weight database that's easy to use and simple to connect to. Learn how to make your own SQLite database in this lesson.
Video recorded using: Ignition 8.3
[00:00] In this lesson, we'll learn how to create a SQLlite database connection. This option is embedded in Ignition with pre-installed drivers, so we can get started without any external configuration. From the homepage let's navigate to the connections tab and then the connections page under databases, and we'll click on the create database connection button. We'll scroll all the way down and choose the SQLite driver and click on next. Let's give this connection a name and I'll call this SQLite. Now, SQLite doesn't require any authentication, so we can leave the username and password here alone, but we do need to mark the password with the none option to complete this wizard. Do be mindful of storing sensitive information in these connections. Let's scroll down to an important property, which is this Connect URL. Unlike other connection types, we simply need to provide a file path to either an existing SQLite database file or a path where one does not exist, which will cause this connection to create the database for us.
[01:05] I'll go ahead and paste in this path to a directory on my device, right where we see this example text following SQLite and the colon. Since I'm on a windows device, back slashes are used between folders and files, but the driver would work here with forward slashes as well. We do need to point this URL to a file, so I'm going to add a backslash and then type in the name of the file I want to create. So how about test dot DB. Before we create the connection I did wanna point out that you can make use of these data or local placeholders to point to the gateway's data or local directory. Do keep in mind that any SQLite files created in the local directory will not be included in gateway backups. So once you have the correct file location in the connect URL, that's all that is required in this configuration. And we can now click on the create database connection button and we should see our new SQLite entry with a valid status. Let's try this one more time and click on the creation button and choose the SQL light option again and click next.
[02:04] You may have noticed in these examples under the connect URL that there's this memory option, and this lets us create the database within the gateway's memory so we can remove the example text and type out a colon and then memory, and then another colon to match the example below. Now, as you've probably guessed, creating a database that sits in memory means that every time you restart or shut down the gateway, all of the entries inside of the database will be gone. So you'd really only want to use this in memory option for temporary storage. Let's finish our configuration by giving this a name. Let's call this in memory, and we'll choose the none option for our password and create the connection. So it's possible to create a SQLite connection both in a file system and in memory, or whatever small scale storage needs you have. SQLite isn't really designed to compete with client server style databases. It's used in smaller scale interactions and applications like working on a demonstration or a proof of concept. It's great for storing non-production data like user preferences or configurations made during runtime.
[03:06] Say you have an application where users can enter in values and you need to store those temporarily. Instead of writing those values into tags, you can insert those values into a table that's sitting in an SQLite database. For the historian needs in a production environment, we would certainly advise to use the built in core historian or a client server database rather than