Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Or you could just follow these lil instructions here ;)</p> <p>To change the Connection at runtime you have to basically set the object store coordinator</p> <p>You create a custom object store coordinator like this:</p> <pre class="lang-java prettyprint-override"><code>NSMutableDictionary&lt;String, String&gt; temp = new NSMutableDictionary&lt;String, String&gt;(); temp.put("URL", String.format("%s?useBundledJdbcInfo=true", url)); temp.put("username", username); temp.put("password", password); temp.put("name", name); connectionDictionary=temp.immutableClone(); // Create a new Object store coordinator objectStoreCoordinator = new ERXObjectStoreCoordinator(); ERXModelGroup.setModelGroupForObjectStoreCoordinator( objectStoreCoordinator, ERXModelGroup.defaultGroup() ); // Set the model that you want to use to connect to multiple databases EOAdaptor adaptor =ERXDatabaseContext.registeredDatabaseContextForModel( ERXModelGroup.defaultGroup().modelNamed("YourModelName"), objectStoreCoordinator ).adaptorContext().adaptor(); // update the connection dictionary adaptor.setConnectionDictionary( updateDictionary(adaptor.connectionDictionary(), connectionDictionary) ); </code></pre> <p>With this you can easily create a new editing context that points to the database of your choice</p> <pre class="lang-java prettyprint-override"><code>ERXEC.newEditingContext(objectStoreCoordinator); </code></pre> <p>If your application is used by multiple users and they all need to switch between multiple DBs without interfeering with each other, I recommend that you not use Shared Editing Context. </p> <p>Like this you avoid people changing the object store coordinator to cause the others to point to that database too (not so funny).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload