Re: Is it bad to connect to a database via an applet?
  Home FAQ Contact Sign in
comp.lang.java.programmer only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: Is it bad to connect to a database via an applet?         

Group: comp.lang.java.programmer · Group Profile
Author: Dave Miller
Date: May 15, 2008 22:13

jmDesktop wrote:
> I was trying to figure out how to connect an applet to a mysql
> database. I only found very old articles on it. It seems no one does
> this. So, now I am stuck. I want to write a game in an applet that
> utilizes a database. I don't want to use Flash and php, which I keep
> reading folks use. I want use Java. I just don't know the proper
> design. Do I have a middle page, a servlet, that sits on the server
> the applet talks to and that middle page talks to the server and
> selects/updates the database? Thanks.
There is no play in Arnie's advice about not having your client side
code talk directly to the DB - there is no way to do that without
shooting yourself in the head.

The simplest safe way to get the data from the db on the server to your
applet on the client is to build a servlet as your middleware. MySQL has
an easy to use jdbc driver available here:
http://dev.mysql.com/downloads/connector/j/3.1.html
Both applet and servlet have built in methods for http communication.
Applet and servlet connect via http, servlet and db connect via jdbc and
you're good to go.
--
Dave Miller
Java Web Hosting at:
http://www.cheap-jsp-hosting.com/
no comments
diggit! del.icio.us! reddit!