0

the applet(which make connection to access database) i developed is working fine in applet viewer, but when embedded in an html file, it cannot access the database. how can i rectify it?

1
  • Are you using localhost or 127.0.0.1 in your connection string Commented Mar 24, 2011 at 5:01

2 Answers 2

1

An applet lives in a security sandbox. In order for you to do file io, your applet jar(s) need to be signed.

http://introcs.cs.princeton.edu/85application/jar/sign.html

Sign up to request clarification or add additional context in comments.

Comments

0

Applets respect same origin policy. It cannot connect to any other sever other than where it is hosted. You database and your webserver needs to be on same ip.

1 Comment

It seems as though the JRE does not consider it to be the same site though. One typical case is where a non-relative URL is used to connect to the DB. E.G. A page at D:where/my/server/is/WEB-INF/applet/db-applet.html could not connect to 127.0.0.1:8080/db. The applet would need to come from 127.0.0.1:8080/applet/db-applet.html to make that work in a sand-box.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.