Database Connection through Applet

Hello All,
I want to connect to Access Database through Applet. But I am getting access denied error. How to allow an Applet to connect to the database ?.
Waiting for reply.
Thanks and regards,
Sachin

I believe it's possible to change the security policy for the java plugin that runs applets, (though I haven't found an appropriate policy file). However, there seems little point in writing an applet that requires that. The whole point of applets is that anyone can run your applets over the net without any special installation. If whoever is going to run your applet has to muck about with security policy files, they'd be a lot better off just running a stand-alone GUI program.
Even if you signed the applet there would still be the problems associated with having the access file in the right place on the client machine.
In short you're falling between two stools. Either make the thing a standalone Swing program and install it alongside the database it accesses or do the database access in a web server environment and have the client side obtain the data from the database through http access.

Similar Messages

  • How to get database connection in applet

    Hi,
    I am trying to prepare database connection in applet. After preparing connection with database it'll read same values from table.
    At the time of development it works fine. I have used esclipse IDE for coding and testing.
    But when I try to call that applet from browser. It is giving ClassNotFound exception.
    Does anybody know How to get database connection in applet ?
    Please help me if anybody know solution for this.
    Thanks,
    Rajesh

    As per my knowledge is conserned
    1 u can get the database connection in a jsp page and u send the result set as param to the applet and u can use retrieved values as if they were of the same applet if u r interested i can send the db connetion coding for jsp my id [email protected]

  • Can i change the database connections through MAXL Scripts?

    Hi,
    just want to know whether i can change the database connections through MAXL Scripts. i am using essbase 9.3.1.

    Hi John,
    I have built my rulefile by connecting to a database & now i want to change the database connections. I know i can change the database connections through frontend. ( File--> open file). I want to know whether i can change the database connections by writing any MAXL Scripts.

  • Database Connection through Event Handler

    Hi,
    i wanted oim database connection through post event handlers . Any idea how to achieve this.
    Thanks In Advance
    Swati Pandey

    Got the solution.
    - Swati Pandey

  • Database connection in applet works in Netscape but not in IE

    Hello,
    we have an applet which connects through an jdbc:odbc connection to an Access database.
    When we run it in Netscape 4.7, the applet connects to the database and finds records. When we run it in IE (5.5), we get an error.
    Haven't completely figured out where, but most likely when we try to get the connection:
    con = DriverManager.getConnection(url, "loginname", "password");
    We end up in the catch block.
    Any suggestions what the problem could be?
    TIA
    Gunter

    Can u send me code and let me see.
    Tell me all specification which Access driver you are using and which DSN you are using.
    Let me know i know i can help u out.

  • Jdbc connectivity through applet problem   urgent ASAP

    hi ,
    am trying to connect to the oracle database through applet. it gives a classnotfound exception . the same code works for other applications but not through the applet . why ? any idea to get it worked.I need to use this applet in a jsp file . in jsp file it gives an SQLexception as : java.security.AccessControlException:access denied(java.util.PropertyPermission oracle.jserver.version read)
    how do i get it solved . please help me.
    here is the applet code :
    import java.awt.*;
    import javax.swing.*;
    import java.lang.*;
    import java.util.*;
    import java.sql.*;
    public class Dot extends JApplet
        int xinterval,yinterval;
         private String message = "Initializing";
      //  int xexp=-40,yexp=20;
        Vector result = new Vector();
        Vector result1 = new Vector();
         public void init()
         int max = 100;
         int min = -100;
         xinterval = max/10;
         yinterval = min/10;
         try{     
         Class.forName("oracle.jdbc.driver.OracleDriver");
         Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORCL","chandu","chandu");
         PreparedStatement ps = con.prepareStatement("select name,expression_level,functional_classification from viewall where subexperiment_id = SRB4delta");
         PreparedStatement ps1 = con.prepareStatement("select name,expression_level,functional_classification from viewall where subexperiment_id = SRB5delta");
        ResultSet rs = ps.executeQuery();
        ResultSet rs1 = ps1.executeQuery();
         while(rs.next()){
              String arr[] = new String [3];
              arr[1]=rs.getString(1);
              arr[2]=rs.getString(2);
            arr[3]=rs.getString(3);
              result.addElement(arr);
    while(rs1.next()){
              String arr[] = new String [3];
              arr[1]=rs.getString(1);
              arr[2]=rs.getString(2);
            arr[3]=rs.getString(3);
              result1.addElement(arr);
         con.close();
         rs1.close();
         rs.close();
    catch (Exception e)
                  setError("SQLException: " + e);
         public void paint (Graphics g)
    if (result == null) {
             g.drawString(message, 5, 50);
             return;
         for(int i = 0 ; i<=10;i++){
              String temp= String.valueOf(xinterval*i);
              String temp1=String.valueOf(xinterval*(10-i));
              g.drawString(temp,500+(50*i),510);
            g.drawString(temp1,480,(50*i));
             temp=String.valueOf(yinterval*i);
              temp1=String.valueOf(yinterval*(10-i));
            g.drawString(temp,480,500+(50*i));
            g.drawString(temp1,(50*i),510);
         g.drawLine(500,0,500,1000);
        g.drawLine(0,500,1000,500);
        Enumeration enum = result.elements();   
        Enumeration enum1 = result1.elements();   
         while (enum.hasMoreElements() & enum1.hasMoreElements()) {
           String arr[] = new String [3];
             String arr1[] = new String [3];
           arr = (String [])enum.nextElement();
          arr1 = (String [])enum1.nextElement();      
         String col = arr[2] ;
         if(col.equals("CC"))
              g.setColor(Color.red);
         else if(col.equals("CF"))
              g.setColor(Color.green);
         else if (col.equals("S"))
              g.setColor(Color.blue);
         else if (col.equals("T"))
              g.setColor(Color.gray);
         else if (col.equals("U"))
              g.setColor(Color.pink);
         else if (col.equals("M"))
             g.setColor(Color.magenta);
         else if (col.equals("E"))
            g.setColor(Color.yellow);
         else
             g.setColor(Color.black);
        int xexp = Integer.parseInt(arr[1]);
         int yexp = Integer.parseInt(arr1[1]);
        g.drawString("test",500,600);
         if(yexp<0 & xexp>0)
          g.fillOval(500+((xexp/10)*50),500-((yexp/10)*50),8,8);
         if(yexp<0 & xexp<0)
                  g.fillOval(500+((xexp/10)*50),500-((yexp/10)*50),8,8);
         if(yexp>0 & xexp>0)
                  g.fillOval(500+((xexp/10)*50),500-((yexp/10)*50),8,8);
         if(yexp>0 & xexp<0){
                  g.fillOval(500+((xexp/10)*50),500-((yexp/10)*50),8,8);
        private synchronized void setError(String mess) {
         result = null;     
         message = mess;     
         repaint();
    }

    In contrast to what many people say in this forum, it is possible to have an unsigned applet access a database. You don't even have to manipulate the client's policy-file. The requirement is that the database is located on the same machine as the applet is downloaded from.There are however other things that can break this possibility. One is the database-driver itself.
    In the case of Oracle we have tried using different versions of the driver. When using version 8.1.7 or 9.0.1 things work nicely, but when switching to version 9.2 it stops working. There is a question on OTN [1]. Let's see what Oracle has to say about it.
    [1] Problem connecting using Oracle JDBC drivers

  • Database connection an applet

    Hi, I want to do an applet where I can connect to a SQL server via an ODBC. The whole conencting to the database works fine with an application, but access is denied when I use an applet ( ie. I have a separated class that do the databases connections and it failed when I use an applet).
    Somebody told me that I have to create a java.policy file for users and signed the applet with .jar. but I'm not familiar with either signing a jar(I'm not familiar with the .jar at all) and I'm not familiar either with the java.policy file. Can anyone explain this to me plz?

    signed the applet with .jar. but I'm not familiar with either signing a jar(I'm not familiar with the .jar at all)So...., check out the link shown below.
    http://developer.java.sun.com/developer/qow/archive/167/index.jsp
    ;o)
    V.V.
    PS: remember me?

  • Database Connection with applet

    my code is:
    public class Test extends JApplet implements ActionListener,ItemListener{
    public void init(){
                   Connection con=null;
                             Statement st=null;
                             try{
                                            Class.forName("oracle.jdbc.driver.OracleDriver");
                                            con=DriverManager.getConnection("jdbc:oracle:thin:@192.9.200.10:1521:FBIC","FBICEXT","FBICEXT");//"jdbc:odbc:FBIC","FBICEXT","FBICEXT"
                                            st=con.createStatement();
                                            String attSelect= "select GRP_CODE,GRP_NAMS from T_GRP";
                                            ResultSet rs= st.executeQuery(attSelect);
                                       while(rs.next())
                                            String Grpcode=     rs.getString(1).trim();
                                            String GrpName=rs.getString(2).trim();
                                            System.out.println(Grpcode+""+GrpName);               
                                       }catch(Exception e)
                                            System.out.println("Database Exception:"+e);
    i copied classess111.jar file into classpath in Eclipse and i copied same .jar file into package where applet classes exists.
    but it is giving following exception:
    Database Exception:java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    when i copy same code in normal class ,it is working fine
    could u please tell me where i should put this .jar file for drivers

    i found in http://forum.java.sun.com/thread.jspa?threadID=641300&tstart=100 thread with same problem,after creating policy file she solved his problem.
    how to create policy file and where it should it keep

  • REMOTE SERVER  MYSQL  DATABASE  CONNECTION THROUGH PROXY SERVER

    I want to connect to remote server through my proxy server, I have done all required parameter but the Exception is comming as follows :-
    Exception while connecting to database: java.sql.SQLException: Unable to connect to any hosts due to exception:java.net.ConnectException: Connection refused: connect
    Please help

    To clarify, if it helps, I have a database of event dates and and details which I wish to query in order to show the most imminent event on one page, and to display all forthcoming events on another.
    I would be happy to delve into whatever package is required to achieve this, but would prefer not to go down a whole set of blind alleys to get where I am going.
    If the recommendation is to find and install the original extensions, then great, but I don't have them in my Dreamweaver CC package. If there is a better, more up to date option then great; I am guessing/hoping that Adobe would not have taken one method away if there wasn't a better alternative.
    A push in the right direction would be most appreciated.

  • Database connection through JSP

    I am trying to connect JSP to MySql database.
    <body>
    <div id="container">
         <div id="containerleft">
         <!--     <img src="wildfern.jpg" width=200 height=1000> -->
         </div>     
    <div id="containerright"><center><h1>List Of Deliverables</h1></center><br><br>
    <table cellpadding="10">
    <tr>
    <td><h3> Number of Deliverables</h3></td>
    <td><input type="text" name="deliverableSize" size="20" onchange="DynamicBox(deliverableSize.value)"></td>
    <td></td>
    </tr>
    <tr></tr>
    <tr></tr>
    </table>
    <table>
    <tr>
    <td><h3><center>  Week</center></h3></td>
    <td><center><h3>       Deliverable name       </h3></center></td>
    <td></td>
    <td><center><h3>Weightage </h3></center></td>
    <td></td>
    </tr>
    <tr>
    <td></td>
    <td></td>
    <% 
                              try
                              Class.forName("com.mysql.jdbc.Driver");
                                catch(ClassNotFoundException e)
                                    out.println("Class nai milli bhai");
                                Connection dbh=null;
                               try
                                   dbh=DriverManager.getConnection("jdbc:mysql://172.20.200.21/B2","B2","ignite#1234");         
                                   Statement stmt = dbh.createStatement();
                                    String query = "select * from Parameters_Details;";
                                    ResultSet rs = stmt.executeQuery(query);
                                     while(!rs.next())
                                 %>       
                                 <td><%=rs.getString(2)%> </td>   
                                 <%  
                               }catch (SQLException sqle)
                                    System.out.println("SQL Error : " + sqle);
                               catch(Exception e)
                                   System.out.println("HELLLO"+e);
                               finally
                               //    dbh.closeConnection();
                                %>   
                                   <%--<td></td>
    <td></td>
    <td><center><h3> Core</h3></center></td>
    <td><center><h3>    SE</h3></center></td>
    <td><center><h3>      PE</h3></center></td>--%>
    </tr>
    </table>
    <div id="bottom">
    </div>
    <center> <input type="submit" value="Create" name="Submit">
    <input type="reset" value="Reset" name="Cancel"></center>
    </div>
    </div>
    </form>
    </body>
    It is showing following Exception.
    1>> org.apache.jasper.JasperException: org.apache.jasper.JasperException: Unable to load class for JSP
    2>> java.lang.ClassNotFoundException: org.apache.jsp.DeliverablesList_jsp

    1)<%--<td></td>
    <td></td>
    <td><center><h3>Core</h3></center></td>
    <td><center><h3>SE</h3></center></td>
    <td><center><h3>PE</h3></center></td>--%>
    :- Jasper exception indicates that it seems syntax error . You need to check out your code carefully. Give comments like this
    <% // %> OR <% /* */ %>.
    Or if you wanna comment only html code use <!-- <td> --> like this.
    Second thing why did you write while( !rs.next()) ? it should be while(rs.next())
    Best luck.

  • Database Connection (JDBC) by Applet

    Hi all,
    I create a database connection from applet ,it worked only compiler means Jbuilder.
    But just after I put it on tomcat It gave error .It didnt work there.It gives follwing error.
    access denied (java.lang.RuntimePermission accessClassInPackage.sun.jdbc.odbc)
    If any one knows the solution please help me.
    Thanks
    Virajchi

    Hi all,
    Dont worry about this question.
    I found the solution.
    Cant load directly Jdbc driver to the applet.
    That directly applet cant communicate with database.
    Cheers,
    Virajchi

  • Host Database Connection

    When I run an applet locally it fails to connect to a DB2 host database. The following error occurs even though the DB2 drivers are included in the CLASSPATH:
    com.ibm.ivj.eab.dab.DAException: NO_SUITABLE_DRIVER Unable to load
    DAMessages ResourceBundle.COM.ibm.db2.jdbc.app.DB2Driver
    Some of the code is shown below. I'd appreciate any ideas on why the connection fails. Thanks very much.
    private com.ibm.ivj.eab.dab.DatastoreJDBC getCRDatastore() {
    return crDatastore;
    public void connectCurrentDatastore() throws com.ibm.ivj.eab.dab.DAException {
    getCRDatastore().setDriver("COM.ibm.db2.jdbc.app.DB2Driver");
    String serverURL = new String("jdbc:db2:tsoca");
    getCRDatastore().setURL(serverURL);
    java.util.Properties userInfo = new java.util.Properties();
    String username = new String("Username");
    pw = "Password";
    userInfo.put("user", username.toString());
    userInfo.put("password", pw);
    getCRDatastore().setProperties(userInfo);
    try {
    getCRDatastore().connect(); <=== ERROR

    I should clarify that I'm trying to run my applet in an IDE called VisualAge. The class of the applet is in the same directory as the DB2 classes. I have one further question though. I've read a number of forum entries suggesting that some JDBC connection problems can be resolved by running the usejdbc2.bat file in the java12 directory after first shutting down all DB2 services. Is it possible that this might resolve the connection problem that I've described? I'm reluctant to run usejdbc2.bat simply because I can now establish a database connection through DB2 and do not want to lose this capability. Any suggestions?
    Thanks very much.

  • Please Help me in Labview and MS Access Database Connective

    Please Help me in LabVIEW and MS Access Database Connective through an example . I am new to LabVIEW .I need simple example that take a data from a table and display it on front panel .
    thanks in advance .

    duplicate post

  • Jsp-database connectivity problem

    hi
    There is a problem, when ever i write a jdbc code for database connectivity through MsAcess, in general applications it works fine. But when ever i try to the same using Jsps it throws an exception that " Microsoft jdbc-odbc driver not fount, Default driver not specified"
    please do help regarding this
    the code i used is
    package Products; import java.sql.*;import java.util.*; public class product{          public Vector getCategories()     {          Connection con;          Statement st;          ResultSet rs;          Vector ret=new Vector(1,1);          try          {               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");               con=DriverManager.getConnection("jdbc:odbc:Web");               st=con.createStatement();               rs=st.executeQuery("Select * from Categories");               while(rs.next())               {                         ret.add(rs.getString(2));                    );               }          }          catch(Exception e)          {               //System.out.println("Exception...");               ret.add(e.getMessage());          }          return ret;     }}

    Have you downloaded the driver and put it in your Web-Server?
    In tomcat you simply need to copy the file in:
    Tomcat 5.0\common\lib

  • Connectivity of database through applet

    Hi to all,
    I want to how to make the connectivity of database(preferably mySql) to java application through applet....

    Possible answers to a more focused question:
    Make sure the jar file containing the JDBC driver is in your applet's classpath.
    Read the JDBC tutorial.
    Make sure that the network connectivity between your client and the database is working.
    Any of those sound right? No? Want to ask a more specific question?

Maybe you are looking for