The first thing you have to look at when something goes wrong, is the stack trace of the exception you get. In this case, you have imported the wrong Statement class (java.beans.Statement instead of , presumably, java.sql.Statement or some concrete implementation).
Fix it - Ide should assist you with some feature like 'Fix Imports'.
That cast should have been a warning that you were using the wrong Statement import in the first place. With the right import, the cast would be unnecessary.
The only reason the cast is allowed by the compiler is because java.beans.Statement is a non-final class and java.sql.Statement is an interface. If the former were final or the latter be a class, the cast would have given a compiler error.