connection of database change depending on the user

I need to change the database connection to the user depending on what happens is that I’m developing a project to several schools and each school with a different database.

I have to create a home screen where you select the school and selected depending on the school change the database so that only associate professors may come to that school.

If you have a better solution please I can mention is the very important thank you very much

This waiting for your reply

Re: connection of database change depending on the user

i have a same problem… too.

Do you solve it,…?
Thanks for information…
Grettings from Colombia.

Re: connection of database change depending on the user

I would be interested in a solution here too.

Re: connection of database change depending on the user

Hi,
this one should point you in the right direction.

http://www.scriptcase.net/forum_en_us/index.php?topic=1419.msg6302#msg6302

jsb

Hi jaimeflores,
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.

Hi hirambq,

BUT the problem is that change is made for ALL the project SESSIONS running on the server, NOT ONLY to the session that execute the change, I test this and I don’t know how to resolve this problem.

I test with a simple project, with one grid and one control to change the connection.
I log in and view the grid with 3 rows (connected to the default connection)
I log in another instance and view the same 3 rows in the grid

Then in the first instance I execute the change connection, the new connection have the same table with 6 rows.

I view the 6 rows in the first instance.
AND I refresh the grid in the 2da instance AND I view the same 6 rows in the 2da instance (that never execute the change connection)

I use Windows, Apache and Mysql

Aquiles

I dont have that problem, each instance has its own connection.

please explain me how do you do that (I’am using Sc V7 last version and Mysql last version)
Do you use Windows or Linux O.S. ?

what is your production environment ?

Thanks
Aquiles

Hi Aquiles,
I am using Linux environment on a shared hosting and each user can have a different database connection at the same time using that macro.

Hi hirambq,

Please say me you shared hosting provider, and if you use sessions on database (Sc settings) or not ?
I don’t know more about Linux but as I need to resolve this problem I start learning Linux now
What linux distro you use ?
Desktop or Server ?

Once in the shared host, what are the following steps ?

Usted habla espa?ol ? digo esto porque est? en Mexico y a mi me gustaria comunicarme en este idioma.
me podria dar su mail para alguna peque?a ayuda ?

Muchas Gracias
Aquiles Rodriguez