Database switching

Using
plugins.rawSQL.executeSQL(
and
plugins.maintenance.getServer(

How the database switching in the framework has influence to those two functions?

Using the variable globals.nav_db_framework, it is not connected to the database I want, or I’m not sure, something is strange.

When I change it to the real database name instead of the variable globals.nav_db_framework it works in the developer but when I publish it to the server I have the same error as whit the variable globals.nav_db_framework in the Java Console.

ERROR - Debug - Exception while getting server ‘moevenpick’.
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: com.servoy.j2db.dataprocessing.JSServer
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Unknown Source)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(Unknown Source)
at $Proxy13.getServer(Unknown Source)
at com.servoy.extensions.plugins.maintenance.MaintenanceProvider.js_getServer(MaintenanceProvider.java:351)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:179)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:367)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:65)
at org.mozilla.javascript.gen.c243._c0(mir_checkTablesDoIt:394)
at org.mozilla.javascript.gen.c243.call(mir_checkTablesDoIt)
at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:91)
at org.mozilla.javascript.gen.c242._c0(mir_checkTables:343)
at org.mozilla.javascript.gen.c242.call(mir_checkTables)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:387)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3134)
at org.mozilla.javascript.gen.c242.call(mir_checkTables)
at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:528)
at com.servoy.j2db.FormController.executeFunction(FormController.java:4058)
at com.servoy.j2db.FormController.executeFunction(FormController.java:3937)
at com.servoy.j2db.FormController.executeFunction(FormController.java:3859)
at com.servoy.j2db.FormController$ScriptExecuter.executeFunction(FormController.java:3714)…

Imagine you have SERVER_A and SERVER_B.

And you let the framework switch from SERVER_A to SERVER_B.

Most of the methods/forms/relations in servoy will expect you to still refer to SERVER_A but servoy will know that you mean SERVER_B because you switched. Thats why in the globals.nav_db_framework you will find SERVER_A.

But there are exeptions, 2 of them are ‘plugins.rawSQL.executeSQL’ and ‘plugins.maintenance.getServer’. In the sample of rawSQL you will also see a warning for this:

Note that when server names have been switched (databasemanager.switchServer),the
real server names must be used here, plugins.rawSQL is not transparent to switched servers.

So in the case of those methods you have to use the name of the server you are switched to in this case SERVER_B.

Also, the maintanance plugin is made for pre and post import solutions only and should not be used in smartclient.

Hope this helps.

OK, thanks!
That was what I was expecting.
Good to know that those two functions are handled this way.