Reputation: 13372
After this method is invoked, the stored procedure is called (it puts 1000 new records to db). But bool is false, why?
public void loadTestData() throws SQLException {
CallableStatement cStmt = connection.prepareCall("{call loadTestData }");
boolean bool = cStmt.execute();
if (bool) System.out.println("test data is loaded");
else System.out.println("test data is not loaded!");
}
The Procedure is here:
CREATE DEFINER=`root`@`localhost` PROCEDURE `loadTestData`()
BEGIN
DECLARE x INT;
delete from user where id<5000;
SET x = 0;
WHILE x <= 100 DO
insert into user (name, description) VALUES(
concat("name", x),
concat("description", x)
);
SET x = x + 1;
END WHILE;
END
Upvotes: 0
Views: 708
Reputation: 33391
If your procedure's first result is not ResultSet
the return value is false
.
Upvotes: 1