Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How can an applet connect to a database?

applet Connect database
0
Posted

How can an applet connect to a database?

0

Accessing a DB from an applet is not fundamentally different than connecting from any other piece of Java code. The one important restriction is that applets can only make network connections to the host where they originate (i.e., where the web server is located). If the DB is not located on that machine, the applet will either have to be signed (which gets around the host restriction; the details are described above), or the applet needs to route the DB calls through a DB proxy on the web server host, which takes the DB calls, transmits them to the proper DB host, and then sends the results from the DB server back to the applet. Note that it is considered bad design to mix DB access code with presentation code (which is what applets are). Consider a design where the applet accesses a servlet, which in turn accesses the DB. That also gets around the host restriction. A further benefit is heigthened security, because the client can no longer send SQL statements directly to the database

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.