How can u connect to 1 of several dbs based on selection user makes when accessing main page

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default How can u connect to 1 of several dbs based on selection user makes when accessing main page

    We have a web site IIS 5 (on Win2000k) with Oracle 9i backend (Sun unix).

    There is 1 user ID to oracle(APT_W3) that is used by all users (50).

    We have a global.asa file that has one APP Start connection string using OLE
    DB:
    Application("dbConnString")="Provider=MSDAORA.1;Pa ssword='SDERSD';User
    ID=APT_W3;Data Source=CCEWSDD1_new;Locale Identifier=1033;OLE DB services=-1"

    The first page that a user sees asks that they select the area they want to
    see (western, northern, etc) from a dropdown menu. Once they select it and
    hit save they can go to other pages, session varibles indicating what area
    they selected are then passed to pages. Currently all areas are in one
    database.

    What we want to do is have areas in separate dbs, a northern one, a western
    one.etc. Each will have separate user ids (APT_W2N, APT_W3W,etc).

    We want the users to have the web page presented to them where they select an
    area. Based on the area they select, the appropriate conneciton string will
    be used (the one in the global asa).

    Is there a way to have that in the global asa? Maybe as a session
    Session_OnStart? Based on the selection they made on the web page, they will
    be using one of several connection strings so we can have connection pooling
    hourman Guest

  2. Similar Questions and Discussions

    1. How to access values entered in User control in the main page.
      Hi Guys, i have a user control which allows the user to enter Name& Address in text boxes. I use the same user control in the main page... ...
    2. Include Files Dynamically Based On User Selection !
      http://www.aspfaq.com/2042 "Lovely Angel For You" <lovely_angel_for_you@yahoo.com> wrote in message...
    3. Hide text boxes based upon page selection via tab controls
      Use the Change event of the tab control. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users -...
    4. User changing something on a form makes asp.net take user to login page
      Hi, I have an application that displays the database table records on the web page, the user can navigate thru the contents and make changes and...
    5. accessing page variable from user control code behind
      Hi all, I have a aspx page that inherits from a cs class which is common for all pages in my application. In that cs file, I define some...
  3. #2

    Default Re: How can u connect to 1 of several dbs based on selection user makes when accessing main page

    Don't multipost. See asp.db group.

    Ray at work

    "hourman" <sdfdfwetudfyt@7fdfster.com> wrote in message
    news:3f1c28a7$0$96923$45beb828@newscene.com...
    > We have a web site IIS 5 (on Win2000k) with Oracle 9i backend (Sun unix).
    >
    > There is 1 user ID to oracle(APT_W3) that is used by all users (50).
    >
    > We have a global.asa file that has one APP Start connection string using
    OLE
    > DB:
    > Application("dbConnString")="Provider=MSDAORA.1;Pa ssword='SDERSD';User
    > ID=APT_W3;Data Source=CCEWSDD1_new;Locale Identifier=1033;OLE DB
    services=-1"
    >
    > The first page that a user sees asks that they select the area they want
    to
    > see (western, northern, etc) from a dropdown menu. Once they select it
    and
    > hit save they can go to other pages, session varibles indicating what area
    > they selected are then passed to pages. Currently all areas are in one
    > database.
    >
    > What we want to do is have areas in separate dbs, a northern one, a
    western
    > one.etc. Each will have separate user ids (APT_W2N, APT_W3W,etc).
    >
    > We want the users to have the web page presented to them where they select
    an
    > area. Based on the area they select, the appropriate conneciton string
    will
    > be used (the one in the global asa).
    >
    > Is there a way to have that in the global asa? Maybe as a session
    > Session_OnStart? Based on the selection they made on the web page, they
    will
    > be using one of several connection strings so we can have connection
    pooling


    Ray at Guest

  4. #3

    Default Re: How can u connect to 1 of several dbs based on selection user makes when accessing main page

    In article <OdtdAI7TDHA.2520@tk2msftngp13.phx.gbl>, "Ray at <%=sLocation%>" <ask@me.forit> wrote:
    >Don't multipost. See asp.db group.
    >
    >Ray at work
    >
    >"hourman" <sdfdfwetudfyt@7fdfster.com> wrote in message
    >news:3f1c28a7$0$96923$45beb828@newscene.com...
    >> We have a web site IIS 5 (on Win2000k) with Oracle 9i backend (Sun unix).
    >>
    >> There is 1 user ID to oracle(APT_W3) that is used by all users (50).
    >>
    >> We have a global.asa file that has one APP Start connection string using
    >OLE
    >> DB:
    >> Application("dbConnString")="Provider=MSDAORA.1;Pa ssword='SDERSD';User
    >> ID=APT_W3;Data Source=CCEWSDD1_new;Locale Identifier=1033;OLE DB
    >services=-1"
    >>
    sorry its my 1syt post, did not know which group was best suited for question,
    since it involved db, but was also asp (global asa) related.
    hourman Guest

  5. #4

    Default Re: How can u connect to 1 of several dbs based on selection user makes when accessing main page

    Just store 4 connection strings in the application and then use the
    appropriate one for each user based on their region selection.
    Application("dbConnString_N")="Provider....
    Application("dbConnString_S")="Provider....
    Application("dbConnString_E")="Provider....
    Application("dbConnString_W")="Provider....


    Or store the appropriate connection string in each user's session.

    session("dbConnString")=Application("dbConnString_ " &
    request.form("regionId")) ' or whatever



    tim


    "hourman" <sdfdfwetudfyt@7fdfster.com> wrote in message
    news:3f1c2823$0$96923$45beb828@newscene.com...
    >
    > We have a web site IIS 5 (on Win2000k) with Oracle 9i backend (Sun unix).
    >
    > There is 1 user ID to oracle(APT_W3) that is used by all users (50).
    >
    > We have a global.asa file that has one APP Start connection string using
    OLE
    > DB:
    > Application("dbConnString")="Provider=MSDAORA.1;Pa ssword='SDERSD';User
    > ID=APT_W3;Data Source=CCEWSDD1_new;Locale Identifier=1033;OLE DB
    services=-1"
    >
    > The first page that a user sees asks that they select the area they want
    to
    > see (western, northern, etc) from a dropdown menu. Once they select it
    and
    > hit save they can go to other pages, session varibles indicating what area
    > they selected are then passed to pages. Currently all areas are in one
    > database.
    >
    > What we want to do is have areas in separate dbs, a northern one, a
    > western one.etc. Each will have separate user ids (APT_W2N, APT_W3W,etc).
    >
    > We want the users to have the web page presented to them where they
    > select an area. Based on the area they select, the appropriate conneciton
    > string will be used (the one in the global asa).
    >
    > Is there a way to have that in the global asa? Maybe as a session
    > Session_OnStart? Based on the selection they made on the web page, they
    will
    > be using one of several connection strings so we can have connection
    pooling


    Tim Williams Guest

  6. #5

    Default Re: thanks it possible to have pass value back to global asa

    In article <emYFKm7TDHA.3640@tk2msftngp13.phx.gbl>, "Tim Williams" <saxifrax@pacbellremovethis.net> wrote:
    >Just store 4 connection strings in the application and then use the
    >appropriate one for each user based on their region selection.
    >Application("dbConnString_N")="Provider....
    >Application("dbConnString_S")="Provider....
    >Application("dbConnString_E")="Provider....
    >Application("dbConnString_W")="Provider....
    >
    >
    >Or store the appropriate connection string in each user's session.
    >
    >session("dbConnString")=Application("dbConnString _" &
    >request.form("regionId")) ' or whatever
    >
    >
    >tim
    Thanks a followup question: We have
    var adoRst = Server.CreateObject("ADODB.Recordset")
    adoRst.Open(strSQL, Application("dbConnString")) appearing ~130 times in our
    web apps, we ar trying to min. editing the pages. If I understand you

    using:
    >Application("dbConnString_N")="Provider....
    >Application("dbConnString_S")="Provider....
    we would have to edit all our asp pages to change Application("dbConnString"))
    to the approiapte Application("dbConnString_?")) based on what they selected-
    using if statements, may replace adoRst.Open(strSQL,
    Application("dbConnString") with an include file that had the if statments,
    right?

    with
    >Or store the appropriate connection string in each user's session.
    >
    >session("dbConnString")=Application("dbConnString _" &
    we would also have to do the same replacing the one we have with an include
    file?

    Is there any way to pass it back to the global.asa page? so that it resets the
    sesssion startup function to use the appropriate one maybe an if statment in
    the asa. page
    hourman Guest

  7. #6

    Default Re: How can u connect to 1 of several dbs based on selection user makes when accessing main page

    In article <9kjohv84bbqvk8hku8q5832eg7f2a58anc@4ax.com>, See Message body to address if provided... wrote:
    >
    >There is no need for 4 separate databases ( do not confuse Oracle's
    > architecture with SqlServer's ) ..
    >One database, one connection, different used_ids , and , for each User_Id grant
    > access not to the whole table but to
    >just a view of the data that only contains their area.
    >
    >For instance, when the user_id is APT_W2N, then the view would only contain
    > Northern data...
    >
    >
    The data, for a variety of reasons (mostly regulatory per the legal dept.) is
    going to be in different databases, its not our decision to make. there are
    going to be separate databases with data from each region going into its
    separate place. the DBA's are going to give us 4 user ids and if we want to
    look at the data from a region we are going to have to use that id.

    We have a single web app currently that looked at the data. There was a
    single user APT_W3 and a single database. When a user got to the home page
    they had to pick a region. we then passed the a session variable containing
    the region. This was used in SQL statements in the where clause to have that
    query only see the region that was initally selected.

    Now we have 4 user id, user still will have to select a region to go to (code
    will determine if they get an error message or not based on their lan id) and
    then they will get db access. We don't want to create 4 web sites one for
    each region, we want to have single site. We want to make the pages determine
    with user id to use based on the selection made at start.

    My question was if it was possible when user selects region to thave asp
    connect with the approrpiate user id.
    hourman Guest

  8. #7

    Default Re: How can u connect to 1 of several dbs based on selection user makes when accessing main page

    1. when the user picks a region, set the connection string for that region
    into a session variable. use the connection string from that session
    variable for all subsequent database access.

    or

    2. just put the region in the session variable and have an include file that
    contains the code that opens the database. put a select statement in the
    include file to pick the appropriate connection string.

    or (if you don't like session variables)

    3. pass the region along from page to page in hidden form fields or in the
    query string. continue as in (2).

    --
    Mark Schupp
    --
    Head of Development
    Integrity eLearning
    Online Learning Solutions Provider
    [email]mschupp@ielearning.com[/email]
    [url]http://www.ielearning.com[/url]
    714.637.9480 x17


    "hourman" <sdfdfwetudfyt@7fdfster.com> wrote in message
    news:3f1c5bb2$0$96923$45beb828@newscene.com...
    > In article <9kjohv84bbqvk8hku8q5832eg7f2a58anc@4ax.com>, See Message body
    to address if provided... wrote:
    > >
    > >There is no need for 4 separate databases ( do not confuse Oracle's
    > > architecture with SqlServer's ) ..
    > >One database, one connection, different used_ids , and , for each User_Id
    grant
    > > access not to the whole table but to
    > >just a view of the data that only contains their area.
    > >
    > >For instance, when the user_id is APT_W2N, then the view would only
    contain
    > > Northern data...
    > >
    > >
    > The data, for a variety of reasons (mostly regulatory per the legal dept.)
    is
    > going to be in different databases, its not our decision to make. there
    are
    > going to be separate databases with data from each region going into its
    > separate place. the DBA's are going to give us 4 user ids and if we want
    to
    > look at the data from a region we are going to have to use that id.
    >
    > We have a single web app currently that looked at the data. There was a
    > single user APT_W3 and a single database. When a user got to the home
    page
    > they had to pick a region. we then passed the a session variable
    containing
    > the region. This was used in SQL statements in the where clause to have
    that
    > query only see the region that was initally selected.
    >
    > Now we have 4 user id, user still will have to select a region to go to
    (code
    > will determine if they get an error message or not based on their lan id)
    and
    > then they will get db access. We don't want to create 4 web sites one
    for
    > each region, we want to have single site. We want to make the pages
    determine
    > with user id to use based on the selection made at start.
    >
    > My question was if it was possible when user selects region to thave asp
    > connect with the approrpiate user id.

    Mark Schupp Guest

  9. #8

    Default Re: thanks it possible to have pass value back to global asa

    Shouldn't that be at the Session Level and not Application? The
    Application Level effects the whole entire site, not just the one
    user. If one user wants Western and another comes later and picks
    Southern, then the "Western user" suddenly gets switched to Southern.

    --

    Phillip Windell [CCNA, MVP, MCP]
    [email]pwindell@wandtv.com[/email]
    WAND-TV (ABC Affiliate)
    [url]www.wandtv.com[/url]


    "John Beschler" <giles@geewhiz.com> wrote in message
    news:0e2001c35074$e0f13b40$a601280a@phx.gbl...
    > If you store multiple connection strings as session
    > variables, then after the user selects the region, replace
    > the "true" connection string with the connection string
    > for that region:
    >
    > Select Case Region
    > Case Region "N"
    > Application("dbConnString") = Application
    > ("dbConnString_N")
    > Case Region "S"
    > Application("dbConnString") = Application
    > ("dbConnString_S")
    > Case Region "E"
    > Application("dbConnString") = Application
    > ("dbConnString_E")
    > Case Region "W"
    > Application("dbConnString") = Application
    > ("dbConnString_W")
    > End Select
    >
    >
    >
    >
    > >-----Original Message-----
    > >In article <emYFKm7TDHA.3640@tk2msftngp13.phx.gbl>, "Tim
    > Williams" <saxifrax@pacbellremovethis.net> wrote:
    > >>Just store 4 connection strings in the application and
    > then use the
    > >>appropriate one for each user based on their region
    > selection.
    > >>Application("dbConnString_N")="Provider....
    > >>Application("dbConnString_S")="Provider....
    > >>Application("dbConnString_E")="Provider....
    > >>Application("dbConnString_W")="Provider....
    > >>
    > >>
    > >>Or store the appropriate connection string in each
    > user's session.
    > >>
    > >>session("dbConnString")=Application("dbConnStrin g_" &
    > >>request.form("regionId")) ' or whatever
    > >>
    > >>
    > >>tim
    > >
    > >Thanks a followup question: We have
    > >var adoRst = Server.CreateObject("ADODB.Recordset")
    > >adoRst.Open(strSQL, Application("dbConnString"))
    > appearing ~130 times in our
    > >web apps, we ar trying to min. editing the pages. If I
    > understand you
    > >
    > >using:
    > >>Application("dbConnString_N")="Provider....
    > >>Application("dbConnString_S")="Provider....
    > >
    > >we would have to edit all our asp pages to change
    > Application("dbConnString"))
    > >to the approiapte Application("dbConnString_?")) based on
    > what they selected-
    > >using if statements, may replace adoRst.Open(strSQL,
    > >Application("dbConnString") with an include file that had
    > the if statments,
    > >right?
    > >
    > >with
    > >>Or store the appropriate connection string in each
    > user's session.
    > >>
    > >>session("dbConnString")=Application("dbConnStrin g_" &
    > >
    > >we would also have to do the same replacing the one we
    > have with an include
    > >file?
    > >
    > >Is there any way to pass it back to the global.asa page?
    > so that it resets the
    > >sesssion startup function to use the appropriate one
    > maybe an if statment in
    > >the asa. page
    > >.
    > >

    Phillip Windell Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139