Applet db access questions

Hi all,
I'm pretty new to applets. Can someone tell me:
1. Are there any major issues with communicating wtih mysql at run time?
2. To dynamically retrieve files from the server, are there security issues?
The reason for #1 is I would like a bit of warning before I get to the database portion of the applet
The reason for #2 is I tried pulling in a few sound files depending on the user's choice and I kept getting an security exception.
Thanks in advance!

By default applets can't access hosts other than the one it came from.
If you access a database (or any other resource, for that matter), you're basically exposing authentication credentials (unless the user types them in themselves). So it's good if you can only access stuff that should be publicly accessible. I don't know if mySql allows for any kind of anonymous access.
Hope this helps.

Similar Messages

  • NIGHTMARE! Signed Applet - No Access. Please Help.

    Hi:
    I'm trying to make a signed applet gain access to my directory structure.
    I created a simple applet to test with one line:
    sErr = System.getProperty("user.dir");
    The code is below.
    I sign it using the following:
    keytool -genkey -keyalg rsa -storepass MyCerts
    As you can see I'm using the default keystore but I've tried it by using -keystore MyKeystore too.
    It runs me through all the questions which I answer, no problems.
    Then I sign it:
    jarsigner -signedjar SSignedApplet.jar SignedApplet.jar MyCerts
    It asks for the passwords which I enter.
    It completes without error and the SSignedApplet.jar file shows up in the directory.
    If I open the signed jar file it has all 3 of the files in the META-INF folder and the Manifest file looks right to me.
    I upload the jar and the Default.asp file to a Web server (I've tried localhost and a remote host).
    I open the page and the pop up comes up asking if I want to trust the unverified applet. I click 'Run'.
    Once the applet is 'Started' I click the 'Get Properties' button and I get the error:
    access denied (java.util.PropertyPermission user.dir read)
    I've tried 2 examples that work fine on my machine (that I didn't write).
    The first is by Francois Orsini (Derby Demo) and the other is by Laura MacDougal (successfully wrote a file to my user.dir directory).
    No matter what I do, I can't sign an applet and make it access anything.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html lang="en-US">
    <head>
    <script language="JavaScript" type="text/javascript">
    <!--
    function getProp()
         oApplet = document.SampleApplet;
         oApplet.getProp();
         alert(oApplet.sErr);
    // End SCRIPT -->
    </script>
    </head>
    <body bgcolor="#ffffff" style="margin:0px auto;width:800px;padding:0px">
    <form name="fmLogin" action="" method="POST">
    <table width="650" align="center" cellpadding="0" cellspacing="0">
         <tr>
              <td>Login</td>
              <td><input name="Login"></td>
         </tr>
         <tr>
              <td>Password</td>
              <td><input name="Password"></td>
         </tr>
         <tr>          
              <td colspan="2"><input type="button" onclick="getProp();" value="Get Property"></td>
         </tr>
    </table>
    </form>
    <APPLET CODE="SignedApplet.SampleApplet.class" WIDTH=1 HEIGHT=1 NAME="SampleApplet" ARCHIVE="SSignedApplet.jar"></APPLET>
    </body>
    </html>
    package SignedApplet;
    import java.applet.*;
    import java.io.*;
    import java.util.*;
    public class SampleApplet extends java.applet.Applet {
        public String sErr = "";
        public void init() {
            // TODO start asynchronous download of heavy resources
        public void getProp()
            try
                sErr = System.getProperty("user.dir");
            catch(Exception exp)
                sErr = exp.getMessage();
        // TODO overwrite start(), stop() and destroy() methods
    }

    Thank you for reading my reply in your other thread:
    http://forum.java.sun.com/thread.jspa?threadID=762212&messageID=4368224#4368224
    If you've really run through it you would have known that code called from
    javascript is not trusted and you have to use doprivileged (hey its in bold...
    why would that be?).
    Call getProp from init within the applet and you've got no problem.
    As for your imageIcon, creating one with string as a parameter
    the string is used as input for a File. I had no problem loading one with a signed applet.
    I'll post the example later in your other thread.

  • When using Java Wizard with Firefox 3.6.23 on a Mac OS X 10.6.8 it keep getting an error message: "The Java Wizard cannot run. Please configure your browser to allow Java applets to access the filesystem." Have NO idea how to fix this problem.

    When trying to upload files I received the following error: "The Java Wizard cannot run. Please configure your browser to allow Java applets to access the filesystem."

    If the problem is with a site that is hosted using MOVEit DMZ by Ipswitch, please notify the site owner of the issue and ask them to apply the patch that is available on the support site to resolve the issue.
    This is a better resolution than downgrading your version of Java that was updated due to security issues.

  • Applet file access problem

    Hi, I am new to applets and I am trying to build an applet that needs input from other files on the server. How can I give my applet access to these files? I found some code with URLConnection, but I cannot seem to make it work. I am getting AppletNotLoaded appearing on the bottom of the webpage. Here is some of the URLConnection code, if anyone knows of mistakes in it:
    URL url;
    URLConnection urlConn;
         //DataInputStream     cfile;
         url = new URL(getCodeBase().toString() + "/R2Code/ourcode/data/"+filename+".con");
         urlConn = url.openConnection();
    urlConn.setDoInput(true);
    urlConn.setUseCaches(false);
    BufferedReader cfile = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
    //BufferedReader cfile = new BufferedReader(new FileReader (filename+".con"));
         cfile.readLine();
         StringTokenizer st = new StringTokenizer(cfile.readLine());
    I am trying to read in a text file, which has the ending ".con" if that concerned anyone. Any advice would be great, thanks.

    Here is the specific error from java console:
    load: class ProteinApplet3.class not found.
    java.lang.ClassNotFoundException: ProteinApplet3.class
    at sun.applet.AppletClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadCode(Unknown Source)
    at sun.applet.AppletPanel.createApplet(Unknown Source)
    at sun.plugin.AppletViewer.createApplet(Unknown Source)
    at sun.applet.AppletPanel.runLoader(Unknown Source)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: open HTTP connection failed.
    at sun.applet.AppletClassLoader.getBytes(Unknown Source)
    at sun.applet.AppletClassLoader.access$100(Unknown Source)
    at sun.applet.AppletClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    ... 10 more
    I am also getting errors saying that certain classes cannot be found, like point3f or anything from vecmath. Is there something to be done to fix this?
    It has to be finding the applet, just not loading it because its reading through the list of imports...

  • Applet in Netscape question.

    Hi, Applet in Netscape question.
    When an applet is run by Explorer everything is OK when trying to run with Netscape (7.1) nothing happening
    What is wrong here ???
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = "730" HEIGHT = "260"
    codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4-
    windows-i586.cab#Version=1,3,0,0">
    <PARAM NAME = CODE VALUE = "Xaaa.class" MAYSCRIPT>
    <PARAM NAME = ARCHIVE VALUE = "Ybbb.jar">
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.4">
    <PARAM NAME="scriptable" VALUE="false">
    <PARAM name="progressbar" value="true">
    </OBJECT>
    Thank you in advance !

    Dear Experts.
    Reading through previous Forum similar questions, I changed the code (down below)
    Now I receive the message:
    Click here to get the plugin
    This is encouraging because before Netscape ignored the applet completely ...
    However I already have plugin version 1.4.2_03 installed (and recognized by Explorer)
    The question is still why the applet is not working with Netscape ?
    Thank you in advance for your help?
    <html>
    <body>
    <!-- HTML CONVERTER -->
    <object
    classid =" clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    codebase =" http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#Version=1,4,0,0"
    width = 730 height = 260 >
    <param name = CODE value ="Xaaa.class" >
    <param name = ARCHIVE value ="Ybbb.jar" >
    <param name =" type" value =" application/x-java-applet;jpi-version=1.4">
    <param name =" scriptable" value =" false">
    <param name="progressbar" value="true">
    <comment> </comment>
    <embed
    type =" application/x-java-applet;version=1.4"
    code =" Xaaa.class"
    archive ="Ybbb.jar"
    width = 730
    height =260
    scriptable = false
    pluginspage =" http://java.sun.com/products/plugin/index.html#download">
    <noembed> alt="Your browser understands the <APPLET>
    tag but isn't running the applet, for some reason."
    Your browser is completely ignoring the <APPLET>
    tag! </noembed> </embed> </object>
    <!--"END_CONVERTED_APPLET"-->
    </html>
    </body>

  • Generate MF_password for a JCOP applet to access mifare ?

    Where can I download any tools to generate MF_Password?
    I find nothing in the Philips website.
    Or I should implement a generation function within the applet?
    Great thanks! ^_^

    Hi Divyesh,
    Thanks for your response!
    But I still can not understand what you mean.
    I reference: http://www.nxp.com/acrobat/other/identification/067512.pdf
    I only have JCOP41 eclipse help. According to the API
    readWriteMifare(short mode, byte[] data, short offset, short mifareBlocks)
    If I put the MF_password into the byte[] data, can I read/write mifare?
    After I run the JCOP applet and trigger the mifare access with sending APDU on JCOP shell command, 9000 is replied.
    But my access does not success.
    Am I wrong? Or where can I reference sample applet to access mifare?
    Regards,
    trylans

  • Applets and accessing files confusion

    Hi
    I am confused about applets and their abilty to access files.
    I know that applets cannot access files on a users hard drive until given pemission but if i design an applet that needs access to files on the server where it is running will it be able to read and write those files in the same location as the applet without the need to set permissions?
    Any feedback would be great
    Neil

    The applet is very much able to read files from the server. This is easiest done by creating a URL and opening a stream to it:
    URL url = new URL(getCodeBase(), "file.dat");
    InputStream in = url.openStream();
    // read from the stream...
    in.close();
    Saving files to the server is also possible without setting permissions but it's a bit harder. In short, you need some sort of server that accepts a connection and saves what you send it to disk. The server can be eg. a servlet, a database or a FTP server.

  • After downloadeding the latest Java plugin, I start to receive "Please configure your browser to allow Java applets to access the filesystem" message when I try to run a download wizard. What do I need to do? BTW, IE does not have this problem.

    I had no problem using a download wizard Java applet to download file to my computer from an SFTP site using Firefox. When I tried to do the same thing with Chrome, I was told to download the latest plugin. Once I did that, I receive the following message when I run the downlaod wizard:
    The Java Wizard cannot run.
    Please configure your browser to allow Java applets to access the filesystem.
    I got the same message using Firefox and Chrome. However, I have no problem using IE to run the same download wizzard. Please help.

    If the problem is with a site that is hosted using MOVEit DMZ by Ipswitch, please notify the site owner of the issue and ask them to apply the patch that is available on the support site to resolve the issue.
    This is a better resolution than downgrading your version of Java that was updated due to security issues.

  • How the applet can access local file system?

    1. I want to plugin the applet into the JSP. That applet should access the local file system. How to enable this programmatically.
    2. Is it is possible to embed a frame inside the JSP. If so how?
    Thanks in advance..
    K G Vinoth

    1: If you want the applet to access the client's local file system you'll have to sign the applet. There is a tutorial some where on the java.sun.com that explains how to sign an applet.
    2: No you;ll need to use an applet to display swing or awt components on the client browser.

  • Applet Security Access

    I'm trying to get an applet to access an AS/400s system status. The applet needs to connect to the AS/400 to get the system status measures...
    When I try to connect to the AS/400 through the main method of an application program everything works fine, however the applet fails and sas that access is denied--
    (java.security.AccessControlException: access denied (java.net.SocketPermission (AS/400-System Name) resolve))
    ...etc...
    What permissions do I need to give the applet to make the connection work, and how do I go about giving these permissions (ie..in a java.policy file, or in the program?)
    Thanks for any help you can provide!
    Bodie

    Hi there,
    I am desperately looking for the same answers.
    I found some articles at http://java.sun.com/sfaq/index.html.
    In some of the articles, it mentioned using acl.read acl.write for file access permissions for applets. The acl.read should be specified in a file ~/.hotjava/properties. I tried, and tried put .hotjava/properties at various places such as c:/windows, c:/, c:/windows/.java, c:/my doucuments..., and I am using appletviewer from jdk1.3.1_06, not any luck for me. Nothing worked yet.
    I'm trying to get an applet to access an AS/400s
    system status. The applet needs to connect to the
    AS/400 to get the system status measures...
    When I try to connect to the AS/400 through the main
    method of an application program everything works
    fine, however the applet fails and sas that access is
    denied--
    (java.security.AccessControlException: access denied
    (java.net.SocketPermission (AS/400-System Name)
    resolve))
    ...etc...
    What permissions do I need to give the applet to make
    the connection work, and how do I go about giving
    these permissions (ie..in a java.policy file, or in
    the program?)
    Thanks for any help you can provide!
    Bodie

  • Applet access question

    hi!
    I have an applet , the applet functions as a server .
    the server suppose to work on the users computer , meaning all the sockets and ports will be opened on the users computer not on the host where the applet sits .
    then i want the applet to write a log , but i want her to write it on hte host where she sits and not on the users computer .
    how do i tell the applet on what computer to act ?
    (host or client)

    can someone help ?
    how do i determine where the action will take place , in the host or in the user?

  • Applet file access security

    Hi, I'm trying to test my applet locally, but it came up with SecurityAccesExceptions when trying to access a required config file. I've been told this is because applets are prevented from accessing files not on a server, for security etc. So I stuck everything onto my local server and gave an absolute path to the file (http://localhost/config.xml). That worked, but I have 2 queries:
    1) The config.xml file then refers to another config file, in a field logconfigpath, which is accessed using new file(logconfigpath) in initialisation. Problem is, apparently the file constructer cant create a File from an absolute path like http://localhost/logconfig.xml. It says it cant find it... And if I set the logconfigpath to just be the relative path of the xml (logconfig.xml), it comes up with a security exception again... What to do?
    2) How does the applet know if its being run from a server or locally? I stuck everything onto my local server and tried giving xml paths relatively, and it still didnt like it. I still needed to provide its absolute path on my localserver. Does this mean when this is eventually implemented on a proper server, I'd still need to provide the file locations absolutely?
    Sorry if these are really basic questions...I'm quite the beginner...
    Cheers,
    Siam

    the important thing is who is running the applet. That 'thing' can install a SecurityManager, which decides what an applet can do. If you run in a browser, like ie, then the applet won't be allowed to access the local file system. If you run the applet in appletviewer, it will.
    To get around these problems, just sign your jar. It is a trivial thing to do
    First generate a digital signature in a keystore using the keytool command as
    keytool -genkey -alias myalias -keystore c:\mykey.store -keypass mypass -storepass mypass2then sign your jar file like
    jarsigner -keystore c:\mykey.store -storepass mypass2 -keypass mypass -signedjar c:\temp\mysigned.jar c:\temp\original.jar myalias

  • Applet and access a DataBase

    hi. i need to access a data base located in a server from an applet, so, it will refresh some values that are shown in the web browser.
    i need some suggestions
    thanks in advance
    David

    The easiest method is JSP's or servlets, use HTML forms to update the database tables. Applets make it harder cus of the security issues, im sure you did a search before posting this question (hint, hint).
    If you have to use applets then you will run into all the problems that eveyone else has posted in this forum.
    Rob.

  • Applet database access problems!

    Hi,
    I have a major problem. I'm trying to design an applet that can talk to a database server which is not the same server where the applet is hosted. I keep getting an exception like below: (note I changed my db server name)
    java.sql.SQLException: Unable to connect to any hosts due to exception: java.security.AccessControlException: access denied (java.net.SocketPermission aaaa.bbbbb.net resolve)
         at com.mysql.jdbc.Connection.createNewIO(Connection.
    help?

    Ok, I went back and re-read the answer to a similar question I asked earlier. Since I can't talk directly to the other db server, what is the work around?
    Make a php page that updates the database, then call that page from within the applet?

  • Applet security -- accessing files over the Web.

    I guess the topic pretty much sums up my question..
    I have an applet and I want to read a file from over the web.
    After creating a URL, I try to retrieve an inputstream by calling openStream() but I get all the java.security.AccessControlException: access denied rubbish..
    How do I get it working ?

    The applet can only read data from the server where it is saved. For security purposes applets have limited capabilities. They can't write data to a remote hard drive or read data from remote machines. A way around this is to create a "trusted applet". Basically what it does is informs any machine you are trying to access that you wrote this applet and are responsible for any negative outcome. There is a tutorial provided by Sun that can explain this better than I can. Here is the link:
    http://java.sun.com/security/signExample/index.html
    Good luck.

Maybe you are looking for