= Examples: FirstStepWithMySQL = Simulates a very simple URL tagging application a la [http://delicious.com/ delicious.com], which allows users to tag any URL on the internet with one or more tags/labels. See also [wiki:Examples/FirstStep FirstStep], which does the same thing in memory. == Obtain, compile and run == 1. Download FirstStepWithMySQL from the [wiki:Docs/Downloads downloads page], and uncompress ([wiki:Docs/TardBzipd instructions]) 2. Run ant to compile and run, e.g. `ant build run` 3. Two apps will run: * The first app instantiates some objects representing bookmarks and tags in a graph, which is persisted in MySQL, using it as a key-value store. * The second app reads the graph from the database and traverses the graph to print out the data in different ways == Annotated source code == Compare with [wiki:Examples/FirstStep FirstStep], which keeps the object graph in memory only. The key difference are the following lines: Instead of creating a MeshBase in memory: {{{ MeshBase mb = MMeshBase.create(); }}} we are creating a MeshBase using the [wiki:Store] abstraction: {{{ MeshBase mb = StoreMeshBase.create( store ); }}} where `Store` could be any kind of store supporting [wiki:Store] abstraction. In this example, we use MySQL because many developers are familiar with it and !InfoGrid contains a MySQL-based implementation of [wiki:Store] called `MySqlStore`. We instantiate it as follows: {{{ MysqlDataSource ds = new MysqlDataSource(); ds.setDatabaseName( "test" ); // name of the database MysqlStore store = MysqlStore.create( ds, "test" ); // name of the single table used in this example app store.initializeIfNecessary(); // will create table if not there, but does not touch data }}} To run the same example using PostgreSQL? Simply instantiate `PostgresqlStore` instead. Or `FilesystemStore` or `HadoopStore`... Easy? Take the [http://www.surveymonkey.com/s/Z3Q2CJP 1-minute survey]. Feel free to ask questions on the MailingLists ...