Note that the parentheses are required by the ANSI/ISO SQL Standard. See part 2 of the standard, section 11.51 <SQL-invoked routine>. Derby enforces this standard syntax: http://db.apache.org/derby/docs/10.5/ref/ref-single.html#crefsqlj95081

Hope this helps,
-Rick

jstrunk wrote:
At my level, its too hard to understand the demo programs. I did find several
places online that said you DO NOT code the parens on the procedure name if
there are no parameters. So I took that out. Here is my code now and the
error I get now.

import java.sql.*;
public class InstallProcs {

     public static void main(String args[]) {
String url =
"jdbc:derby://localhost:1527/COFFEEBREAK;user=root;password=rootpw";
        Connection con;
        String installJar;
        String createProc;
                
        installJar = "{call sqlj.install_jar(" +
                         "'file:/C:/Users/jim/DerbyWorkspace/SQLRoutines.jar',
'routines_jar', 0)}";
        createProc = "create procedure show_suppliers " +
                     "reads sql data " +
                          "dynamic result sets 1 " +
                     "external name 'routines_jar:SuppliersProcs.showSuppliers' 
" +
                     "language java parameter style java";
        
        Statement stmt;
        
        try {
                con = DriverManager.getConnection(url);
                stmt = con.createStatement();   
                stmt.executeUpdate(installJar);
                stmt.executeUpdate(createProc);
                stmt.close();
                con.close();
                } catch(SQLException ex) {
                System.err.println("SQLException: " + ex.getMessage());
                ex.printStackTrace();
        }
     }
}



SQLException: Syntax error: Encountered "reads" at line 1, column 33.
java.sql.SQLSyntaxErrorException: Syntax error: Encountered "reads" at line
1, column 33.
        at 
org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown
Source)
        at org.apache.derby.client.am.SqlException.getSQLException(Unknown 
Source)
        at org.apache.derby.client.am.Statement.executeUpdate(Unknown Source)
        at InstallProcs.main(InstallProcs.java:35)
Caused by: org.apache.derby.client.am.SqlException: Syntax error:
Encountered "reads" at line 1, column 33.
        at org.apache.derby.client.am.Statement.completeSqlca(Unknown Source)
        at org.apache.derby.client.am.Statement.completeExecuteImmediate(Unknown
Source)
        at
org.apache.derby.client.net.NetStatementReply.parseEXCSQLIMMreply(Unknown
Source)
        at
org.apache.derby.client.net.NetStatementReply.readExecuteImmediate(Unknown
Source)
        at 
org.apache.derby.client.net.StatementReply.readExecuteImmediate(Unknown
Source)
        at 
org.apache.derby.client.net.NetStatement.readExecuteImmediate_(Unknown
Source)
        at org.apache.derby.client.am.Statement.readExecuteImmediate(Unknown
Source)
        at org.apache.derby.client.am.Statement.flowExecute(Unknown Source)
        at org.apache.derby.client.am.Statement.executeUpdateX(Unknown Source)
        ... 2 more






jstrunk wrote:
I am using Eclipse 3.5.0 with Derby 10.5.3.0 (not the Derby Plugin). I
created an SQLJ stored procedure and stored it. When I try to execute it I
get SQLException: Syntax error: Encountered "<EOF>" at line 1, column 19.
That is the only error information I get. How can I get a listing of what
SQL thinks the procedure looks like up to the point where the error
occurs?



Reply via email to