Invoking stored procedure - is catalog name ever required?
Posted by: Mike Norman
Date: October 06, 2010 09:21AM

I've seen the stored procedure invocation documented as:
   {call demoSp(?, ?)}
I'm building up my invocation string from JDBC metadata.
The PROCEDURE_CAT column is populated with the name of the database
    url: jdbc:mysql://localhost:3306/emp
                                   ^^^ database name

    // useful fields in databaseMetaData.getProcedures() ResultSet
    public static final int PROCS_INFO_CATALOG = 1;//catalog (may be null)
    ResultSet procsInfo = databaseMetaData.getProcedures(catalogPattern,
        schemaPattern, procedurePattern);
    String actualCatalogName = procsInfo.getString(PROCS_INFO_CATALOG);
           ^^^^^^^^^^^^^^^^^ contains "emp"
Thus, my invocation string becomes:
   {call emp.demoSp(?, ?)}

In older versions of the Connector, this seemed to work; however, in
version 5.1.13 of Connector/J, I'm getting an exception:
    Parameter index of n is out of range (a, b)  {values n, a, b vary based on
                                                  number of arguments}
(and yes, I've opened a bug on this

I can change my code to not include the catalog name ... but is there ever
any circumstance under which it does becomes required?

Thanks in advance,
Mike Norman

Options: ReplyQuote

Written By
Invoking stored procedure - is catalog name ever required?
October 06, 2010 09:21AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.