Quick Tip: Storing Session Data

 
May 22, 2000
Mark Rusnak needs to load a few small database tables into session variables when a user logs in. The problem is that he has two clustered servers (hardware based clustering), so they can't use session variables and because of the performance hits generated by client variables (database is their only option), that is not an option either. He asks: "What is the best way to store this data in some kind of session variable so it could be available for use in any page that needs it?"

Mark Rusnak is considering using WDDX and creating a packet containing a structure with all of the data needed for the session, stored it in a text field in MS SQL server.

Michael Smith noted that "Storing a WDDX packet in a memo field is a cool idea... but FYI, we have had problems with inserting large text fields into memo fields in SQL server and Oracle. The problem is that the ODBC driver has a limit on how big a single SQL statement can be. This appears to be approximately 16k in our set up and certainly is never greater than 64k.

"This is a problem with the WDDX approach; WDDX makes things about ten times bigger than they were to start with because of all the XML encoding, so with multiple structures, they get big fast!

"If you really need to insert or update large field then the workaround is to loop over them in CF, cutting them up into smaller chunks and updating them onto the end of the field:

UPDATE myTable SET myField = myField & "Next chunk"
WHERE ID=1234

"Hope this helps."

Source: ACFUG mailing list


Privacy | FAQ | Site Map | About | Guidelines | Contact | Advertising | What is ColdFusion?
House of Fusion | ColdFusion Jobs | Blog of Fusion | AHP Hosting