Problem with swich server

Hello Everbody

We have a login-solution(username,password)
The login_solution calls a method in our authenticate_solution(where we query our own usertable).
The authenticate_solution returns true and the wanted solution xyz is started.

Everything works as expected.
During development and test we work with databaseserver TEST.

When i import these 3 solutions to our training applicationserver everything works as expected.

Now i want to put the solutuions to our production applicationserver and connect them to our production database.

To handle this we have the following code on solution open in our authenticate- and in our xyz-solution :

var vappserver = application.getServerURL();
		
var vaufProd = vappserver.indexOf('production');
if (vaufProd > 0)
{
globals.g_authserver = "Produktiv";
var success = databaseManager.switchServer("TEST",globals.g_authserver);
	if (!success)
	{
		application.output("Fehler beim Switch to Produktiv");
		application.exit();
	}
}
else
{
globals.g_authserver = "TEST";	
}

In our authenticate solution we do something like getdatasetbyquery(globals.g_authserver,“select from ourusertable…”,…)

The idear is, that solutions startted from our production application server allways authenticate against a table in the production database and then work with other tables in the production database.
Solutions from developer workstations or from our training application server should authenticate and work with our TEST database.

Now it seems, that the authenticate solution allways works against Test ??
Even when started on the production application server, the query is fired against the test database.
The xyz solution is switched to the produktion database when started on the production application server.

What do we miss?
Can’t we switch our authenticate solution to another database server?
Any other general method to switch solutions between test and production ?

Regards
Albert

I’d just use the same ‘named’ Servoy db connection and for the developer/test environment point it to the the TEST.db and for your production/server environment point it to the PRODUCTION.db. Not quite sure why you’d bother with switchServer. Both solutions (developer and server) use different property files and that’s what Servoy uses when starting up.

I agree with John’s reply.

Additionally, note that servoy calls that use a server name are transparent to switch-server calls.
You should develop against for example server ‘crm’ and when you switch-server ‘crm’ to ‘crm_x’, the getdatasetbyquery should be on ‘crm’, not ‘crm_x’ as Servoy will do the mapping.

There is one exception to that, the rawsql plugin, for this plugin the server mapping is not transparent.

Rob