I encountered this exception when calling a stored procedure through a prepared statement, however, it works for callable statement. I am wondering if it is a must to use callable statement for invoking a stored procedure in voltdb?
String sql = "{call get_city_by_country(?)}";
PreparedStatement stat = conn.prepareStatement(sql);
stat.setString(1, "china");
ResultSet results = stat.executeQuery();
Throws exception below:
Exception in thread "main" java.sql.SQLException: Cannot submit statement in current context: '{call get_city_by_country(?)};'.
at org.voltdb.jdbc.SQLError.get(SQLError.java:45)
at org.voltdb.jdbc.JDBC4PreparedStatement.executeQuery(JDBC4PreparedStatement.java:121)
This one works fine.
CallableStatement proc = conn.prepareCall(sql);
proc.setString(1, "china");
ResultSet results = proc.executeQuery();