one solution - two db versions - dynamically switch dbs

I am developing an accounting solution in servoy. I have two databases (may be more databases) of same structure but with different data in them. But I want to use a single servoy solution to manage it. I do not want use multiple copies of the same solution for each db. That would be a real pain.

I am trying to find out that I could dynamically switch connections during the startup? I mean, user A tries to open solution 1 with db1 and user B tries to open solution 1 with db2?

Also can I do a following thing:
In an accounting solution I would have different accounting period. For example year 2004, year 2005 and so on. When the year 2004 ends, I would be able to allow the user to create database/tables for the year 2005 from within the servoy solution. This would copy the account template database from a location and make it as the database for year 2005. Then it would create some necessary records in the new database. So when the user switches back to the year 2004 then the solution switches the database connection to the year 2004 database.

I have seen many software vendors does this with MS Access dbs & others.

It would be really very cool and it is very important to us as well.

Thanks for your great work & help.

faheemhameed:
I am trying to find out that I could dynamically switch connections during the startup? I mean, user A tries to open solution 1 with db1 and user B tries to open solution 1 with db2?

I have no answer for your question, but a little suggestion: if you plan to switch between dbs, pay attention to table sequences. Probably, the best option is to leave the db manage them, not Servoy.

Maybe it’s obvious, anyway…:slight_smile:

thanks for your suggestion. I always use db managed identities for pk column.

faheemhameed:
I am trying to find out that I could dynamically switch connections during the startup? I mean, user A tries to open solution 1 with db1 and user B tries to open solution 1 with db2?

You cannot currently “swtich” connections. Remember - all database connections are named connections. If you wanted to emulate this you could:

  1. Have a different solution for each database;

  2. Have a different Servoy Application Server for each database (so they would use a different URL (or port)) to open the correct database

faheemhameed:
Also can I do a following thing:
In an accounting solution I would have different accounting period. For example year 2004, year 2005 and so on. When the year 2004 ends, I would be able to allow the user to create database/tables for the year 2005 from within the servoy solution. This would copy the account template database from a location and make it as the database for year 2005. Then it would create some necessary records in the new database. So when the user switches back to the year 2004 then the solution switches the database connection to the year 2004 database.

I have seen many software vendors does this with MS Access dbs & others.

It would be really very cool and it is very important to us as well.

You cannot issue DDL (or even DML) SQL statements directly to the backend via Servoy. You COULD, however, create a stored procedure in your backend that would create the tables, and trigger that from your Servoy solution.

Will switching dbs be added to the feature list? Because in my situation it seems there is no other way to do it.

One other way is to create set of tables for each accounting period using a stored procedure. But again could I dynamically set the table name of a form? Currently I think I could not.

Will this be possible in the future? Setting the name of the table in a global and use the global for the table name property of a form?

Thanks

Can I run two instance servoy server as two windows service?

Yes, see the Server Manual.
It is exactly described there.

i have to say that i find this setup very strange. I would never make a new table for a new year. Just make a year column in the database. This is a much better approache if you ask me. Then for example you can also query at once what the results are over more then one year.

Hi Harjo,

In the servoy server manual, I could not find how to install mutiple instance of servoy server as multiple services. Could you please indicate the section number or page number?

Thanks

13.5 Running multiple instances of Server…page 214
13.5.1 Configuring ports for each Server instance…page 214