• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Tom Sakra
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 312
Java MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Create a DSN, use JDBC-ODBC driver to connect to the MS Database and use JDBC API to do the needful.
 
James Sabre
Ranch Hand
Posts: 781
Java Netbeans IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tom Sakra
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic