Change db connect string in python or dtml
Hi. I have an instance of a 'Z MySQL Database Connection' called mysql. How can I change the 'Database Connection String' and then then try to connect, either in dtml or python? -- /Magnus Heino
Magnus Heino wrote:
How can I change the 'Database Connection String' and then then try to connect, either in dtml or python? I think I understand what you are asking, since I am developing a database app and have switched about 20 methods back and forth between two database servers... it gets tedious. I assume you want a more automated way to do this, and it should be possible to write a python script (External method?) to do this, although I'm not sure how you would find all the ZSQL methods where you would do this. Perhaps something like this (the find form): http://www.yourserver.com/yourfolder/manage_findResult?obj_metatypes%3Alist=...
As a quick and dirty alternative (untested), just edit your connection parameters in your Mysql connector to point to the different server (you'll want to close the connection first, I expect). -- Craig Allen - Managing Partner - Mutual Alchemy Web Architecture - http://alchemy.nu
Craig Allen wrote:
As a quick and dirty alternative (untested), just edit your connection parameters in your Mysql connector to point to the different server (you'll want to close the connection first, I expect).
I think this is probably the best way to do it :-) The idea behind a database connector is that it abstracts the connection information into a seperate object so you only have to change the connection string in one place to change what DB a group of methods are using. As longs as the DBs have the same schema it should work just fine. cheers, Chris
participants (3)
-
Chris Withers -
Craig Allen -
Magnus Heino