I noticed that changing to another database is very very easy…
Change the servername and tablename in the properties of a form and you are done… At least that is what you think.
Offcourse one forgets all relationships and it is there that you realise there is a little extra hurdle to take. You have to change the relationships. Why didn’t you think of this before so you start doing so. At least that is what you thought.
It is not possible to change the servers and tables in a relationship I noticed…
Can you make this happen? Now the buttons for both source and destination, server and table are disabled…
Here is way to do it! Attention: Make backups before you do this en do it on you rown risk!!!
export your solution.
rename your solution to the extension: *.zip
now unzip your solution.
You see, all kinds of xml files now!
the only thing I did is open every file and did an find&replace of the server name. In my case I wanted to change from: database1 to database2
Do this in every file.
place the files back into the zip en rename your solution back again to extension: *.servoy
make sure that (in my case) database2 is excisting en import your solution.
I think it is kind of tricky, but it works for me!
What about having the option in your solution at login to specify the database you want to use?
I know for the things I’m working on, it would be handy to be able to switch between the production DB and a test DB at logon (both for myself when develloping as for later users), but I’m also thinking of a case where a user can log in through one application onto different instances of th same database, each database being for another company.
Dunno how this would work with Servoy’s fantastic option to connect to multiple database thought but if you would have the select DB option at logon, the rest can be worked out with logic…
The easied way todo this is to duplicate your property file “servoy.properties” to “servoy.properties.production” and configure one time the production db and one time the test db.
now rename the wanted file to ''servoy.properties" before startup of Servoy and it will work as wanted.
Jan Blok:
The easied way todo this is to duplicate your property file “servoy.properties” to “servoy.properties.production” and configure one time the production db and one time the test db.
now rename the wanted file to ''servoy.properties" before startup of Servoy and it will work as wanted.
And the cool way to handle this would be to write a JavaScript method that would do it for you based on a global checkbox that would control the file swap.
As part of a closing method, you would swap the file if the checkbox was checked. Then after a simple double-click on the application you are using the other database.
rename your solution to the extension: *.zip
now unzip your solution.
You see, all kinds of xml files now!
the only thing I did is open every file and did an find&replace of the server name. In my case I wanted to change from: database1 to database2
Do this in every file.
place the files back into the zip en rename your solution back again to extension: *.servoy
I also needed to do this, because I just started unaware of this, and now I need to isolate my solution.
In version 1.2rc7 there was only one xml-file (‘database-info.xml’) with proper xml-tags. I proceeded anyway, but it failed to update relations.
I tried again with 1.2rc8. Now all the xml files were properly formatted, I changed all instances of “user_data” in “adresbeheer” and proceeded as described by HJK. I also created a new server and .gdb file.
Now I get an error (see attachment).
CRC data is present, but how are these to be changed?
Q about Mattman’s solution: Is this possible? Hasn’t the servoy.properties file been read into the memory by the time you would be able to change it through a method? And therefor the changing of the file would not have effect, untill you close your solution and start it again?
And about Jan’s solution to the issue: In my opinion this only works if only one person works with the system, right? (Since Servoy.properties is a shared file between all the users). Or am I totaly not seeing something???
CRC data is present, but how are these to be changed?
As you might have seen we have added solution protection in rc8 which includes a crc check to prevent changes in the exported solution by other people.
This mechanism also applied if the solution is not protected, the export files are not ment to be changed manually after all.
Q about Mattman’s solution: Is this possible? Hasn’t the servoy.properties file been read into the memory by the time you would be able to change it through a method? And therefor the changing of the file would not have effect, untill you close your solution and start it again?
Correct will not work.
And about Jan’s solution to the issue: In my opinion this only works if only one person works with the system, right? (Since Servoy.properties is a shared file between all the users). Or am I totaly not seeing something???
I’m talking about developer(s) only yes, not end users connevtion via server
pbakker:
Q about Mattman’s solution: Is this possible? Hasn’t the servoy.properties file been read into the memory by the time you would be able to change it through a method? And therefor the changing of the file would not have effect, untill you close your solution and start it again?
I should have clarified that the switch required an application restart. True, it won’t use the new properties on the fly. But running on a 2.6 GHz machine a restart of my Servoy happens in just a few seconds. Very fast and nice.
The method of switching properties using a checkbox would be a devloper only solution knowing you have to relaunch the app.