Database in Applet

I use oracle as database, and i'm trying to show data from a table into applet form, but i've problem with accessing jdbc driver. I'm sure that my classpath and path setting are correct, and the errors are about AccessControlException and classLoader. I make this access but not in applet type and it works. Can you all help me and give me an example, cause this is my homeworks.

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.

Similar Messages

  • Urgent : store and retrieve image to oracle database thru applet

    hi all
    i want the code sample for storing the image to oracle database
    development enviornment:
    server : oracle 9i , apache web server
    client : ie6 browser
    i am connecting to oracle database thru applet using oracle jdbc thin driver
    can anyone give me details about storing image to db
    1) what datatype should be used in table for image?
    2) my image files are on client machine... can i directly read those files from browser or first i have to copy those files to server?
    3) .gif files will do or what should be the fileformat?
    4) java code to store it to database (i am using jdk1.3)
    5) how to retrieve it back from database and display it in awt panel ?
    its very urgent ...
    i am doing some r&d and trying to do using blob....
    but it will take some time ...
    i will really be thankful if someone sends detail code....
    thankx in advance ....

    Hi,
    The code below might answer few of your questions.
    There is a restrcition on size of image, it must be less than 4KB.
    //Code to insert image in database
    //mytable is the table name that contains two fields in databse:name,image of type varchar and blob
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection con =null ;
    Statement stmt =null ;
    con =DriverManager.getConnection  ("jdbc:oracle:thin:@<hostname>:1521:orclsid", "system","manager");
    PreparedStatement preparedStatement = con.prepareStatement("insert into mytable (name,image) values (?,?)");
    preparedStatement.setString(1,"Amol");
    InputStream inputStream = new BufferedInputStream(new FileInputStream("C:\\WINNT\\Temp\\netscape\\images\\menubg.jpg"));
    preparedStatement.setBinaryStream(2, inputStream, inputStream.available());
    preparedStatement.executeUpdate();
    preparedStatement.close();
    inputStream.close(); To retrieve image,here is the snippet
    ResultSet resultSet = stmt.executeQuery("select image from mytable'");
    if (resultSet.next())
    byte[] image1 = resultSet.getBytes("image");
    FileOutputStream fos=new FileOutputStream("c://splash11.jpg"); //will retrieve bytes and create a file
    //by the name specified
    fos.write(image1);
    -Amol

  • How to access the sql database in applet?

    How to access the sql database in applet?
    Please help me.

    import java.applet.*;
    import java.awl.*;
    import java.sql.*;
    //other packages
    public class jdb extends Applet
    Connection con;
    Statement stmt;
    String name="drvijay";
    String phoneno="9842088860";
    public void init(){}
    pubilc void stop(){}
    public void destroy(){}
    public void start()
    call();
    public void call()
    try{
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              conn=DriverManager.getConnection("Jdbc:Odbc:emp","sa","");
              stmt=conn.createStatement();
              stmt.executeUpdate("insert into empdetails(name,phoneno) values ('"+name + "',''"+ phoneno +"' )" );
              }catch(SQLException e)
                   System.out.println("error"+e);
                   System.exit(0);
    //<applet code="jdb" height="200" width="200"> </applet>
    u this jdbc statement in any of the method..
    */

  • Connecting to database through applet

    hi friends
    I am trying to connect to sql database through applet but I cant.
    in fact it can not connect to database.
    plz any body tell me how can i do this. Thanks

    // class depends on
    //     msbase.jar
    //     mssqlserver.jar
    //     msutil.jar
    // these api's are part of Microsoft SQL Server 2000 Driver for JDBC
    // allso need JNDI file system Service provider: found @ sun http://java.sun.com/products/jndi/#DOWNLOAD12 the JNDI 1.2.X class librarys and
    //          File system provider 1.2 beta 3
    //     fscontext.jar
    //     providerutil.jar
    //      (jndi.jar) provided in java > 1.3*
    // to compile:
    // javac -classpath "C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar;C:\j2sdk1.4.2_01\jndi\lib\fscontext.jar;C:\j2sdk1.4.2_01\jndi\lib\jndi.jar;C:\j2sdk1.4.2_01\jndi\lib\providerutil.jar" SQLTest.java
    import javax.sql.*;
    import java.sql.*;
    import javax.naming.*;
    import java.util.Properties;
    public class SQLTest extends Thread {
        String sqlServerUser = "sql login account";
        String sqlServerPWD = "sql password";
        String sqlServerName = "sql machine";
        String sqlServerPort = "1433";
        public SQLTest() {
        public static void main(String[] args) {
            (new SQLTest()).run();
        public void run(){
            Connection conn = null;
            try{
                Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
                conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://" + sqlServerName + ":"+ sqlServerPort + ";User=" + sqlServerUser + ";Password=" + sqlServerPWD + ";ProgramName=JAVA-jdbc;DatabaseName=Northwind");
                Statement stmt = conn.createStatement();
                ResultSet result = stmt.executeQuery(
                    "SELECT * from [Shippers]"
                if(result.next()){
                    System.out.println(result.getString("CompanyName") + " " + result.getString("Phone"));
                    while(result.next()) {   // for each row of data
                        System.out.println(result.getString("CompanyName") + " " + result.getString("Phone"));
                System.out.println("Getting a connection with drivermanager works fine");
            } catch(Exception e){
                e.printStackTrace(System.out);
            } finally{
                try{
                    conn.close();
                } catch(Exception e){
                    e.printStackTrace(System.out);
            if(true){return;}
    // try it with a datasource
            try{
            // Setting the context:
                com.microsoft.jdbcx.sqlserver.SQLServerDataSource sds = new com.microsoft.jdbcx.sqlserver.SQLServerDataSource();
                sds.setServerName(sqlServerName);
                sds.setDatabaseName("Northwind");
                sds.setNetAddress(sqlServerPort);
                Properties p = new Properties();
                p.put(Context.INITIAL_CONTEXT_FACTORY,     "com.sun.jndi.fscontext.RefFSContextFactory");
                Context ctx = new InitialContext(p);
                try{
                    ctx.unbind("jdbc/EmployeeDB");
                }catch(Exception e){
                }finally{
                    ctx.bind("jdbc/EmployeeDB",sds);
                DataSource ds = (DataSource)ctx.lookup("jdbc/EmployeeDB");
                conn = null;
                conn = ds.getConnection(sqlServerUser,sqlServerPWD);
                Statement stmt = conn.createStatement();
                ResultSet result = stmt.executeQuery(
                    "SELECT * from [Shippers]"
                if(result.next()){
                    System.out.println(result.getString("CompanyName") + " " + result.getString("Phone"));
                    while(result.next()) {   // for each row of data
                        System.out.println(result.getString("CompanyName") + " " + result.getString("Phone"));
                System.out.println("works with datasource");
            } catch(Exception e){
                e.printStackTrace(System.out);
            } finally{
                try{
                    conn.close();
                } catch(Exception e){
                    e.printStackTrace(System.out);
    }To give an applet special privileges you can specify the prifs in the java.policy file or sign the applet and choose "yes I trust" or "yes I allways trust" when the applet is loaded.
    To give special prifs with the java.policy, it should look like this:
    grant {
    permission java.lang.RuntimePermission "usePolicy"; // prevents the popup from showing for signed applets
    grant codeBase "file:C:/-" {
      permission java.security.AllPermission;
    grant codeBase "http://localhost/-" {
      permission java.security.AllPermission;
    };

  • How to access remote database using applet

    hi all,
    I want to know how to access remote database using applet,
    Please help me anybody.
    Regards
    Jesu

    If the database is on a public server, you probably can't access it directly (security wise). You can make your applet talk to a server-side application, which makes the database calls on behalf of the applet. But even in an intranet environment this setup is often preferable, because you don't need to distribute a JDBC driver to all your clients.

  • How to connect my access database using applet?

    hi all,
    i need to connect my access database in my applet program which should work like an atm machine..I dont know how to connect it. Im new to applet same thing in JDBC application. Please help i terribly need it, our deadline in our case study is fast approaching and i still dont know how to do it. I tried the tutorial but i received some sql exception error. thanks!

    Try this link
    http://java.sun.com/docs/books/tutorial/jdbc/basics/

  • Problem in connect database using applet

    hi
    please
    i want open database in page html with use Applet
    i use this code but database not work in the my page
    if this code have problem
    please correct this code to open database in page html
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection(
    "jdbc:odbc:DRIVER=Microsoft Access Driver (*.mdb);DBQ=C:\\hwzyfa.mdb ");
    sta = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    res = sta.executeQuery("select * from aha");
    this is my code
    package orcle;
    import java.sql.*;
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    <applet code="test.class" width=200 height=200>
    </applet>
    public class Applora extends Applet implements ActionListener
    Connection con = null;
    Statement stmt = null;
    ResultSet rs = null;
    String str=null;
    TextArea ta;
    public void init()
    ta= new TextArea(10,30);
    add(ta);
    Button b1 = new Button(">>");
    add(b1);
    b1.addActionListener(this);
    ta.setText("Initialization...\n");
    public void start() {java.applet.AudioClip a=  Applet.newAudioClip(Applora.class.getResource("a.mid"));
       a.play();
    public void actionPerformed(ActionEvent ae)
    ta.appendText("Inside actionPerformed\n");
    try
    ta.appendText("Inside try block\n");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    ta.appendText("Class loaded\n");
    /********** upto this point it works fine **************/
    con=DriverManager.getConnection("jdbc:odbc:DRIVER=Microsoft Access Driver (*.mdb);DBQ=C:\\hwzyfa.mdb ");
    ta.appendText("Connection created\n");
    stmt=con.createStatement();
    ta.appendText("Statement created\n");
    rs=stmt.executeQuery("select * from aha");
    ta.appendText("Resultset created\n");
    while(rs.next())
    str=str+rs.getString(2)+" "+"\n";
    //str=str+rs.getString(2)+" "+"\n";
    ta.appendText(str);
    con.close();
    stmt.close();
    rs.close();
    }catch(ClassNotFoundException cnfe){System.out.println("Class Not found "+cnfe.getMessage());}
    catch(SQLException sqle){System.out.println("SQL Exception "+sqle.getMessage());ta.setText(sqle.getMessage());}
    catch(Exception e){ta.setText(e.getMessage());e.getMessage();}
    }

    i want access to database in page html with use AppletFirst of all, that doesn't make any sence, if it's a single user application make it a java
    application.
    If it's a multu user application make it a client server where the web server connects to
    the database when the client requests a connection.
    When the applet connects to the database any client running the applet needs a
    connection to your database server, the client needs the jdbc drivers and the client's
    jre needs to find them (set classpath with runtime parameters or set the classes in
    javadir lib). After that the client needs to change thiere java.policy or you need to sign
    the applet.
    Needless to say that's a lot of trouble. And if you go through all that trouble the client
    can de-compile your applet and see the connection to the database server and the
    server name. Now the client can destroy your database or worse see date it is not
    supposed to see.
    Since you are a brainless ... who needed to post this question 6 times did not respond to any of my post in your other threads I can just say good luck with your problem.

  • How to read data from database to applet

    hi i am writing a program below which reads data from mysql database successfully ;
    import java.sql.*;
    import java.lang.*;
    import java.util.*;
    public class Read_Capital_country_from_database {
    public static void main (String args[] ){
    int index,mess;
    String country_arr[] = new String[250];
    String capital_arr[] = new String[250];
    int i = 0 ;
    String URL = "jdbc:mysql://localhost/allusers";
    String user = "shadab";
    String password ="shadab@123";
    try {
    Class.forName("com.mysql.jdbc.Driver");
    Connection conn = DriverManager.getConnection(URL,user,password);
    for( SQLWarning warn = conn.getWarnings(); warn != null; warn = warn. getNextWarning() )
    System.out.println( "SQL Warning:" ) ;
    System.out.println( "State : " + warn.getSQLState() ) ;
    System.out.println( "Message: " + warn.getMessage() ) ;
    System.out.println( "Error : " + warn.getErrorCode() ) ;
    String sql = "select * from country_capital";
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery(sql);
    while( rs.next() ) {
    System.out.println( rs.getString(1) );
    System.out.println(" " +rs.getString(2) );
    System.out.println();
    catch (SQLException se){
    System.out.println( "SQL Exception:" ) ;
    System.out.println("Exception - raju");
    while( se != null )
    System.out.println( "State : " + se.getSQLState() ) ;
    System.out.println( "Message: " + se.getMessage() ) ;
    System.out.println( "Error : " + se.getErrorCode() ) ;
    se = se.getNextException() ;
    catch( Exception e )
    System.out.println( e ) ;
    java Read_Capital_country_from_database
    OUT PUT OF ABOVE PROGRAM IS :
    INDIA NEW DELHI
    PAKISTAN ISLAMABAD
    AFGHANISTAN KABUL
    BUT SAME PROGRAM WHEN I GO TO WRITE IN APPLET
    THIS TIME APPLET DOES OPEN BUT ERROR SHOWS ON STANDARD OUT PUT
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    THIS IS THE PROGRAM WRITTEN FOR JAVA APPLET
    import java.sql.*;
    import java.lang.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    public class Read_Capital_country_from_database extends Applet {
    Choice country, capital;
    String msg=" ", msg1;
    int index,mess;
    String country_arr[] = new String[250];
    String capital_arr[] = new String[250];
    char chr;
    int i = 0;
    public void init() {
    country = new Choice();
    capital = new Choice();
    String URL = "jdbc:mysql://localhost/allusers";
    String user = "shadab";
    String password ="shadab@123";
    try {
    Class.forName("com.mysql.jdbc.Driver");
    Connection conn = DriverManager.getConnection(URL,user,password);
    for( SQLWarning warn = conn.getWarnings(); warn != null; warn = warn. getNextWarning() )
    System.out.println( "SQL Warning:" ) ;
    System.out.println( "State : " + warn.getSQLState() ) ;
    System.out.println( "Message: " + warn.getMessage() ) ;
    System.out.println( "Error : " + warn.getErrorCode() ) ;
    String sql = "select * from country_capital";
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery(sql);
    while( rs.next() ) {
    country_arr[i] = rs.getString(1);
    country.add(country_arr);
    capital_arr[i] = rs.getString(2);
    capital.add(capital_arr[i]);
    i++;
    catch (SQLException se){
    System.out.println( "SQL Exception:" ) ;
    System.out.println("Exception - raju");
    while( se != null )
    System.out.println( "State : " + se.getSQLState() ) ;
    System.out.println( "Message: " + se.getMessage() ) ;
    System.out.println( "Error : " + se.getErrorCode() ) ;
    se = se.getNextException() ;
    catch( Exception e )
    System.out.println( e ) ;
    add(country);
    add(capital);

    It doesn't make sense to read a database directly from an applet. If an applet needs data from a database is should request if from the server which the applet is located on and the server should do the actual database actions.
    The whole point of applets is that they require no installation on the client machine. If you have to change policy files or the like, you might as well install a Swing application. Furthermore accessing a database tends to depend on how the client is set up on the network. Any sensible network has firewall settings that block access to the database ports to any external access (and, again, if you are limiting the facility to a few internal machines then why not just install a program on them).

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

  • How to access database from applet using connection pooling.

    Hi,
    I am using tomcat 4.1, JRE 1.4.2_10, MySQL 5.0, and IE 6.0. I can access the database using connection pooling from JSP without problems. But, if I try to acess from the applet, I get the following exception (related to JNDI.):
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    I know what this acception means, but I don't know how to fix it. I set up connection pooling in my Tomcat 4.1 that talks to MySQL 5.0. As I said, when I access from jsp, JNDI works. But, applet complains. Please help. In my applet, the following code accesses the database:
    ArrayList toolTipData =
          access.getToolTipData (projectName,interfac);This is the snipet of my Access class:
    public ArrayList getToolTipData (String projectName, String interfac) {
        System.out.println("In getToolTipData");
        ArrayList toolTipData = new ArrayList();
       try{
        Context ctx = new InitialContext();
        if(ctx == null )
            throw new Exception("No Context");
        DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/interfacesDB");
        if (ds != null) {
          Connection conn = ds.getConnection();
          if(conn != null)  {
              Statement s = conn.createStatement();
              //For some reason paramtized queries don't work, so I am forced
              //to this in slighly less eficient way.
              ResultSet rst = s.executeQuery("select * from interfaces");
              while (rst.next()) {
                 if (rst.getString("Project_Name").equals(projectName) &&
                     rst.getString("Interface").equals(interfac)) {
                   System.out.println("getToolTipData: ITG #" + rst.getString("ITG"));
                   toolTipData.add("ITG #: " + rst.getString("ITG"));
                   toolTipData.add("SPNE Prime Name: " +
                                   rst.getString("SPNE_Prime_Name"));
                   toolTipData.add("PD Prime Name: " +
                                   rst.getString("PD_Prime_Name"));
                   toolTipData.add("IT Prime Name: " +
                                   rst.getString("IT_Prime_Name"));
                   toolTipData.add("MLC Priority: " +
                                   rst.getString("MLC_Priority"));
                   toolTipData.add("Gary's Prime: " + rst.getString("Garys_Prime"));
                   toolTipData.add("QA Prime: " + rst.getString("QA_Prime"));
                   toolTipData.add("Brief Description: " +
                                   rst.getString("Brief_Description"));
                   toolTipData.add("Project_Status: " +
                                   rst.getString("Project_Status"));
              conn.close();
      }catch(Exception e) {
        e.printStackTrace();
      return toolTipData;
    ....

    The jsp runs on the server, whereas the applet runs on the client so
    you must package with your applet any jndi implementation specific classes
    and
    Properties props = new Properties();
    props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory" );
    props.setProperty("java.naming.provider.url", "url:1099");
    Context ctx = new InitialContext(props);
    Object ref = ctx.lookup("...");

  • Applet - Servlet - Database - Servlet- Applet

    Hi All,
    I am using Oracle8i and IE 5.0. I am trying to retrieve the data from a db table and display it.
    Sequence is as following:
    1. Query passed to the applet.
    2. Servlet excutes this query using JDBC and returns the resultset to applet.
    3. Applet displaysthe results.
    Is there anybody who has a code sample to do this, my id is [email protected] ? I am totally new to java and servlets. I would really appreciate any help.
    Thanks a lot.
    Manuriti
    [email protected]

    I've never dealt with the code to handle the applet portion of what you're trying to do, but I can help you with the servlet stuff.
    Your servlet should contain code to accomplish the following steps:
    1. Load an Oracle JDBC driver into memory.
    2. Open a JDBC connection to the Oracle database.
    3. Create a JDBC Statement object which contains the appropriate Oracle SQL code.
    4. Execute the Statement object, which will return a ResultSet.
    5. Read the ResultSet data.
    6. Pool or close the Statement and Connection objects.
    All of these steps are simple. Here's what they might look like in practice:
    // load the Oracle driver
    Class.forName("oracle.jdbc.driver.OracleDriver");
    // open the connection
    String cs = "jdbc:oracle:[email protected]:1521:DBNAME"; // connection string
    String userName = "scott";
    String password = "tiger";
    Connection con = DriverManager.getConnection(cs, userName, password);
    // create a Statement object
    Statement stmt = con.createStatement();
    // create a ResultSet object
    ResultSet rs = stmt.executeQuery("select * from DUAL"); // your SQL here
    // INSERT CODE HERE TO READ DATA FROM THE RESULTSET
    // close the Statement object
    stmt.close();
    // close the Connection object
    con.close();
    So that's how you get data from your Oracle database. Now, how do you pass it to your applet? Well, this is hardly trivial. Typically, servlets return an HTML-formatted text stream. It is possible to have an applet communicate with a servlet, but that raises security issues that I don't fully understand. I believe you would have to have your user's browsers set to the lowest possible security settings, otherwise the browser won't let the applet open a socket to a foreign IP, but again, I'm shaky on that one.
    Anywho, let me know if this was of help and if you have more questions on the servlet/applet stuff. I can probably help you with more specific questions,.

  • Databases and applets

    I am able to get a database connection working with an applet in java 2, v1.4, but it requires a plugin. Does anyone know how to get this working without the plugin? I would like it to be accessible by browsers that do not have the plugin.
    Thank you,
    Andrea

    I am using IE 5.5 and java 2, v1.4 (the latest version). Using jdbc I was successfully able to write the contents of the database to the applet.
    Unfortunately, I cannot seem to get my program to work unless I have the latest java plugin (java runtime environment). I do not want all the users who access my site to have to download the plugin.
    If it is done on the server side (perhaps with a Servlet), is the plugin necessary?
    Thanks
    Andrea

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

  • Failed to access database through applet! Please help!

    Hi there,
    I'm writing an applet to connect to a Microsoft Access 97 database situated on the same computer where the applet is invoked.
    In appletviewer, it works fine...
    appletviewer hello.html -J-Djava.security.policy=policy.plybut how could i get it run on Internet Explorer 5.0?
    It always complains about failure to find the class...
    Abstract of the program is shown below:
    public class TestDB extends JApplet{
         private Connection connection;
         private JTable table;
         public TestDB() {
              String url = "jdbc:odbc:test";
              try {
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   connection = DriverManager.getConnection(url);
              catch (ClassNotFoundException cnfe) {
                   System.err.println("Failed to load JDBC/ODBC driver");
                   cnfe.printStackTrace();
                   System.exit(1);
              catch (SQLException sqle) {
                   System.err.println("Connection Err");
                   sqle.printStackTrace();
              getTable();
              setSize(450,150);
         private void getTable() {
              Statement st;
              ResultSet resultSet;
              try {
                   String que = "SELECT * FROM ChartOfAcct";
                   st = connection.createStatement();
                   resultSet = st.executeQuery(que);
                   displayResultSet(resultSet);
                   st.close();
              catch (SQLException sqle) {
                   sqle.printStackTrace();
    Thank you so much!
    Jess

    Thank you.
    If i were to use a policy file... what should i do to let the browser know about that? Sorry i'm a completey idiot on this.
    expected outcome:
    typing an URL on the browser, say, http://abc.com/test.html --
    an applet will load and the database in the root folder (applet is also in here) would be retrieved.
    Thank you.
    Jess

  • How to connect to the mysql database using applet from remote PC

    Hii All..
    I am also facing a problem.
    My web server and mysql server are running on the same PC.
    when i connect to the database from the same PC.
    Its connection but when i am trying to connect to the database from the different PC its giving error and not finding the driver "com.mysql.jdbc.Driver" because this is there on the server PC and applet runs on the client side..
    So to load the deriver on the client side so that it can run the applet to make the database connection on the remote PC.
    Thanks
    Uttam

    You are missing the library on the client.
    It must be moved to the client.
    Just like any other library that an applet requires.
    And that has nothing to do with JDBC.
    There are certainly way(s) to do it. Perhaps a forum that addresses applets, web usage or guis would provide an answer.

Maybe you are looking for