jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes Applet-Database Connectivity. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Applet-Database Connectivity." Watch "Applet-Database Connectivity." New topic

Applet-Database Connectivity.

Anunay Ashish

Joined: Aug 30, 2002
Posts: 7
Hi All,
Is it possible to retrieve and post data directly to a database without any intermediary ASP, JSP or Servlets?
Anunay Ashish

Anunay Ashish<br />Software Engineer<br />India
Stefan Zoerner
Ranch Hand

Joined: Nov 29, 2001
Posts: 121
It is possible to connect from an applet to a JDBC-aware DB (with a type-4 JDBC-Driver deployed with the applet for example), but I would not recommend that in an production/internet scenario.
Greetings from Hamburg,

Stefan Zoerner
Author of German LDAP-Book
Committer at Apache Directory Project
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

You can use JDBC to do generic database I/O or JNI for more server-specific cases.
However, applets are forbidden by the sandbox - and more importantly by most firewalls - from using either technique. You can get around the sandbox by applet signing, but not every firewall in the world is under your control.
Java applications do not have the sandbox limit - though they still may have to deal with firewalls. In certain cases, such as producing offline reports, a Java application using JDBC is appropriate.
However if you're operating in an Internet-style environment, it's strongly recommended you use 3-tier programming techniques. While the amount of code required is greater, the architecture works more effectively.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link: http://aspose.com/file-tools
subject: Applet-Database Connectivity.
It's not a secret anymore!