Hi all, This is my first post so I apologize if a break any protocols. I am creating an applet that has a table of data built from a database. One of the columns has buttons embedded in each cell so you can perform an action on the row of your choice. This data is then inserted into a row in a table. The problem I first encouontered was when I launched the applet, it gave an exception saying that access was denied. Once I looked into it, I found one solution that involved setting up a policy file on the local machine. This works great locally. Now, my real problem is that when I access this applet form another browser on another manchine, the applet is looking for the local database and policy file. How do I tell the applet to point the remote database and allow a user to perform actions on the rows in a table where the results are posted to the appropriate table? Thanks in advance for your help! kh
Correct me if I'm wrong, but what you're trying to do is not feasible. Look into Java Server Pages, then access one of those with your applet. This is called multi-tiered programming.
posted 18 years ago
Thanks, Nick. I appreciate your taking the time to respond. What I am building needs access to real-time data so I am using an applet to achieve this. Are you saying that I can have my applet send a request to a JSP/Servlet and allow the servlet to carry out all my DB actions? This was the direction we were toying with, but have never heard of anyone doing it (within our group). Or are you saying to get rid of the applet all together and just use JSP for the presentation. Somehow, I have to provide real-time data. Thanks again! kh
This still means changes to the local machine but.. Policy files can be remote, you need to add them (as URLs) to the search list in your java.security file on the local machine. In the policy file you can add java.net.SocketPermission to give you access to a specified remote machine. Hope that helps, Jennie
hi, i am having the same problems as ken - i am using borland jBuilder5 - and my applet is able to connect to the database when i hit the run button, but then when i use appletviewer - or a browser then it doesnt work - i always get the err: Cannot find the database driver classes. java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
now i understand what is happening here - its trying to access the JDBC drivers on my server but cant get to them. and I know what jennie was talking about policy files, but can you please go into more detail - what is the policy file supposed to look like? and where do i put it exactly?
Ken and Moiz, Check out a chapter from Marty Hall's Core Servlets and Java Server pages on using applets as servlet front ends here. As long as the applet is on the same server as your database you can have your servlet handle the db stuff and use your applet for prresentation. I did something similiar to this for a project my Senior year at Texas A&M so I know that it can be done.
posted 18 years ago
Thanks! I did take the advice of those who have posted to the thread as well as the instructions from O'Reilly's book on Servlets and have had this running for a little while now. This was a great exercise for me to learn "http tunneling" as well. I too went to A&M, but sure didn't get a chance to do any of this type of work as an MIS major. They didn't even offer Java until my senior year when I was no longer able to take it. You must be compSci They got all the cool tech classes. I got COBOL. kh
Self destruct mode activated. Instructions for deactivation encoded in this tiny ad.