Question

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);
    }
}
Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top