File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes How to access databse from Applet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to access databse from Applet?" Watch "How to access databse from Applet?" New topic
Author

How to access databse from Applet?

Robert Ploch
Greenhorn

Joined: Jun 05, 2002
Posts: 19
Hi
We have to create a game as JApplet. This Applet should load the levels/tasks from the project-page level by level, not instantly when the game starts.
The Applet should also load Hiscores while loading the game and save them after finishing the game into a database.
The main problem is, that we dont exactly know which technology to use.
We don`t have much experience in databases and connection-based programming, therefore it need`nt be fast. The maximum number of players is estimated about 100 at time.
Could you give me the best option for this problem? We discussed implementing a SQL-DB, which would fit our interests(and retrieving the stats) best.
Or does a better version exist?
With regards
Robert
danny liu
Ranch Hand

Joined: Jan 22, 2004
Posts: 185
My option is:
a. build a database component on the server side which connects to DB using JDBC
b. build EJBs that implement business logic via that database component
c. rewrite your applet to utilize the EJBs

Hope it helps.
Dan
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
EJB are overkill in almost all cases, this being one of them.
I think a fullblown database may be overkill here as well.
Store the levels as flat files which are cached in memory by the serverside process for performance.
Highscores can be stored in either an embedded database or also in a flat file (again, memory caching may be called for).
Create a simple server process communicating with your applet using a TCP/IP socket.
Make it multithreaded (thus you need to make your caching and/or data access code threadsafe).


42
wally fer
Greenhorn

Joined: Apr 28, 2004
Posts: 5
You can
1. have Applet to Servlet communication
2. servlet talks to the database
or
Have signed applet which directly talks to remote database. (Risky business)
Robert Ploch
Greenhorn

Joined: Jun 05, 2002
Posts: 19
Thanks so far for your suggestions.
@wally
Is the whole servlet-story difficult to implement? We only have 2-3 weeks time for that, without any experience in database-design ans so on.
It is also very hard to find sourcecode for this adventure, does anybody have some examples?
 
 
subject: How to access databse from Applet?
 
Similar Threads
Sony Ericsson K750i Game load
Is there any change in Class loader in JRE1.5 as compare to JRE1.3.1_01
Problems in applet 2 applet commnication on Java 5
Can't play Rules Roundup
JApplet Browser security issues