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.

Similar Messages

  • 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.

  • JSP and Access 2007 database

    i've been trying to look for codes on how to access the Access 2007 database (.accdb).
    i've done a previous JSP app with Access database, but it is of a lower version (.mdb).
    i need something like the following, but for the 2007 version. is it just a matter of changing the extension for both statements, or is there more to it?
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String DBQ = request.getRealPath("sales.mdb");
    String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=" + DBQ + ";DriverID=22;READONLY=true";thanks.

    <%@page import="java.sql.*" %>
    <table boder="1">
    <%
    Statement statement;
    Connection conn;
    String url = "jdbc:mysql://localhost/dbName";
    String user = "username";
    String pass = "password";
    try {
        class.forName("com.mysql.jdbc.Driver");
        conn = DriverManager.getConnection(url, user, pass);
        statement = conn.createStatement();
    String query = "SELECT images FROM database";
    ResultSet results = statement.executeQuery(query);
    while(results.next()) {
    %>
        <tr>
            <td><img src="<%= results.getString("images") %>"></td>
        </tr>
    <% } %>
    </table>The while loop will loop through your result set and print the table row for each image it finds in the query.
    Hope this helps,
    Jon

  • Applet and Access Database

    How can I use an Access Database with a web applet? I can do it on my machine because I can set the data source. However, I can't set the data source on the server I'm uploading my web page to. Suggestions?

    You may be able to find some third party vendor that wrote a JDBC driver for Access that allows you to connect directly, but I doubt you'll find one.
    I don't know what you are needing to do exactly, but have you considered using an XML file?

  • MHP and access to Databases

    Hello, I'm developing a MHP 1.0.3 application with Osmosys. The application provides patient the posibility to book an appointment with their hospital. I have finish the GUI of my applicattion and now I'm working in another issue.
    I need to connect to a database to read some fields of a table (where I have stored some information about the hospital). I think that I need JDBC Optional Package CDC. Am I right?
    About Databases: Do I need to work with Db4o or can I choose MySQL?
    Obviously I have and ADSL connection to work with the return channel.
    If somebody has an code example about this, post it please.
    Thank you

    Here you are an example of reading some text from a servlet that access to a database:
    I have copied this method from: http://www.cineca.tv/labs/mhplab/index-en.html
    public static String readHttp(String s)
    String s1 = null;
    if(connected)
    try
    URL url = new URL(s);
    HttpURLConnection httpurlconnection = (HttpURLConnection)url.openConnection();
    httpurlconnection.setDoInput(true);
    LineNumberReader linenumberreader = new LineNumberReader(new InputStreamReader(httpurlconnection.getInputStream(), "UTF-8"));
    s1 = "";
    String s2 = linenumberreader.readLine();
    do
    if(s2 == null)
    break;
    try
    s1 = s1 + s2 + "\n";
    s2 = linenumberreader.readLine();
    continue;
    catch(Exception exception1) { }
    break;
    } while(true);
    System.out.println("MXRc:response: " + s1);
    httpurlconnection.disconnect();
    catch(Exception exception)
    exception.printStackTrace();
    System.out.println(exception);
    return s1;
    The URL is the string that you use to access to your servlet, you always may use GET method to send explicitely the parameters: http://localhost/WebApp/Servlet?param1=3324&param2=23423....
    If the servlet returns a String you can obtain it via readHTTP method,ok?
    If you have more problems ask me again
    Abel

  • Can we connect and access SAP database using db adapter?

    Hi,
    I need couple of details:
    1) Can we connect to SAP database using db adapter and run select query to extract data from the SAP database tables?
    2) Where can I download SAP adapter? How to install it? and how to plug that in to the JDev?
    Cheers

    1) Can we connect to SAP database using db adapter and run select query to extract data from the SAP database tables? It is possible as long as back-end DB version of SAP are supported by DB adapter. Oracle recommends SAP connectivity through Oracle Application Adapter for SAP rather than direct connection to SAP Database tables.
    2) Where can I download SAP adapter? How to install it? and how to plug that in to the JDev?http://www.oracle.com/technology/products/integration/adapters/pdf/DS_OracleASAdapter_SAP.pdf
    http://www.oracle.com/technology/software/htdocs/devlic.html?url=/technology/software/products/ias/htdocs/101202.html
    http://download.oracle.com/docs/cd/E12524_01/doc.1013/e14201/toc.htm (Installation)
    http://download.oracle.com/docs/cd/E12524_01/doc.1013/e14196/toc.htm (SAP adapter configurtation)
    Manoj

  • Parallel access of database

    I need to have parallel access to a database from two different application.
    The first application is a TestStand program that will open this database and then write into the database. This open and write process will occur continuously as new data are needed to be logged inside the database.
    The second application is a VI that will fetch data from this database. This VI will open the database and read data from it. This VI will also run continuously as it attempts to extract any new data entered into the database.
    As you can see, there is a potential problem. MS Access allows only one access at any time and therefore for my two applications to open and access the database at the same time has been causing me problems.
    I have tried
    opening the database and then freeing the database after every data entry but still it won't work very well.
    Any suggestion on the best method to go about doing this? I only intend to use LabVIEW features. I'm using especially the database connectivity toolkit. Thanks for any help.
    Sincerely
    Parker

    Scotty Parker wrote:
    > What do you mean by a "real" database? And so, how do I configure MS
    > Access such that it can handle multiple clients. I know this could be
    > done but I don't know how to.
    Well, I don't consider MS Access a real database. SQL Server, Oracle and
    such are databases, but MS Access is just an office application which
    happens to have some database functionality.
    I have no experience with MS Access. I know that I can do what you want
    without any problems in SQL Server and other database applications, but
    they are also in a different price range than Access.
    > When I run my VI on the remote computer while Teststand is also
    > logging into the database on the other computer, my VI was able to
    > capture data from the database.
    However, TestStand halts to a run time
    > error.
    This really seems to be a problem with Access then. I could possibly
    understand if you had problems when both applications are on the same
    computer as that might mean, that the ODBC driver has a limitation and
    can only serve one application at one time. But not working from
    different computers seems to hint that MS Access itself can't handle
    multiple connections at the same time, and the ODBC driver takes care of
    that when you access the database from multiple applications on the same
    computer.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Crystal XI and Access 2010 64bit compatible?

    Hi,
    I am developing a web application which uses crystal XI for report viewing and an Access database. I found that I had to change the application pool to 32bit because my MDB file was 32 bit and the DAO does not support 64bit. I recently created a new database in Access 2010 and realised the file extension was accdb. Does this mean that Microsoft Access 2010 now supports 64bit and can I open this database in Crystal XI using 64bit technology?
    Appologies if I have posted this in the wrong section but the end question is relating to opening and access 2010 database in Crystal XI.
    Many thank for any help,
    Jiggy

    See the KB [1686419 - SAP Crystal Reports designer does not recognize Access *.accdb file|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333633383336333433313339%7D.do]. This KB will apply to your version of CR also.
    Also see [this|http://forums.sdn.sap.com/thread.jspa?threadID=2111067&tstart=0] forum thread.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

  • Applets and DataBase Access

    Hello, I want to know if it's posible data base acces from a Applet and how do it. The SQLException: No suitable Error is always in the output.The Applet code is:
    import java.applet.*;
    import java.awt.*;
    import java.util.*;
    import java.sql.*;
    import java.net.*;
    import java.io.*;
    public class CreateCoffees extends Applet
         String url = "jdbc:oracle:thin:@localhost:1521:BD";
    Connection con;
    String createString = "insert into COFFEES " +
    "values('Pepe')";
    Statement stmt;
    TextArea textarea = new TextArea();
    public void init()
    setLayout(null);
         textarea.setBounds (10,50,280,150);
         textarea.setText("Empieza");
         add(textarea);
         try
    Class.forName("oracle.jdbc.driver.OracleDriver");
    } catch(java.lang.ClassNotFoundException e) {
         System.err.print("ClassNotFoundException: ");
    System.err.println(e.getMessage());
    textarea.setText(e.getMessage());
    try {
    con = DriverManager.getConnection(url, "SYSTEM", "manager");
    stmt = con.createStatement();
    stmt.execute(createString);
    stmt.close();
    con.close();
    } catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    textarea.setText(ex.getMessage());
    }

    A no suitable driver error means that either your connection string is incorrect or you are not loading the driver (or failing to load it and ignoring the exception.)
    Presumably you have already dealt with the problem of delivering the oracle zip file with your applet?
    And you are not getting the not found exception in your code?

  • WHY can't I access my database from an applet???????????

    The security code won't let my applet access its own database (from its own server)..
    I'm using getDocumentBase()
    to try and tell it that it is my own damn file..
    I keep getting :
    java.securityAccessControlException: access denied <java.util.PropertyPermission jdbc.drivers write>
    ...etc.
    This applet crap is really starting to piss me off. I can see why they came out with JSP.
    All I need to do is access my database, update it, etc. It kind of defeats the purpose of being able to do jdbc from applets if you can't even access the database on your own damn server.
    If you all don't have a clue, I'm freakin switching to PHP--I'm tired of this crap-I was thinking Java was a damn good language until I hit applets.

    The simple answer to your question is: Because of security concerns.
    The somewhat longer answer is that directly accessing a database from an applet is generally not a good idea. A lot of security-critical code like DB username/password must be hidden in the applet which potentially can be downloaded (and disassembled) by anyone that hits your webpage. Maybe you do an intranet solution with trusted users but that is not what applets were originally designed for.
    The clean way is to make your applet talk to a servlet that talks to your database.
    If that is not the way you want to do it, make sure that all client policy files (yes, on the browser machine) contain the permissions that your applet needs.

  • Access a database in applet

    2002-4-17 15:46
    I can run application program to handle a database ,
    But when I convert the code of application to the code of applet,
    then i run appletviewer ***.html;
    it tell me that it cant access the database ,
    "java.security.AccessControlException: access denied (java.lang.RuntimePermission
    accessClassInPackage.sun.jdbc.odbc)"
    why?
    How to resolve it!
    thanks

    This is due to the Default SecurityManager in Applet.If u run as a simple application u don't get any AcessControlException.
    By Default Applet is having its own SecurityManager and for Applications haven't.
    So two possiblities are there to acess the DataBase.One is by writing a permission file for the SecurityManager and add to the Envroinment.ie assigning permissions
    Other is write an servlet which retrives data from the database and the applet gets data from the
    servlet.This the the normal way which people are using.

  • I m using ms access as database and i want to create a login page in java

    hye frnz... plz help me m new to java
    m using ms access as database and try to create a login page where user type username and pw
    i had enter valid user entries in database i checked connectivity is working i want as user login the main window must open after checking username and pw field to database but
    now there is an error class not found exception sun:jdbc...... error
    plz help me i had stuck frm 4 days */
    import java.sql.DriverManager;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class Login extends JFrame
    //Component Declarations
    JLabel jlb1,jlb2;
         JTextField jtf1;
         JPasswordField jpf1;
         JButton jb1,jb2;
         //Constructor
         Login()
         //frame settings
              setTitle("Login Dialog");
              setLayout(new GridBagLayout());
              GridBagConstraints gbc = new GridBagConstraints();
              setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              Dimension d= Toolkit.getDefaultToolkit().getScreenSize();
              setBounds(d.width/2-175,d.height/2-100,350,200);
              gbc.insets=new Insets(7,7,7,7);
         //adding components
              jlb1=new JLabel("User ID");
              gbc.gridx=0;
              gbc.gridy=0;
              add(jlb1,gbc);
              jlb2=new JLabel("Password");
              gbc.gridx=0;
              gbc.gridy=1;
              add(jlb2,gbc);
              jtf1=new JTextField(10);
              gbc.gridx=1;
              gbc.gridy=0;
              add(jtf1,gbc);
              jpf1=new JPasswordField(10);
              gbc.gridx=1;
              gbc.gridy=1;
              add(jpf1,gbc);
              jb1=new JButton("Login");
              gbc.gridx=0;
              gbc.gridy=2;
              add(jb1,gbc);
              jb1.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                   Connection conn=null;
                        Statement stmt=null;
                        boolean found=false;
                   try
                             Class.forName("sun.jdbc.driver.JdbcOdbcDriver");
                             String dataSourceName = "Inventory";
                             String dbURL = "jdbc:odbc:" + dataSourceName;
                             conn=DriverManager.getConnection(dbURL, "","");
                             stmt=conn.createStatement();
                             ResultSet rst=stmt.executeQuery("Select * from User");
                             System.out.println(jtf1.getText()+"/t"+jpf1.getPassword());
                             while(rst.next())
                                  System.out.println( rst.getString(1) +"/t"+ rst.getString(2));
              if(jtf1.getText().equals(rst.getString(1).trim()) && new String(jpf1.getPassword()).equals(rst.getString(2).trim()))
                                       found=true;
                                       rst.close();
                                       dispose();
                                       MainWindow mw= new MainWindow();     /*created min window object created to be opend after login but not working*/     
                                       break;
                             rst.close();
                             stmt.close();
                             conn.close();                    
                        catch(ClassNotFoundException e){System.out.print(e);}
                        catch(Exception e){System.out.print(e);}
                        if(found==false) /*this portion is executing and dialog box appears invalid name and pw with class not found exception sun:jdbc.......on console */
                             JOptionPane.showMessageDialog(null,"Invalid username or password",
                                  "Error Message",JOptionPane.ERROR_MESSAGE);
              jb2=new JButton("Clear");
              gbc.gridx=1;
              gbc.gridy=2;
              add(jb2,gbc);
              jb2.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        jtf1.setText("");
                        jpf1.setText("");
                        jtf1.requestFocus();
              setSize(350,200);
              setVisible(true);
              jtf1.requestFocus();
         public static void main(String args[])
    Login l=new Login();
    }

    http://forums.oracle.com/forums/ann.jspa?annID=599
    Oh, and by the way, your keyboard seems to be broken as your words are not getting spelled correctly.

  • Hello there, I am creating a database of all our companies press contacts. I would like to create a form that would act as the front end and feed the database which is obviously the back end. The database is in Access 2013. My question is to whether this

    Hello there, I am creating a database of all our companies press contacts. I would like to create a form that would act as the front end and feed the database which is obviously the back end. The database is in Access 2013. My question is to whether this is indeed possible?

    This forum thread appears to point towards the problem.
    Re: Unable to Switch Audio Sync Settings

  • Mac being unable to sever connections and I can't access secure databases

    Recently my university library underwent a security rehaul, since then I have been unable to access secure databases to do research for papers and the like. After resetting my browser, emptying my cache, and shutting down my computer, I am unable to sever my old connection to the library page.
    The weird thing was I was in a chat with a librarian at the school at the time, and it never signed off even when my computer was shut down...
    What do?

    This will tell you if your apps are compatible:
    http://roaringapps.com/apps:table
    Thanks ... Ken

  • VB 2008, CR component and MS Acc: how to access with database(not user) pwd

    These are the detail of the query:
    1. MS Access 2003 and later database via OLE DB provide for entry of a u201Cdatabase passwordu201D to provide additional protection.
    2. In VB 2005 and in VB2008 environment I have managed to establish a connection with a database password and open recordsets using ADO connection. See code below.
    Note. stPassword is user password and stDBPassword is database password with the following code:
    With cnn
              'set connection string
              .ConnectionString "Provider=Microsoft.Jet.OLEDB.4.0; Password=" & stPassword & ";Data Source=T:\CPI.mdb;User ID=" & stUser & ";Persist Security Info=False;" & "Jet OLEDB:System database=t:\cpi.mdw;Jet OLEDB:Database Password=" & stDBPassword
              .Open()  
    End With
    3. When using Crystal Reports component supplied with VS 2008 I can only provide USER NAME and USER PASSWORD. No information is available how and where to enter DATABASE PASSWORD to the Crystal Reports component. As a result, Crystal Reports Viewer starts to run. Obviously access is denied because no DATABASE PASSWORD has been provided to the component. A common dialog comes up to enter database password.
    4. User does not necessarily need know the DATABASE password and I am not interested in providing the database password to every user who runs reports. In this project database password serves as a form of protection from tampering with the database structure and contents through the use MS Access to access the database.
    5. Here is the code to demonstrate logon via Crystal Component described above:
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    And then in a sub:
        Dim cnnInfo As ConnectionInfo = New ConnectionInfo()
        'cnnInfo.DatabaseName = cnn.DefaultDatabase
        cnnInfo.UserID = stUser
        cnnInfo.Password = stPassword
    No place to input DATABASE password!!!
    Does anyone know how can I input database password or provide a connection string or maybe ADO connection object which is opened within the project code.

    It seems like it is not possible to set the DB level password with the CR Visual Studio bundled version (as stated in the following KB c2010267). You would need to use the full version, and use the code below:
    Symptom
    A VB .NET application uses Crystal Reports for Visual Studio .NET as the reporting development tool.
    A report is created that connects to a password protected Microsoft Access Database.
    How do you pass a password (for database level security) or a password and user ID (for user level security) at runtime using the different connection methods(Native/ODBC/OLEDB)?
    Resolution
    To pass the database level password or a user level
    userid/password at runtime, use the following code
    sample:
    'Add the following namespaces to the top of the code
    'page
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    Dim crReportDocument As New ReportDocument()
    Dim crConnectionInfo as New ConnectionInfo
    Dim crtableLogoninfo As New TableLogOnInfo()
    Dim CrTables As Tables
    Dim CrTable As Table
    crReportDocument = New CrystalReport1()
    With crConnectionInfo
    <**Insert code from below depending on the type of
    connection and the version of Crystal Reports you are
    using**>
    End With
    CrTables = crReportDocument.Database.Tables
    For Each crTable in crTables
    crTableLogonInfo.ConnectionInfo =
    crConnectionInfo
    CrTable.ApplyLogOnInfo(crTableLogOnInfo)
    Next
    CrystalReportViewer1.ReportSource =
    crReportDocument
    Database Level Security
    " For Native and ODBC connections, use the following
    code:
    .Password = "Password"
    " For OLEDB connections, use the following code:
    .Password = chr(10) + "Password"
    ====================
    NOTE:
    You cannot set a database level password when
    using Crystal Reports for Visual Studio .NET 2002 or
    2003.
    ====================
    User Level Security
    " For ODBC and OLEDB connections, use the following
    code:
    .Password = "Password"
    .UserID = "UserID"
    For ODBC connections, in the ODBC data source, you
    have to point the system database to the appropriate
    MDW file. In addition, click the 'Advanced' button and
    specify the User ID and password.
    ====================
    NOTE:
    You cannot set a user level password when using
    a native connection with Crystal Reports 9.2 and
    Crystal Reports for Visual Studio .NET 2002 or 2003.
    This KB is valid for:
    CRYS REPORTS VS .NET.9.1
    CR FOR VS .NET 2005
    CR FOR VS .NET 2008

