CREATE USER Person identified by 2012;GRANT ALL PRIVILEGES TO Person;
These statements are successfully executed by Oracle 11g (GUI). But, when I copy and paste the above statement exactly and try to execute it by using executeUpdate(String sql), I get the exception below. Why?
java.sql.SQLSyntaxErrorException: ORA-00911: invalid character
You should not give a two different SQL statements as one. There is no way that you can JDBC driver will execute two statements passed as one string.
try to execute them as
Statement stmt = conn.createStatement();
stmt.executeUpdate("CREATE USER Person identified by 2012");
stmt.executeUpdate("GRANT ALL PRIVILEGES TO Person;");
That should do. Cheers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With