title: CoreData - Problem accessing database on another machine
body: <p>I've got a problem with my CoreData, but I'm sure I'm doing something wrong conceptually.  </p>
  
  <p>I'm trying to access a CoreData sql file on one machine in my network from another machine.  I'm trying to do this from a cluster-like application.  Each machine has the same copy of the software and needs to point to the database on this one machine.</p>
  
  <p>My model and context load fine for the machine that the database is on.  The other machine, gives me error <code>13400 NSPersistentStoreInvalidTypeError</code></p>
  
  <p>Here's the bit of code:</p>
  
  <pre><code>NSError *error = nil;
  NSURL *mdlurl = [NSURL fileURLWithPath: [[NSBundle mainBundle] pathForResource:@"OsiriXDB_DataModel" ofType:@"mom"]];
  _model = [[NSManagedObjectModel alloc] initWithContentsOfURL: url];
  
  NSURL *dburl = [NSURL URLWithString:[NSString stringWithUTF8String:_DBPath.c_str()]];
  // The dburl has a format like: file://192.168.0.2/Users/slate/Documents/OsiriX%20Data/Database.sql which addresses the machine the data sits on.
  _storeCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: _model];
  _context = [[NSManagedObjectContext alloc] init];
  [_context setPersistentStoreCoordinator: _storeCoordinator];
  
  if (![_storeCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:dburl options:nil error:&amp;error]) {
      NSLog(@"Error loading store: %@", error);  // Error Shows up Here
      NSLog(@"MOM: %@",_model); // Model looks OK.  Lots of print outs, with the correct names and stuff.  (so technical).
  }
  </code></pre>
  
  <p>I confess to not knowing a ton about CoreData.  Is it because it's on a different machine?  I read <a href="http://www.matthew-long.com/2007/11/02/the-managed-object-model-version-used-to-open-the-persistent-store-is-incompatible-with-the-one-that-was-used-to-create-the-persistent-store/" rel="nofollow">this online</a> but I don't <em>think</em> that's my issue.  If it is, I have no idea how to fix it because I can't find any <code>.xml</code> files in my <code>~/Library/Application\ Support/</code> directory relating to either <code>MyApp</code> or <code>OsiriX</code> which is the program that created the database.</p>
  
  <p>Am I doing the wrong thing to load CoreData across a network?<br>
  If not, what should I be doing?  </p>
  
  <p>Thanks,</p>