Tip: Create an Own SQLite Package to Use it with UiPath

At the Advent Challenge 2020 I took a deeper look at SQLite:

SQLite is an industry standard. It can only be a benefit to use these in the context of UiPath.

To use SQLite it is necessary to create your own SQLite package. Download the binary package with the mixed-mode assembly that contains all the binaries of System.Data.SQLite for the x64 version (64-bit) and for the x86 version (32-bit). With this assemblies you have no dependencies, only to dotNET framework 4.6, which is also a prerequisite for UiPath.

You can use this NuGet specification (nuspec) to create your own package:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
  <metadata>
    <id>System.Data.SQLite</id>
    <version>1.0.114.0</version>
    <title>SQLite</title>
    <authors>SQLite.org</authors>
    <owners>SQLite.org</owners>
    <requireLicenseAcceptance>true</requireLicenseAcceptance>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <iconUrl>file://sqlite.jpg</iconUrl>
    <projectUrl>https://www.sqlite.org/</projectUrl>
    <description>SQLite is a library that implements a small, fast, self-contained, high-reliability, full-featured, SQL database engine.</description>
    <copyright>SQLite.org</copyright>
    <language>en-US</language>
    <tags>sqlite sql database</tags>
  </metadata>
  <files>
    <file src="sqlite.jpg" target="\"></file>
    <file src="x86\System.Data.SQLite.dll" target="\runtimes\win-x86\lib\net46"></file>
    <file src="x64\System.Data.SQLite.dll" target="\runtimes\win-x64\lib\net46"></file>
  </files>
</package>

Build the package with NuGet CLI with the command
nuget pack System.Data.SQLite.nuspec

This package contains the x86 and x64 version of SQLite, so you are prepared for both architectures.

Now it is possible to the SQLite package to your UiPath project.

image

With a tiny Invoke Code activity we can check now the version:

string ConStr = "Data Source=:memory:";
string Com = "SELECT SQLITE_VERSION()";

SQLiteConnection Con = new SQLiteConnection(ConStr);
Con.Open();

SQLiteCommand Cmd = new SQLiteCommand(Com, Con);
string Version = Cmd.ExecuteScalar().ToString();

Con.Close();

Console.WriteLine("SQLite version: " + Version);

image

Conclusion

Knowing how to create an own NuGet package for SQLite is very important because SQLite’s update cycles are relatively short. This type of approach also gives us independence from other package providers. So we can design the package as it suits our individual needs. The advantages of SQLite are, besides their wide frequency of use, the possible persistence of data and SQL statements, which are a standard in business, e.g. every ABAP programmer in SAP environments will immediately understand.

4 Likes