Hi ouissem,
You can change the database connection using scriptcase. Please follow these steps:
#1 Example to execute a SQL query using other connection (ONLY for this SQL query)
sc_lookup(rs, "select field from table", 'MyNewConnection');
#2 Example to change connection (Applies to all your SQL querys and All Applications)
sc_change_connection ( "MyOldConnection",'MyNewConnection');
So if you want to switch a connection depending of the user you can use this script:
if($user=='jonh'){
sc_change_connection ( "MyOldConnection",'MyNewConnection');
}
Note: When using sc_change_connection you need to reload the page or redir to another application to see the connection changes.
Note2: Your connection name is the name that you define in ScriptCase Database>NewConnection
If you want to change the connection dinamically you need first to define all the connections and then associate in a table the name of connection of each user. And reeplace the string for a varible ($user_connection), for example:
sc_change_connection ( "MyOldConnection",$user_connection);