Simple Applet question/problem
Posted by: Cancel Man
Date: November 06, 2004 03:13PM

I'm made a simple applet that will update MySQL using Connector/J (I've just started using JDBC and MySQL, so I'm on a very newbie level). When I run the applet from my compiler, it will open a java console and work correctly to update the database (there is an exception thrown, but the database is updated correctly).

Unfortunately, when I try to open the same applet from the same location in a web browser, the applet works but will not update the database.

Any suggestions?

    public void actionPerformed(ActionEvent e) {
      if (e.getSource() == left1) {
        lscore = lscore + 1;
        l = String.valueOf(lscore);
        updateString = "UPDATE SCORE " +
        "SET SCORE = " + l + " WHERE SIDE = 1";

        try {
          con = DriverManager.getConnection("jdbc:mysql:///bball",
                                            "root", "******");

          st = con.createStatement();

          while ( {
        catch (Exception d) {
          System.err.println("Exception: " + d.getMessage());
        finally {
          try {
            if (rs != null) {
            if (st != null) {
            if (con != null) {
          catch (SQLException d) {


-the table name is score and the column I'm trying to update is named score- sorry for the confusing naming convention
-The SQL code was borrowed from a tutorial and I'm trying to make it fit. I don't have a ResultSet statement (rs) and I'm not sure how it works or if I even need it. But I am pretty sure that's why I'm getting an Exception: NULL ;-)


Options: ReplyQuote

Written By
Simple Applet question/problem
November 06, 2004 03:13PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.