# Creating a SQLite Database

1. To create a new (or connect to an existing) SQLite database, in the Project Explorer, right-click on the Databases node and select New Database. This will launch the New Database dialog.

2. Select the directory and enter a name for the database in the Directory and File name fields.

   Note: If connecting to an existing SQLite database, use the browse button beside the File name field to locate a directory other than the default directory for the database. The default directory is located at: C:\Users\<user_name>\Documents\Cognex Designer\Projects\<Project_Name>\Data

3. Check the Enable Unsafe Write (Fast Mode) checkbox to allow the Windows operating system to handle sending data to the database. This mode is similar to an "asynchronous mode" and provides for faster insert and update times. However, this option has the risk of the database being corrupted if the PC running Designer is not shutdown properly.

   Note: For storing critical data, a SQL Server should be used. For more information, see the Connect to a SQL Server Database topic.

4. Once the database has been created, it will be displayed beneath the Databases node in the Project Explorer.

Note: When using a SQLite database, for the best use-case, use Designer to build the SQLite database, and use the other database program to simply view or add indexes to the tables already created in Designer. Another tool, such as a SQLite database browser, can be used to create indexes within the tables. If using another program, ensure that the database file is only open in one program, e.g. the database is not being viewed by a SQLite browser while being edited in Designer. The database may become locked in such a scenario.