Discussion:
[Modeling-users] Newbie questions
Stephen Nesbitt
2004-04-28 19:40:06 UTC
Permalink
All:

A couple of quick (I hope) newbie questions.

First what is the canonical way to override the the database access stuff
embedded in the model? Essentially I've modeled our production database, but
want to validate and test against a test database without modifying the model
in advance.

Second, how do I handle commits and rollbacks? I had an instance were I had a
failed transaction and ended up with a hung transaction and no obvious way to
roll it back.

Thanks in advance!

-steve
--
Stephen Nesbitt
Senior Configuration Management Engineer
The Cobalt Group
206.219.8271
***@cobaltgroup.com
Sebastien Bigaret
2004-04-29 18:14:20 UTC
Permalink
Hi Stephen,
Post by Stephen Nesbitt
A couple of quick (I hope) newbie questions.
First what is the canonical way to override the the database access stuff
embedded in the model? Essentially I've modeled our production database, but
want to validate and test against a test database without modifying the model
I'd say the canonical way is to create a file, say, test_DB.cfg,
that overwrite the necessary db-connection dict.
(host, port, user, password)

Then set the env. variable MDL_DB_CONNECTIONS_CFG
to the full path of this .cfg file, and it will be automatically used
to overwrite the specified field with the associated values
just after the model is loaded.

See http://modeling.sourceforge.net/UserGuide/env-vars-core.html
for details.

However, please do some testing before trying to drop
the whole database!! --probably the best way to avoid shooting
yourself in the foot is to remove the user/password/host/port stuff
from your model, and have two deidacted db_config.cfg file, one on
the production machine, the other one on the test machine.
This way if you forget to set the env. variable you won't hit the
production db, just get some errors.
Post by Stephen Nesbitt
Second, how do I handle commits and rollbacks? I had an instance were I had a
failed transaction and ended up with a hung transaction and no obvious way to
roll it back.
Thanks in advance!
Could you be more specific? Do you have an example? Normally
the framework does/should do all the commit or rollback stuff
for you, it shouldn't leave a opened transaction.

What do you mean exactly by a "hung transaction"?
(BTW: which db do you use?)

If this is a bug, we'd better be able to reproduce it to get rid of it :-/

-- Sébastien.

Loading...