Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Dynamic Connection Strings, Seperate Databases, and Security

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

    Dynamic Connection Strings, Seperate Databases, and Security

    Fishing for thoughts here:

    Customer has multiple, identical MySQL databases -- one for each customer (a "customer" is a company with many users).

    So, I need to use a dynamic connection string to use the right database based on login.

    Security tables are in MySQL, so each customer's database, of course, has their own set of security tables and records.

    But, there's only set of Active Link tables allowed in the webroot, and they have to be pointing to something, right? I'm not sure what.

    I can't base the active link tables on the dynamic connection string because I don't know what database/table/ to use until the user logs in. And how do I decide how to check for a user login if, at the time of login, I don't know which database might contain the security tables? Chicken & egg problem is a simple analogy.

    Or, maybe it's simple and clear and I'm thinking too hard.

    So, casting the net here....
    -Steve
    sigpic

    #2
    Re: Dynamic Connection Strings, Seperate Databases, and Security

    Hi Steve,
    For obvious reasons this kind of application should be on a single relational database using a CompanyID, but you already know that.

    I am very new to A5 development, but I would handle this in one of these ways:
    1. If all users ID are emails and each company users cannot exist in another company, then I would grab the email and try to locate it in any of the databases, once found, then use that connection for the rest of the application, of course I don't know if you can have dynamic connection on the fly.
    2. Have a Company DBF table with the CompanyID and ask for the ID in the Login form, the Company DBF would have the connection to the database and start using it after identifying the CompanyID.
    3. If you have the option to convince your customer to use a single database, then re-design the database model to include the CompanyID and link that to the UserID so you know which data to show using custom views already filtered by the CompanyID, this way all your forms will be the same for any company and the data will be already filtered with the correct CompanyID and user can add more filters at the A5 level. You would only need the CompanyID in the Parent tables since the details will be link to the Parent FK.

    Hope those suggestions give you some ideas, I definitely prefer the last one (#3) as I have used that model before for a .Net WinForm application.
    Edhy Rijo
    Progytech
    (Computer Consultants)
    The makers of CardTracking.Net
    www.progytech.com

    Comment


      #3
      Re: Dynamic Connection Strings, Seperate Databases, and Security

      Thanks Edhy. Yes, I know what it "should" be but I have to work with the parameters I've defined here. Not my choice, this is what I inherited, and have to deal with it. I'm looking for solutions to what I'm dealt here, and redesigning it as a "normal" multi-tenant system is not in the cards.
      -Steve
      sigpic

      Comment


        #4
        Re: Dynamic Connection Strings, Seperate Databases, and Security

        Seems to me you'll have to have some sort of proxy table where the user logs onto the company whereby you include the connection string to that company database. It'll have to be two log ons. One to define the company and the second to logon ot the company tables.

        You should also tell the customer you can't chew gum and whistle at the same time!
        Creating Healthcare Work-Flow Solutions Since 2005

        Comment


          #5
          Re: Dynamic Connection Strings, Seperate Databases, and Security

          I think I have a working model after tonight. It's the same flavor as Omar suggests. Briefly:

          - Dialog2 replaces Login component
          - UserID is checked against a system table of all system UserIDs (gotta feed this table yet from the "local" databases)
          - UserID is used to get Client_ID and associated database names, credentials
          - Construct session.__protected__* variable to feed the dynamic connection string
          - Important: Security active link tables use the dynamic connection string
          - a5ws_login_user() can now be executed, and response.redirect() to home page

          Basic work shows this does the job, hope to mostly complete it by tomorrow.

          Thanks for watching at home!
          -Steve
          sigpic

          Comment


            #6
            Re: Dynamic Connection Strings, Seperate Databases, and Security

            This post reminds me of a tool and die place I used to work at. We'd quote jobs that we didn't want ridiculously high so the worst case was we'd get the job and make out like bandits.

            Can you create a new merged database that alpha connects to and just set triggers to update the proper existing db? Or pretty much anything else with a mirrored/linked db. That would at least take care of the connection string problem. Otherwise some linked servers might work.

            ETA: whoops, looks like you've got it worked out already.

            Comment


              #7
              Re: Dynamic Connection Strings, Seperate Databases, and Security

              Perhaps I am an oddball, but I don't agree with the prevailing opinion that a multi-tenant database is always the "proper" solution. I previously discussed my reasons for this in the following post:

              http://msgboard.alphasoftware.com/al...l=1#post629298

              A nonprofit that I consulted with was really blindsided and badly burned when we found out after conversion to a SaaS CRM system that the MySQL database was multi-tenant and precluded our use of the company's advertised adhoc reporting tool without significant additional cost.

              Terry

              Comment


                #8
                Re: Dynamic Connection Strings, Seperate Databases, and Security

                Steve... I would be curious to get an update on your final solution. Perhaps you have code snippets to share also. Thanks.

                Comment


                  #9
                  Re: Dynamic Connection Strings, Seperate Databases, and Security

                  Steve

                  Did you get it right?

                  Can you share it with me.

                  Willing to pay.

                  Comment


                    #10
                    Re: Dynamic Connection Strings, Seperate Databases, and Security

                    Yes Norman, got it right as described in msg #5. What part(s) do you need help with?
                    -Steve
                    sigpic

                    Comment


                      #11
                      Re: Dynamic Connection Strings, Seperate Databases, and Security

                      Steve

                      - Dialog2 replaces Login component - I understand
                      - UserID is checked against a system table of all system UserIDs (gotta feed this table yet from the "local" databases) - I understand
                      - UserID is used to get Client_ID and associated database names, credentials - I understand
                      - Construct session.__protected__* variable to feed the dynamic connection string - I do not understand
                      - Important: Security active link tables use the dynamic connection string
                      - a5ws_login_user() can now be executed, and response.redirect() to home page - I do not understand

                      Thank You

                      Comment


                        #12
                        Re: Dynamic Connection Strings, Seperate Databases, and Security

                        I have a multi-tenant database that can use adhoc reporting tools. I've seen this type of set-up for well over 15 years. The adhoc reporting tools use views that are keyed by company ID.

                        Comment

                        Working...
                        X