Menu

ucanaccess-5.0.1, Statement.execute(CREATE TABLE *),the return value is false,but the table is created.i wonder why.

2023-11-15
2023-11-16
  • yangqingping

    yangqingping - 2023-11-15

    ucanaccess:5.0.1
    hsqldb:2.5.0
    jackcess:3.0.1
    system:ubuntu 16.04
    the code belows:

    conn = DriverManager.getConnection(url);
    stmt = conn.createStatement();
    String sql = "CREATE TABLE PICINDEX(" +
                        "IDX AUTOINCREMENT PRIMARY KEY," +
                        "POLEID Text," +
                        "SETLOC Text," +
                        "KM integer," +
                        "ST Text," +
                        "TUNNEL Text," +
                        "DETECTDATE Text," +
                        "MDirection Text," +
                        "SPEED float," +
                        "CAMERNO Text," +
                        "PATH Text," +
                        "POLENUM Text," +
                        "FRONT integer," +
                        "BACK integer," +
                        "FILEPRE Text," +
                        "AllReadState Text," +
                        "CorrectState Text," +
                        "OldPoleNum Text," +
                        "DataState Text);";
                if (stmt.execute(sql)) {
                    System.out.println("success");
                } else {
                    System.out.println("failed");
                }
    

    every time, the stmt.execute(sql) return false,but the table PICINDEX is created.

     
  • Marco Amadei

    Marco Amadei - 2023-11-15

    The boolean returned has a completely different meaning, it's true if it is a ResultSet, false if it isn't, see jdbc javadoc

     
    • yangqingping

      yangqingping - 2023-11-16

      thanks,i get it.

       

Log in to post a comment.