Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Can I keep a connection open while the session exists?

Can I keep a connection open while the session exists?

Scheduled Pinned Locked Moved Database
databasequestionsql-servercom
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    iluha
    wrote on last edited by
    #1

    I'm developing a shopping cart using vb6. (ActiveX dll) For db connectivity I'm using ADO 2.7 The database (free tables) in use for now will be FOXPRO (I know not the best choice) At some point the databases will be converted to MSSQL. My question is: When the cCustomer class is created, can I open the connection to the database and closed it when class is destroyed (on session end)? Or Should I open and close connection as needed? It just seem better to just do it ones, but I'm not sure on how much extra load it will be on the server. There might be up to 500 people on the server at any given time... Please let me know what you think Thank you Iluha :)

    S I 2 Replies Last reply
    0
    • I iluha

      I'm developing a shopping cart using vb6. (ActiveX dll) For db connectivity I'm using ADO 2.7 The database (free tables) in use for now will be FOXPRO (I know not the best choice) At some point the databases will be converted to MSSQL. My question is: When the cCustomer class is created, can I open the connection to the database and closed it when class is destroyed (on session end)? Or Should I open and close connection as needed? It just seem better to just do it ones, but I'm not sure on how much extra load it will be on the server. There might be up to 500 people on the server at any given time... Please let me know what you think Thank you Iluha :)

      S Offline
      S Offline
      Spanky3
      wrote on last edited by
      #2

      To do this project personally. I would use a MS access DB (crap but suited) Create your pages and then store the products buy within an Array which begins size one and then dynamically grows as you insert more items to the basket. To dynamically increase the size of the array while maintaing the content of the array use "Redim" Also when the person moves page to page store the array within a session :) Atul

      1 Reply Last reply
      0
      • I iluha

        I'm developing a shopping cart using vb6. (ActiveX dll) For db connectivity I'm using ADO 2.7 The database (free tables) in use for now will be FOXPRO (I know not the best choice) At some point the databases will be converted to MSSQL. My question is: When the cCustomer class is created, can I open the connection to the database and closed it when class is destroyed (on session end)? Or Should I open and close connection as needed? It just seem better to just do it ones, but I'm not sure on how much extra load it will be on the server. There might be up to 500 people on the server at any given time... Please let me know what you think Thank you Iluha :)

        I Offline
        I Offline
        ian mariano
        wrote on last edited by
        #3

        Holding a connection open to a database as you're thinking doesn't scale well. Use a combination of "just in time" connections, caching (ASP.NET caching is pretty nifty,) and a session shopping cart using an ArrayList of order items should do the trick.

        Ian Mariano - http://www.ian-space.com/
        "We are all wave equations in the information matrix of the universe" - me

        G 1 Reply Last reply
        0
        • I ian mariano

          Holding a connection open to a database as you're thinking doesn't scale well. Use a combination of "just in time" connections, caching (ASP.NET caching is pretty nifty,) and a session shopping cart using an ArrayList of order items should do the trick.

          Ian Mariano - http://www.ian-space.com/
          "We are all wave equations in the information matrix of the universe" - me

          G Offline
          G Offline
          gpa2000
          wrote on last edited by
          #4

          I had a DBA once who stored the UserId created by MSSQL in a table. After a while, usually after lunch, strange effects occured. People started to see other peoples data. After a while we figured out that when the connection is dormant for a while the connection drops and a new one is created when needed. MSSQL does this all by itself. So i dont think you can get a connection all to yourself, you share it with others. Perhaps there is a way to keep the connection alive but why would you want this. HTH, Grtz, Guus

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups