aspose file tools*
The moose likes Servlets and the fly likes How can I save temporary data in Server?    Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How can I save temporary data in Server?    " Watch "How can I save temporary data in Server?    " New topic
Author

How can I save temporary data in Server?

Cainiao Zou
Ranch Hand

Joined: Mar 03, 2009
Posts: 36
Hi all,
I need to save some data in server and share to many users. I cannot save them in cookie, session. because they are in client and cannot be shared to each other. The only methed I found is save them to database, but for some temporary and often changed data that may be a bad idea. Can I just save them in the memory of Server?

Thanks
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684

Can I just save them in the memory of Server?


how can you save data into memory of Server?

I think database is the best way to share to many users.

Or

you can write data into file also and share to many users. But i think database is best way to perform this.


Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3775

What kind of data are this? Is it possible to use ServletContext if data are not that huge ?


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Cainiao Zou
Ranch Hand

Joined: Mar 03, 2009
Posts: 36
first of all, thanks to your reply.

I want to make a ajax-based card web game, there are many temporary data, like how much life left, how much mana left, which card he has... for every action of the user I need to update the database. it's like every second for each online user one update on database! So I just thinking about other method. I think for the traditional online game, which connects with UDP/TCP, they have no such problem, they just save them in memory, right?
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

"roo kie" please check your private messages for some administrative matter.


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1506
Look into the ServletContext, and see if that will serve your needs.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
kirans reddy
Greenhorn

Joined: May 02, 2009
Posts: 15
Use File.createTempFile
Lorenz Baylon
Ranch Hand

Joined: Jan 04, 2006
Posts: 99
What if you save them as properties of a singleton object, since if I'm not mistaken, the data that you need to save are read-only to the users.


I just cant look, its killing me.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I save temporary data in Server?
 
Similar Threads
Generating PDF from Servlets
response to JSP
Update Database with the better way
unable to read file header
how to overwrite a file in server