Announcement

Collapse
No announcement yet.

connection of database change depending on the user

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    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.

    Comment


    • #3
      Re: connection of database change depending on the user

      I would be interested in a solution here too.
      Albert Drent
      aducom software netherlands
      scriptcase partner, reseller, support and (turn-key) development
      www.scriptcase.eu / www.scriptcase.nl

      Comment


      • #4
        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_u...sg6302#msg6302

        jsb

        Comment


        • #5
          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)

          PHP Code:
          sc_lookup(rs"select field from table"'MyNewConnection'); 
          #2 Example to change connection (Applies to all your SQL querys and All Applications)

          PHP Code:
          sc_change_connection "MyOldConnection",'MyNewConnection'); 
          So if you want to switch a connection depending of the user you can use this script:

          PHP Code:
          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.
          Best Regards
          Hiram BQ

          Comment


          • #6
            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
            Last edited by aquiles; 09-28-2013, 09:12 AM.

            Comment


            • #7
              I dont have that problem, each instance has its own connection.
              Best Regards
              Hiram BQ

              Comment


              • #8
                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
                Last edited by aquiles; 09-28-2013, 11:00 PM.

                Comment


                • #9
                  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.
                  Best Regards
                  Hiram BQ

                  Comment


                  • #10
                    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

                    Comment

                    Working...
                    X