1

i'm trying to update paradox table from java but i'm getting an Exception

java.sql.SQLException: [Microsoft][ODBC Paradox Driver] Operation must use an updateable query. java.sql.SQLException: [Microsoft][ODBC Paradox Driver] Operation must use an updateable query. java.sql.SQLException: [Microsoft][ODBC Paradox Driver] Operation must use an updateable query.

I'm using this code:

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
    try {
        Connection paradoxCon = paradox.createConnection();
        Results res = new Results();
        res.getAll();
        if (res.allRes.isEmpty()) {
            JOptionPane.showMessageDialog(mainPanel, "There are no Finished or Postponed Games!", "Error", JOptionPane.ERROR_MESSAGE);
        } else {
            int y = res.allRes.size();
            for (int x = 0; x < y; x = x + 1) {
                try {
                    if (res.getAll().get(x).Reversed == 0) {
                        if (res.getAll().get(x).Status.equals("Fin")) {
                            String sql = "UPDATE Kvote SET _45_d = '" + res.getAll().get(x).HThome + "', _45_g = '" + res.getAll().get(x).HTaway + "', _90_d= '" + res.getAll().get(x).FThome + "', _90_g = '" + res.getAll().get(x).FTaway + "', Ok='Y' WHERE Kolo = '" + res.getAll().get(x).tRound + "' AND Sifra='" + res.getAll().get(x).TID + "'";
                            PreparedStatement ps = paradoxCon.prepareStatement(sql);
                            ps.executeUpdate();
                        }
                        if (res.getAll().get(x).Status.equals("Post")) {
                            String sql = "UPDATE Kvote SET _45_d = '" + res.getAll().get(x).HThome + "', _45_g = '" + res.getAll().get(x).HTaway + "', _90_d= '" + res.getAll().get(x).FThome + "', _90_g = '" + res.getAll().get(x).FTaway + "', Ok='O' WHERE Kolo = '" + res.getAll().get(x).tRound + "' AND Sifra='" + res.getAll().get(x).TID + "'";
                            PreparedStatement ps = paradoxCon.prepareStatement(sql);
                            ps.executeUpdate();
                        }
                    }
                    if (res.getAll().get(x).Reversed == 1) {
                        if (res.getAll().get(x).Status.equals("Fin")) {
                            String sql = "UPDATE Kvote SET _45_d = '" + res.getAll().get(x).HTaway + "', _45_g = '" + res.getAll().get(x).HThome + "', _90_d= '" + res.getAll().get(x).FTaway + "', _90_g = '" + res.getAll().get(x).FThome + "', Ok='Y' WHERE Kolo = '" + res.getAll().get(x).tRound + "' AND Sifra='" + res.getAll().get(x).TID + "'";
                            PreparedStatement ps = paradoxCon.prepareStatement(sql);
                            ps.executeUpdate();
                        }
                        if (res.getAll().get(x).Status.equals("Post")) {
                            String sql = "UPDATE Kvote SET _45_d = '" + res.getAll().get(x).HTaway + "', _45_g = '" + res.getAll().get(x).HThome + "', _90_d= '" + res.getAll().get(x).FTaway + "', _90_g = '" + res.getAll().get(x).FThome + "', Ok='O' WHERE Kolo = '" + res.getAll().get(x).tRound + "' AND Sifra='" + res.getAll().get(x).TID + "'";
                            PreparedStatement ps = paradoxCon.prepareStatement(sql);
                            ps.executeUpdate();
                        }
                    }
                } catch (Exception ex) {
                    System.out.println(ex);
                }
            }
        }
        res.getAll().clear();
    } catch (ParseException ex) {
        Logger.getLogger(AutoResultsImporterView.class.getName()).log(Level.SEVERE, null, ex);
    }
}
  • Hi, and welcome to SO! Please also tell us what line it's happening at, if possible. Can you see that in a debugger? – DWright Jan 19 '13 at 01:51
  • i'm trying to update table only with one sql query without if and for blocks and i got the same thing – Daniel Miovski Jan 19 '13 at 08:05
  • I Solve the problem using INTERSOLV 3.11 32-BIT ParadoxFile (*.db) driver – Daniel Miovski Jan 23 '13 at 01:34
  • Excellent! Did you know that you can answer your own question and accept it as **the** answer. This is considered a good practice, because it helps people looking for answers see that there is an answer and it helps them find the answer. If the answer is only in comments, the question will appear unanswered. – DWright Jan 23 '13 at 03:44

1 Answers1

0

I Solve the problem using INTERSOLV 3.11 32-BIT ParadoxFile (*.db) driver I created an System DSN Data Source Using this driver and connect to this Data Source