Using Xeround
Xeround is a scalable and highly-available database-as-a-service
for MySQL applications. To use Xeround on AppHarbor, add the add-on
to your application. You can the fetch the connection url from the
<appSettings/>
element in your application
configuration file. The setting is called
[XEROUND_DATABASE_URL]
. Parse the url to generate a
connectionstring like this:
var uriString = ConfigurationManager.AppSettings["XEROUND_DATABASE_INTERNAL_URL"];
var uri = new Uri(uriString);
var connectionString = string.Format("Server={0};Port={1};Database={2};User Id={3};Password={4};",
uri.Host, uri.Port, uri.AbsolutePath.Trim('/'), uri.UserInfo.Split(':').First(),
uri.UserInfo.Split(':').Last());
Note that it might take a minute or two from the time you provision the add-on, for you Xeround database to be ready. You can check on the status of your database by going to the Xeround dashboard (click the "Go to Xeround" link). Once it's up, you can connect to Xeround using your favorite MySQL-compatible driver or object-relational mapper.
We provide a complete
ASP.NET MVC sample application that uses NHibernate to connect
to Xeround. The sample is set up to use SchemaUpdate
and gives you completely hands-free schema migrations.