Two Laptop Bag*
The moose likes Applets and the fly likes Connecting to a local (microsoft) database, best approach? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Connecting to a local (microsoft) database, best approach?" Watch "Connecting to a local (microsoft) database, best approach?" New topic
Author

Connecting to a local (microsoft) database, best approach?

Tom Sakra
Greenhorn

Joined: Oct 09, 2010
Posts: 8
I have a microsoft database, however I can't connect to it directly through the internet - only locally, but I need to access it from an applet. So I was just wondering what kind of approach you guys would suggest to accomplish this? The microsoft database have to stay the way it is because it's administrated by a C# program, so the approach have to involve some way of contacting the database and passing on the result (true/false).

The interaction with the microsoft database is really simple, it's just a basic authentication (checking username/password) before the user is allowed to use the rest of the applet (connecting to a mysql database).

My first thought was using an application server (glassfish), but that approach seems way too involved and complicated to solve such a simple task.

Thanks in advance!
Madhan Sundararajan Devaki
Ranch Hand

Joined: Mar 18, 2011
Posts: 312

Create a DSN, use JDBC-ODBC driver to connect to the MS Database and use JDBC API to do the needful.


S.D. MADHAN
Not many get the right opportunity !
James Sabre
Ranch Hand

Joined: Sep 07, 2004
Posts: 781

If you are launching your Applet from a Servlet engine such as Tomcat or Jetty then my approach would be to have one or more Servlets that perform ALL database access and have your Applet invoke the Servlets using a very restrictive set of actions when they need to read or write data.

There are some security advantages to using this approach. Each client can be made to log on (user name and password may be enough) and then there is no way for anybody to access the database directly; the database password is never exposed outside the Servlet and, if using HTTP or HTTPS (the preferred approach), there will be no firewall problems.


Retired horse trader.
 Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
Tom Sakra
Greenhorn

Joined: Oct 09, 2010
Posts: 8
James Sabre wrote:If you are launching your Applet from a Servlet engine such as Tomcat or Jetty then my approach would be to have one or more Servlets that perform ALL database access and have your Applet invoke the Servlets using a very restrictive set of actions when they need to read or write data.

There are some security advantages to using this approach. Each client can be made to log on (user name and password may be enough) and then there is no way for anybody to access the database directly; the database password is never exposed outside the Servlet and, if using HTTP or HTTPS (the preferred approach), there will be no firewall problems.


Thanks for the solution, this seems like the way to go!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Connecting to a local (microsoft) database, best approach?
 
Similar Threads
If a user clicks the close box (X) on an applet window
Fully asynchronous progressbar
Type 1 - Type 4 driver
Design Question
db access through applet