Re: WO App needs to find the database on a different computer
Re: WO App needs to find the database on a different computer
- Subject: Re: WO App needs to find the database on a different computer
- From: email@hidden
- Date: Fri, 13 Jan 2006 15:25:17 +1300
Hello Baiss;
If I split off the FrontBase database to a different computer on
the deployment side, how do I change the "setting" which will allow
the WO apps being run to look for the database on another computer?
I get the information I want from my own configuration infrastructure
then I do something like this, which is probably the bit you're after...
public static void setDBConnectionForNamedModel(
String modelName,
String jdbcDriver,
String jdbcUrl,
String username,
String password)
{
if((null==modelName) || (0==modelName.length()))
return;
EOModel model = EOModelGroup.defaultGroup().modelNamed
(modelName);
if(null==model)
throw new LEError("cannot locate the model named
'"+modelName+"'");
NSMutableDictionary d = new NSMutableDictionary();
if(null!=model.connectionDictionary())
d.addEntriesFromDictionary(model.connectionDictionary());
d.setObjectForKey(jdbcDriver, JDBCAdaptor.DriverKey);
d.setObjectForKey(jdbcUrl, JDBCAdaptor.URLKey);
d.setObjectForKey(username, JDBCAdaptor.UsernameKey);
d.setObjectForKey(password, JDBCAdaptor.PasswordKey);
String plugIn = JDBCPlugIn.plugInNameForURL(jdbcUrl);
if(null==plugIn)
throw new LEError("unable to find JDBC plugin for JDBC URL
'"+jdbcUrl+"'");
else
d.setObjectForKey(plugIn, JDBCAdaptor.PlugInKey);
model.setConnectionDictionary(d);
}
cheers.
___
Andrew Lindesay
www.lindesay.co.nz
_______________________________________________
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