Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2003
    Posts
    11

    Unanswered: How to call the store procedure(sqlj.install_jar) using jdbc?

    Client OS: Windows 2000
    Server OS : Redhat Linux 8.0
    Database: DB2 ver. 8

    How to call the store procedure(sqlj.install_jar) using jdbc?

    My code as following but doesn't work.

    private CallableStatement cblStatement = null;

    cblStatement = cn_any.prepareCall("{call sqlj.install_jar(?,?)}");
    cblStatement.setString(1,"file:/home/db2inst1/UDR/myudr.jar");
    cblStatement.setString(2,"myudr");
    cblStatement.executeUpdate();

    Is there anyone can help me?

    Thanks.
    Last edited by chet199308; 12-22-03 at 22:41.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    I have 2 questions,

    1) What is the SP supposed to do? Does it return a result set?

    2) What error (if any) are you getting.

    Andy

  3. #3
    Join Date
    Dec 2003
    Posts
    11
    Originally posted by ARWinner
    I have 2 questions,

    1) What is the SP supposed to do? Does it return a result set?

    2) What error (if any) are you getting.

    Andy
    1.
    The SP doesn't return a result set, just put the jar file to the database.
    2.
    I changed the first parameter:
    cblStatement.setString(1,"file:/home/UDR/myudr.jar");
    It was still not work.

  4. #4
    Join Date
    Dec 2003
    Posts
    11
    Originally posted by ARWinner
    I have 2 questions,

    1) What is the SP supposed to do? Does it return a result set?

    2) What error (if any) are you getting.

    Andy
    The error as following:

    com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -804, SQLSTATE: 07002, SQLERRMC: 109

  5. #5
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Sorry I did not reply sooner, I was out of the office for a few days.

    SQL state 07002 is an invalid parameter error. What is the definition of the SP?

    Andy

  6. #6
    Join Date
    Dec 2003
    Posts
    11
    Hi Andy,

    Installing, Replacing, and Removing JAR Files
    To install or replace a JAR file in the DB2 instance, you can use the following command syntax at the Command Line Processor:

    (1) (2)
    >>-CALL-+-SQLJ.INSTALL_JAR-+---(--'--jar-url----'--,--'--jar-id----'--)-->
    '-SQLJ.REPLACE_JAR-'

    >--------------------------------------------------------------><

    Notes:


    Specifies the URL containing the JAR file to be installed or replaced. The only URL scheme supported is 'file:'.

    Specifies the JAR identifier in the database to be associated with the file specified by the jar-url.

    For example, to install the Proc.jar file located in the file:/home/db2inst/classes/ directory in the DB2 instance, issue the following command from the Command Line Processor:

    CALL SQLJ.INSTALL_JAR('file:/home/db2inst/classes/Proc.jar' , 'myproc_jar')

    Stored Procedures and UDFs in Java:
    http://www-306.ibm.com/software/data/db2/udb/ad/v7/adg/db2a0/frame3.htm#db2a0165
    Last edited by chet199308; 12-22-03 at 22:46.

  7. #7
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Hae you been able to call the SP through the CLP or some other method? It looks OK to me in JDBC.

    Andy

    Originally posted by chet199308
    Hi Andy,

    Installing, Replacing, and Removing JAR Files
    To install or replace a JAR file in the DB2 instance, you can use the following command syntax at the Command Line Processor:

    (1) (2)
    >>-CALL-+-SQLJ.INSTALL_JAR-+---(--'--jar-url----'--,--'--jar-id----'--)-->
    '-SQLJ.REPLACE_JAR-'

    >--------------------------------------------------------------><

    Notes:


    Specifies the URL containing the JAR file to be installed or replaced. The only URL scheme supported is 'file:'.

    Specifies the JAR identifier in the database to be associated with the file specified by the jar-url.

    For example, to install the Proc.jar file located in the file:/home/db2inst/classes/ directory in the DB2 instance, issue the following command from the Command Line Processor:

    CALL SQLJ.INSTALL_JAR('file:/home/db2inst/classes/Proc.jar' , 'myproc_jar')

    Stored Procedures and UDFs in Java:
    http://www-306.ibm.com/software/data...3.htm#db2a0165

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •