Data is usually stored on a server in a database; in order to do this, our Dart app needs a middle layer called a database driver. We'll review which drivers are already available and then see how you can store and access your data on the server with MySQL and MongoDB. These are two of the most popular databases: MySQL is a typical relational database, and MongoDB is a NoSQL database (according to the following link, http://db-engines.com/en/ranking, MySQL is second in popularity after Oracle, and MongoDB occupies the sixth place). The following topics will be covered in this chapter:
todo
data in MySQLmongo_dart
driver to store the todo
data in MongoDBThe amazing Dart community has already provided a whole spectrum of drivers (here P means published in the pub repository, https://pub.dartlang.org/).
For the relational databases, we have:
SQLJocky
(P) by James Ots (https://github.com/jamesots/sqljocky); we will use this driver in the next sectionpostgresql
(P) by Greg Lowe (https://github.com/xxgreg/postgresql)Dart-sqlite
by Sam McCall (https://github.com/sam-mccall/dart-sqlite/)dart-odbc
(P) by Juan Mellado; this allows connections to any database vendor (Oracle, MySQL, PostgreSQL, SQLServer, and so on) with legacy ODBC drivers (http://code.google.com/p/dart-odbc/)For the NoSQL databases, the choice is even greater:
mongo_dart
(P) by Vadim Tsushko, Ted Sander, and Paul Evans (https://github.com/vadimtsushko/mongo_dart); we'll use it in this chapter. Another client by Vadim Tsushko is an object document mapper tool called Objectory
(https://github.com/vadimtsushko/objectory), which can be used on the client as well as the server.couchclient
(P) by Henri Chen from Rikulo (http://rikulo.org). Another driver called wilt
(P) is created by S. Hamblett (https://github.com/shamblett/wilt).redis-dart
by Adam Singer (https://github.com/financeCoding/redis-dart). Another Redis client called DartRedisClient
(P) is created by Dartist (https://github.com/dartist/redis_client).riak-dart
(P) by Istvan Soos and Ian Jones (https://code.google.com/p/riak-dart/).rethinkdb
(P) by Dave Bettin (https://github.com/dbettin/rethinkdb).dart-dirty
(P) by Chris Strom (https://github.com/eee-c/dart-dirty), a dirt simple NoSQL DB that is a persistent, server-side HashMap.There also exists an Object Relational Mapper (ORM) framework:
18.227.26.217