8 Replies Latest reply on Aug 18, 2008 6:03 AM by 843785

    Is this SQL DELETE statement correct ?

    800610
      Hi Guys

      Is the following code correct:
      String strUpdate = "DELETE * FROM table_name";
      Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/newdb?user=root&password=123" ) ;
      Statement stmt = conn.createStatement() ;
      stmt.executeUpdate(strUpdate) ;
      If I was doing a SELECT then I'd need something like this:
      String strQuery = "SELECT * FROM table_name";
      Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/newdb?user=root&password=123" ) ;
      Statement stmt = conn.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE,
      ResultSet.CONCUR_READ_ONLY ) ;
      ResultSet rs = stmt.executeQuery( strQuery ) ;