Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Help - Java and Update Query

  1. #1
    Junior Member
    Join Date
    Jul 2012
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Help - Java and Update Query

    I'm using a Button for update an Parodox db file
    my code is
        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);
            }
        }

    but i'm getting an Exception when i try to update table

    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.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Help - Java and Update Query

    Thread moved out of What's wrong with my code. This is a database question, and as such belongs under the JDBC forum.

    What did your favorite search engine tell you when you researched this error?

  3. #3
    Junior Member
    Join Date
    Jul 2012
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Help - Java and Update Query

    That the jdbc-odbc driver for paraodx don't support update, i found paradox driver from corel PdxJdbc.jar but i don't conw how to use it

  4. #4
    Junior Member
    Join Date
    Jul 2012
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Help - Java and Update Query

    I Solve the problem using INTERSOLV 3.11 32-BIT ParadoxFile (*.db) driver

Similar Threads

  1. Query gives NullPointException, JAVA EE
    By thomasdb in forum JDBC & Databases
    Replies: 0
    Last Post: August 16th, 2012, 05:28 PM
  2. query Google in Java
    By mimka15 in forum Java Theory & Questions
    Replies: 6
    Last Post: April 30th, 2012, 11:26 AM
  3. Replies: 1
    Last Post: October 31st, 2011, 12:22 PM
  4. UPDATE SQL QUERY by getting user variables
    By bondage in forum JDBC & Databases
    Replies: 5
    Last Post: April 22nd, 2011, 03:44 PM
  5. update query is firing first then insert query
    By salmondavid88 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 8th, 2011, 10:15 AM