Re: Deploying to servlet and database settings
Re: Deploying to servlet and database settings
- Subject: Re: Deploying to servlet and database settings
- From: Lachlan Deck <email@hidden>
- Date: Tue, 22 Nov 2005 15:51:54 +1100
On 22/11/2005, at 3:39 PM, Randy Becker wrote:
Okay. I've got a project working well on my local mysql database,
and I'd like to deploy it to my server, which is running jetty. The
only problem so far is connecting the app to my database. My host
gave me a url of the form
jdbc:mysql://mysql/dbname?user=username&password=password
where can I enter this to make my deployment work? I'm assuming I
need to change my EOModel's adaptor, and some servlet settings and/
or web.xml, but I can't figure out what exactly I'm supposed to
change. Any help?
In your project's Properties file put something like the following:
EOModelGroupConnectionDictionary={\
username = "username";\
password = "password";\
URL = "jdbc:mysql://localhost/dbname?etc...";\
driver = "org.mysql.Driver";\
plugin = "MysqlPlugIn";\
}
I haven't used MySQL so the last two entries are examples only and
need to be either removed or substituted with the correct values.
Now, in Application.java's contructor put something like:
public Application() {
...
NSDictionary connectionDictionary;
connectionDictionary = NSPropertyListSerialization.dictionaryForString(
NSProperties.getProperty( "EOModelGroupConnectionDictionary", "{}" )
);
if ( connectionDictionary.count() > 0 ) {
en = EOModelGroup.defaultGroup().models().objectEnumerator();
while ( en.hasMoreElements() ) {
EOModel aModel;
aModel = ( EOModel )en.nextElement();
aModel.setConnectionDictionary( connectionDictionary );
}
}
...
}
and this way when you deploy the application you just need to adjust
the Properties file with the correct connection dictionary. Someone
with more MySQL/WO experience may be able to chime in with further
details - otherwise check on the WebObjects-deployment list
with regards,
--
Lachlan Deck
_______________________________________________
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