You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by 雷暴 <xx...@qq.com> on 2011/09/19 18:09:06 UTC
derby can not reload procedure class? can not use ResultSet.updateRow()?
nice to contact every one,This is my first time to mail in english,please forgive me.
#1.It seems that when procedure in a class was loaded, drop and reloaded, the changes of JAR file havn't take effected!
eg script:
drop PROCEDURE test;
call sqlj.remove_jar('admin.creaateClient', 0);
call sqlj.install_jar('export\testproc.jar','admin.creaateClient', 0);
CREATE PROCEDURE test( IN orgID INTEGER,
IN groupID INTEGER,
IN name varchar(60),
IN faceFileID bigint,
IN recStatus smallint,
IN creator bigint
)
PARAMETER STYLE JAVA READS SQL DATA LANGUAGE JAVA
EXTERNAL NAME 'com.bana.commonServer.procedure.Client_info.creaateClient';
call test(1,2,'name',4,5,6);
-- code ended
when I change and re-complie the JAR ( a little changes of logic,nothing of the other changeed), I repeat the script but the logic is the old one...囧
#2
sql = "SELECT groupSize,seq from SEQ where seqType =101 and orgID =? and groupID =? ";
pSeq= connection.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_UPDATABLE);
pSeq.setInt(1, orgID);
pSeq.setInt(2, groupID);
System.out.println(" exe SQL:"+sql);
rs = pSeq.executeQuery();
if(rs.next()){
groupSize =rs.getInt(1);
seq = rs.getInt(2);
System.out.println("seq:"+seq);
if(seq>=groupSize){
//returnCode[0] =4002;
return;
}
System.out.println("groupSize:"+groupSize);
rs.updateInt("seq", seq+1); /////////////not executed
rs.updateRow();//////////////////not executed
System.out.println("update:"+seq+1);//////////////////not executed
the return message is:
The exception 'java.sql.SQLException:........ ' was thrown while evaluating an expression.
I try the same code in independent java source and execute passed.I feel confused ,It my first time to try derby....
I look forward to your reply.thank you for you intention.
Re: derby can not reload procedure class? can not use ResultSet.updateRow()?
Posted by "Dag H. Wanvik" <da...@oracle.com>.
On 9/19/2011 6:09 PM, �ױ� wrote:
> nice to contact every one,This is my first time to mail in
> english,please forgive me.
> #1.It seems that when procedure in a class was loaded, drop and
> reloaded, the changes of JAR file havn't take effected!
Not quite sure what you did here, but did you look at/try the system
procedure REPLACE_JAR?
http://db.apache.org/derby/docs/10.8/tools/ttoolsjarload1003120.html
It seems you remove the jar before (re)installing it, that should work
as well, though..
Dag
> eg script:
> drop PROCEDURE test;
> call sqlj.remove_jar('admin.creaateClient', 0);
> call sqlj.install_jar('export\testproc.jar','admin.creaateClient', 0);
> CREATE PROCEDURE test( IN orgID INTEGER,
> IN groupID INTEGER,
> IN name varchar(60),
> IN faceFileID bigint,
> IN recStatus smallint,
> IN creator bigint
> )
> PARAMETER STYLE JAVA READS SQL DATA LANGUAGE JAVA
> EXTERNAL NAME 'com.bana.commonServer.procedure.Client_info.creaateClient';
> call test(1,2,'name',4,5,6);
> -- code ended
> when I change and re-complie the JAR ( a little changes of
> logic,nothing of the other changeed), I repeat the script but the
> logic is the old one...��
> #2
> sql = "SELECT groupSize,seq from SEQ where seqType =101 and orgID =?
> and groupID =? ";
> pSeq= connection.prepareStatement(sql,
> ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_UPDATABLE);
> pSeq.setInt(1, orgID);
> pSeq.setInt(2, groupID);
> System.out.println(" exe SQL��"+sql);
> rs = pSeq.executeQuery();
> if(rs.next()){
> groupSize =rs.getInt(1);
> seq = rs.getInt(2);
> System.out.println("seq:"+seq);
>
> if(seq>=groupSize){
> //returnCode[0] =4002;
> return;
> }
> System.out.println("groupSize:"+groupSize);
> rs.updateInt("seq", seq+1); /////////////not executed
> rs.updateRow();//////////////////not executed
> System.out.println("update:"+seq+1);//////////////////not executed
> the return message is:
> The exception 'java.sql.SQLException:........ ' was thrown while
> evaluating an expression.
> I try the same code in independent java source and execute passed.I
> feel confused ,It my first time to try derby....
> I look forward to your reply.thank you for you intention.