• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: two databases from one application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: two databases from one application


  • Subject: Re: two databases from one application
  • From: Anjo Krank <email@hidden>
  • Date: Wed, 10 May 2006 19:34:14 +0200

WO application I am working on was pretty simple up to
this point: one apache webserver and one database
server serving data to it. The things turned more
complicated now: In addition to the first database, we
now want to add access to another database. Both of
these databases have identical schema, and the tables
in question are identical. Think of the second
database as a backup.

You simply can't do that in an easy way.

Having said that, what you *can* do - if you are of the adventurous type - is to use sth similar to the ERXAdaptorChannelDelegate/ ERXAdaptorOperationWrapper in Project Wonder. I'm using it to sync two databases via - get this - email.

To do this yourself and in only one app, you'd need to set your original DBC.context.availableChannel.delegate to an object that listens to

	public Throwable adaptorChannelDidPerformOperations(EOAdaptorChannel
		channel, NSArray adaptorOps, Throwable exception) {
		if (log.isDebugEnabled()) {
			log.debug("adaptorChannelDidPerformOperations: count="
				+ adaptorOps.count() + ", exception = " + exception);
		}

		if (exception == null) {
			if (postAdaptorOperationNotifications()) {
				otherDBC.performAdaptorOperations(adaptorOps);
			}

		}
		return exception;
	}

Of course, once your other DB is changed or modified too, you'll have a hell of a time managing conflicts. One way to get this to a minimum is to have your DBC delegate to implement:

public NSDictionary databaseContextNewPrimaryKey (EODatabaseContext databaseContext, Object object, EOEntity entity) {
return ... some new ID which is unique to all DBCs;
}


Good luck, you'll need it.

Cheers, Anjo

PS: any other approach simply won't work as your EC1 doesn't have access to the DB2.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: two databases from one application
      • From: "Pierce T. Wetter III" <email@hidden>
References: 
 >two databases from one application (From: Milan M <email@hidden>)

  • Prev by Date: Re: two databases from one application
  • Next by Date: Re: problem while connecting to application via webserver
  • Previous by thread: Re: two databases from one application
  • Next by thread: Re: two databases from one application
  • Index(es):
    • Date
    • Thread