Applet to database communication using beans...

Applet to database communication using beans...

Post by Brendan Lawlo » Thu, 21 Sep 2000 04:00:00



Hi,
   I know enough about Java adn JDBC, but I don't have a whole lot of
'industry' information,
that is, the standard industry ways of dealing with standard problems. Could
somebody please
make some suggestions for the following scenario:

I'm writing a bean that interacts with a data access bean (which uses JDBC).
The bean works
well in an application setting, but I think in an applet it would have
problems. Not because
of the bean itself, but because of the fact that any applet that used the
bean would need to use
a data access bean.

I understand that JDBC allows for connection even to a remote database, but
the security
aspect of Java applets won't allow (without signing) access to any other
machine accept the
one from which it was downloaded. Having read about JSP, it looks like the
ideal way to
accesss remote data, using a data access servlet. That's fine if you're
happy to use an
HTML form as a front end, but what about my case, where I want to use an
applet (with
my bean in it)? How does an applet communicate with a servlet? Must it be
through
HTTP/XML? This seems wasteful - all that request-forming and reply-decoding
would be very time consuming. RMI seems like a way to avoid this, but here
is my problem:
I don't want to reinvent the wheel. Is there some standard way to establish
non-HTTP comms
between applets and servlets? Can RMI be used in this context?

Apologies for the vague line of questioning but I hope this issue rings a
bell with somebody
out there.

Thanks,
Brendan Lawlor.

 
 
 

1. Applet Servlet Communication in NES using Object Serialization

Hi , I am having a serious problem trying to send an object to the NES
server using ObjectOutputStream. I create a URL for the servlet
                    and then set the SETDoOutput(true) on the URLConnection
object . Now I create a ObjectOutputStream from the the URLConnection
                    Object and write a simple string to the servlet. The
problem happens when the servlet is trying to read the Object(String). It
generates a
                    streamCorrupted exception as follows:

                    failure (16079): Internal error: exception thrown from
the servlet service function (uri=/servlet/AjayServlet):
                    java.io.StreamCorruptedException: Caught EOFException
while reading the stream header, Stack: java.io.StreamCorruptedException:
                    Caught EOFException while reading the stream header at
java.lang.Throwable.fillInStackTrace(Native Method) at
                    java.lang.Throwable.fillInStackTrace(Compiled Code) at
java.lang.Throwable.(Compiled Code) at
                    java.lang.Exception.(Exception.java:42) at
java.io.IOException.(IOException.java:47) at

java.io.ObjectStreamException.(ObjectStreamException.java:29) at

java.io.StreamCorruptedException.(StreamCorruptedException.java:30) at

java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:727) at
java.io.ObjectInputStream.(ObjectInputStream.java:165)
                    at AjayServlet.doPost(AjayServlet.java:15) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:538) at

javax.servlet.http.HttpServlet.service(HttpServlet.java:611) at
com.netscape.server.http.servlet.NSServletRunner.Service(Compiled
                    Code)

                    This Servlet runs fine on JavaWebServer2.0. The servlet
also runs fine if I write the string using DataInputStream from the applet
and read
                    it on the servlet from DataOutputStream. Iam also able
to return a String object from the server to the applet using
ObjectOutputStream
                    but the problem is with reading the object sent to the
servlet.

                    Please Help.

                    Thanks in advance.

2. Zugriff von VB auf Oracle

3. Communication Java Applet and Oracle Database

4. Codebook Update FTP Site ?

5. Visual DB connection with Applet / Servlet or Bean?

6. delete old data automatically

7. Using Java client-side applet to connect to database using Netscape Enterprise 3.0

8. bcp problems

9. communication between CGI-scripts and Databases (using HTML for a database application)

10. http communication between applet and servlet

11. Applet-Servlet Communications.

12. Applet to Oracle communication

13. Communication Servlet-Applet