Migrate SQLite to MySQL

I’m developing a huge app made with Xamarin Forms in my company. A problem was to create all tables in the device with SQLite to the main database MySql.

SQLLite-To-MySql-1

I found a way to create all tables quickly with a tool called SQLite to MySQL.

SQLite-to-MySQL is a powerful and reliable tool to convert SQLite databases to MySQL, MariaDB or Percona format. The program has high performance due to direct connection to source and destination databases (it does not use ODBC or any other middleware software). Command line support allows to script, automate and schedule the conversion process.

SQLLite-To-MySql-2

SQLLite-To-MySql-3

Features

  • All versions of Linux/Unix and Windows MySQL servers are supported
  • Option to customize resulting table structure
  • Convert indexes and relationships between tables
  • Stores conversion settings into profile
  • Option to filter data using SELECT-queries
  • Option to merge SQLite data into an existing MySQL database
  • Option to synchronize MySQL database with SQLite data
  • Support for multibyte character sets
  • Option to export SQLite database into MySQL script file
  • Verified compatibility with MariaDB and Percona
  • Option to customize MySQL storage engine and MySQL charset
  • Special approach for Virtual Server users
  • Command line support
  • Easy-to-use wizard-style interface
  • Full install/uninstall support
  • Unlimited 24/7 support service
  • 1-year subscription for updates
    SQLLite-To-MySql-7

Click here to download and try it.

Using SQLite in Windows 10 Universal apps

Using SQLite in Windows 10 Universal apps is really easy even in this preview phase. Even though Entity Framework 7 support for Windows 10 Universal apps is almost here, you still might decide to just continue using a lighter SQLite.Net-PCL library that you're used to since Windows Phone 8/WinRT.

If you are using Visual Studio 2015 RTM and 10240 SDK, there's now the official (no more pre-release stuff) SQLite VSIX package that you can download from SQLite.org. Search for "Universal App Platform" and you're good to go! The rest of the blog post should apply to this version as well.

sqlite-latest_wcqqnu

The next step is to add the SQLite.Net-PCL library that I already mentioned. Use the (redesigned) NuGet to do that.

sqlite_uap_2

It will add two references

  • SQLite.Net
  • SQLite.Net.Platform.WinRT

Now, remember the VSIX package (Visual Studio extension) installed earlier? It installs SQLite extensions that you need to reference by simply right-clicking on References and choosing "Add Reference..." and then finding the right reference under Windows Universal -> Extensions.

sqlite-latest-extension

And that's it! You can start using SQLite!

To test it, I defined a simple model class called User.

public class User  
{
    public int Id { get; set; }
    public string Name { get; set; }
}

And then I created a table which will hold User entities.

var path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "db.sqlite");
 
using (SQLite.Net.SQLiteConnection conn = 
       new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path))  
{
    conn.CreateTable<user>();
}

Adding SQLite support to Windows 10 Universal apps is really simple! After all of the extensions are added, and the ORM/client library fetched over NuGet, the usage is the same as before. This is really neat for simpler scenarios and until Entity Framework 7 officially, fully supports Windows 10 Universal apps.

Advertsing

125X125_06

TagCloud

MonthList

CommentList