Maybe you are looking for

  • HT5058 How do I subscribe to a calendar with my exchange account in ical

    When I go to subscribe to a calendar the only places it will allow me to have the subscribed calendar is in my iCloud calendars.  i want my exchange account to be the location of the calendar.  very odd

  • How do I upgrade from hdf5 1.4 to 1.6

    Dear Forums, I have developed a number of vi's that use the low-level hdf5 API that is provided in the SFPfile package. This package includes hdf5dll.dll, HDF5_D_LV.dll and zlib.dll. The hdf5dll.dll version is 1.4. I was using Labview 7.1. Now I've u

  • Premiere Pro to Media Encoder Link mysteriously stopped working

    I have CS6 Master Collection on a Windows 7x64 Ultimate HP Z820, 32 GB RAM, Quadro 4000, and have been using it for over a year. I use Premiere Pro and batch Queue to Media Encoder for encoding. The last time I used this workflow for batch was about

  • Pattern fills

    If a shape is filled with a pattern swatch is there a way to "explode" the pattern so that it's individual shapes can be edited, deleted, etc.? So they become independent from the original shape. Thanks, Richard

  • Convert VI 10.0

    Hello, I want convert this VI in 10.0 to 8.2.  (My labVIEW is in 8.2) Thank you. Attachments: Recup signal (projet final)_state_machine.vi ‏312 KB