• 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
new EOObjectStoreCoordinator and closing database connection afterwards
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

new EOObjectStoreCoordinator and closing database connection afterwards


  • Subject: new EOObjectStoreCoordinator and closing database connection afterwards
  • From: Klaus Berkling <email@hidden>
  • Date: Tue, 1 Jul 2008 14:41:52 -0700

Hi all.

In my application I'm trying to use independent access layer stacks to open multiple database connections to the database.
I use this code:

        EOObjectStoreCoordinator parentObjectStore = new EOObjectStoreCoordinator(); 
        EOEditingContext editingContext = new EOEditingContext(parentObjectStore); 
        setDefaultEditingContext(editingContext); 

This looks like it's working in that it opens two new connection to the database when I start a new session. As expected.

When I'm terminate the session I use this code to close the connection to the database:

'editingContext' is the session 'defaultEditingContext()'

        EOObjectStoreCoordinator parentObjectStore = (EOObjectStoreCoordinator)(editingContext.parentObjectStore());
        NSArray databaseContexts = parentObjectStore.cooperatingObjectStores();
        int contextCount = databaseContexts.count();
        
        for (int i = 0; i < contextCount; i++) {
            NSArray channels = ((EODatabaseContext)databaseContexts.objectAtIndex(i)).registeredChannels();
            int channelCount = channels.count();
            for (int j = 0; j < channelCount; j++) { 
                //Make sure the channel you're trying to close isn't performing a transaction. 
                if (!((EODatabaseChannel)channels.objectAtIndex(j)).adaptorChannel().adaptorContext().hasOpenTransaction()) { 
                    ((EODatabaseChannel)channels.objectAtIndex(j)).adaptorChannel().closeChannel(); 
                } 
            } 
            
        }

This closes one of the two database connection, not both.

Is there a way to detect the one extra connection or not open the extra connection in the first place?

WOnder may have resolved this issue but adding WOnder is a bigger undertaking then I originally expected.
Paraphrasing Lou Reed, I just want some of it, not all of it.

Thanks

kib

"Success is not final, failure is not fatal: it is the courage to continue that counts.”
- Winston Churchill

Klaus Berkling
Systems Administrator
DynEd International, Inc.
www.dyned.com | www.eskimo.com/~kiberkli




 _______________________________________________
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: new EOObjectStoreCoordinator and closing database connection afterwards
      • From: Chuck Hill <email@hidden>
    • Re: new EOObjectStoreCoordinator and closing database connection afterwards
      • From: "Lon Varscsak" <email@hidden>
  • Prev by Date: Re: EOEditingContext in Application
  • Next by Date: Re: new EOObjectStoreCoordinator and closing database connection afterwards
  • Previous by thread: Unsolicited Plug for OpenReports
  • Next by thread: Re: new EOObjectStoreCoordinator and closing database connection afterwards
  • Index(es):
    • Date
    • Thread