If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to call the store procedure(sqlj.install_jar) using jdbc?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-05-03, 01:56
chet199308 chet199308 is offline
Registered User
 
Join Date: Dec 2003
Posts: 11
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 21:41.
Reply With Quote
  #2 (permalink)  
Old 12-05-03, 08:33
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
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
Reply With Quote
  #3 (permalink)  
Old 12-12-03, 23:22
chet199308 chet199308 is offline
Registered User
 
Join Date: Dec 2003
Posts: 11
Quote:
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.
Reply With Quote
  #4 (permalink)  
Old 12-13-03, 04:27
chet199308 chet199308 is offline
Registered User
 
Join Date: Dec 2003
Posts: 11
Quote:
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
Reply With Quote
  #5 (permalink)  
Old 12-17-03, 08:22
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
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
Reply With Quote
  #6 (permalink)  
Old 12-22-03, 20:57
chet199308 chet199308 is offline
Registered User
 
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 21:46.
Reply With Quote
  #7 (permalink)  
Old 12-23-03, 08:46
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Hae you been able to call the SP through the CLP or some other method? It looks OK to me in JDBC.

Andy

Quote:
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On