I am getting below exception, while running a JDBC query. I have checked my query its working fine when I run directly from a SQL client. What could be the reason?
java.sql.SQLException: ORA-00911: invalid character at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:676) at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:602) at oracle.jdbc.driver.T2CPreparedStatement.executeForDescribe(T2CPreparedStatement.java:571) at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1039) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1134) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3339) at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3384)
Answer : Most of the time, If you are getting this exception while running a JDBC query from a Java program check if your query is having semicolon (";") at the end of it or anywhere in the query. You should not have semicolon in a JDBC query.
I have observed this with the programmers who are comfortable with Oracle or some other database (e.g. MySQL, PostgresSQL) clients where semicolon is required at the end of query (like many PL/SQL command line clients).
Hope this post helps you resolve your problem quickly, feel free share your thoughts in comments if this helps or not.
Thanks , a very usefull hint
ReplyDeleteThanks , a very usefull hint
ReplyDeleteThanks!! it has been very usefull for me.
ReplyDeleteThanks, a very usefull hint
ReplyDeleteSuperb. Thank you. A very very useful hint.
ReplyDeleteIt work!
ReplyDeletevery useful hint, thank you very much
ReplyDeleteThank u so much.This help me lot
ReplyDeleteThank u very much. u solve my problem
ReplyDeleteThank u so much, this was very useful to me.
ReplyDeleteThank you so much!
ReplyDeleteBR,
Rodolfo
http://dotdebug.blogspot.com/
THanx man, you saved my life!
ReplyDeleteAbsolutely useful and right to the point ! Thanks alot...
ReplyDeleteThanks a lot. It saved my time.
ReplyDeletewonderful. Saved a lot of time.
ReplyDeleteThanks really nice one.
ReplyDeleteThnk u for this really thnks a lot.
ReplyDeleteThanks!!!! u solve my problem!
ReplyDeleteVery useful hint..saved my lot of time..
ReplyDeleteWasted a lot time , finally found this thanks a lot :)
ReplyDeleteGud info ,thnx a lot.
ReplyDeleteThank you. It helped!
ReplyDeletethanks, it solve my problem
ReplyDeleteThanks, it was very useful.
ReplyDeleteThank you.
ReplyDeleteThanks!
ReplyDeleteThanks!
ReplyDeleteThanks a lot...
ReplyDeletethanks a lot
ReplyDeleteThat solved my issue quickly, very helpful tip
ReplyDeletethanks it helped me..
ReplyDeletethis was a life saver. Stupid JDBC! Thanks.
ReplyDeleteThank you very much.
ReplyDeletegr8
ReplyDeleteMany thanks.
ReplyDeleteThanks a lot... You are absolutely correct.
ReplyDeletethanks a lot
ReplyDeleteI can believe it... after three weeks to fight with this, you solved it!! THANK YOUUU
ReplyDelete