Retrieve the syntax error offset
If there is an incorrect SQL statement executed which results in a syntax error, the driver will throw a java.sql.SQLSyntaxErrorException.
As part of the messasge in that exception will be the offset (if provided by the server) in characters to where the syntax error was detected.
An example would be:
java.sql.SQLSyntaxErrorException: A syntax error has occurred near position: 10
To programatically retrieve the exact location of a syntax error, use the getSQLStatementOffset() method to return the syntax error offset.
The following example shows how to retrieve the syntax error offset from an
SQL statement (which is
10
in this
example):try { Statement stmt = conn.createStatement(); String command = "select * fom tt"; stmt.execute( command ); } catch(Exception e) { System.out.println ("Error Offset :" + ((com.onedb.jdbc.OneDBConnection) conn).getSQLStatementOffset()); System.out.println(e.getMessage()); }