473,320 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

SQLJ.REFRESH_CLASSES() ....

UDB PE 8.1 on Win XP.

ok, this function caused a lot of grief today. My stored procedures
are java stored procedures, all FENCED and directly placed in
\sqllib\function directory (not built into JAR files).

While the manuals state that SQLJ.REFRESH_CLASSES() only refreshes the
routines built into JAR files, I have been successfully refreshing my
JDBC stored procedures with this function.

A couple of days back, I started developing SQLJ stored procedures and
it took me a long while to figure out that all the strange errors I
was receiving while attempting to run the SQLJ stored procedures
(messages like arguments not being compatible etc.) were because
SQLJ.REFRESH_CLASSES() was NOT refreshing my SQLJ stored procedures in
\sqllib\function. I had to stop and start the database manager
everytime I changed and recompiled a stored procedure. This solved the
problem.

KEEPFENCED in dbm config. file is set to YES (default).

Anyway, so my question is: Is someone on the list aware of what the
deal with SQLJ.REFRESH_CLASSES() is? Why does it work with JDBC
procedures and not with SQLJ procedures. Actually, per the manual, it
should work *only* for stored procedures that are built into JAR
files. Since my JDBC stored procedures are not built into JAR files,
SQLJ.REFRESH_CLASSES() should not have worked even with JDBC.

What are your experiences in this regard.

TIA
Raquel.
Nov 12 '05 #1
10 4052
Raquel wrote:
UDB PE 8.1 on Win XP.

ok, this function caused a lot of grief today. My stored procedures
are java stored procedures, all FENCED and directly placed in
\sqllib\function directory (not built into JAR files).

While the manuals state that SQLJ.REFRESH_CLASSES() only refreshes the
routines built into JAR files, I have been successfully refreshing my
JDBC stored procedures with this function.


I don't know the DB2 internals well enough to say why it did work for some
of your cases, but:

If the manual does *not* state that it works for non-jar files, than you
can't rely on your tests. You were just lucky that it did work with JDBC
classes in the first place.

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #2
It should work for both...we destroy the classloader when this function
is called. Can you contact support?

Raquel wrote:
UDB PE 8.1 on Win XP.

ok, this function caused a lot of grief today. My stored procedures
are java stored procedures, all FENCED and directly placed in
\sqllib\function directory (not built into JAR files).

While the manuals state that SQLJ.REFRESH_CLASSES() only refreshes the
routines built into JAR files, I have been successfully refreshing my
JDBC stored procedures with this function.

A couple of days back, I started developing SQLJ stored procedures and
it took me a long while to figure out that all the strange errors I
was receiving while attempting to run the SQLJ stored procedures
(messages like arguments not being compatible etc.) were because
SQLJ.REFRESH_CLASSES() was NOT refreshing my SQLJ stored procedures in
\sqllib\function. I had to stop and start the database manager
everytime I changed and recompiled a stored procedure. This solved the
problem.

KEEPFENCED in dbm config. file is set to YES (default).

Anyway, so my question is: Is someone on the list aware of what the
deal with SQLJ.REFRESH_CLASSES() is? Why does it work with JDBC
procedures and not with SQLJ procedures. Actually, per the manual, it
should work *only* for stored procedures that are built into JAR
files. Since my JDBC stored procedures are not built into JAR files,
SQLJ.REFRESH_CLASSES() should not have worked even with JDBC.

What are your experiences in this regard.

TIA
Raquel.

Nov 12 '05 #3
I did not follow your earlier posts so forgive me if this has already been
said.

In my experience, which is with DB2 V7.2 and earlier versions, the key
factor in getting fenced stored procedures to refresh themselves correctly
is to set KEEPDARI to NO. You can do this via:
db2 upd dbm cfg using keepdari no

KEEPDARI is a performance setting that should normally be set to YES for a
production environment but should almost certainly be set to NO for a
development environment. Otherwise, you get the sorts of problems you are
having.

As I said, I haven't used DB2 V8 yet so this advice may not be applicable
any longer but it certainly made a big difference in V7.2.

There are other things that can cause stored procedures to have refresh
issues but KEEPDARI is the biggest one in my experience. However, if you
have KEEPDARI set appropriately, there are two other things you should
explore:
1) If you are hand-coding your procedures - as opposed to using the Stored
Procedure Builder/Development Center - your program preparation procedures
may not be correct. You may be compiling the latest version of your program
but your preparation procedures may be putting an older version of the
..class file in your SQLLIB\FUNCTION\JAR\<schema> directory.
2) You may have *both* a .class file and a .jar containing the same program
in your SQLLIB\
FUNCTION\JAR\<schema>\ directory. In this case, DB2 will always use the
..class file in preference to your .jar, even if the .class file is an older
version.

I've managed to make all three of these mistakes at one point or another so
I understand your frustration with the procedures not refreshing properly.
However, if you make sure that KEEPDARI is NO in a development environment
and verify that your preparation procedures are storing the current version
of the .class file in the SQLLIB\FUNCTION\JAR\<schema> directory, your
problem with refreshing classes *should* go away.

Rhino

"Raquel" <ra****************@yahoo.com> wrote in message
news:9a**************************@posting.google.c om...
UDB PE 8.1 on Win XP.

ok, this function caused a lot of grief today. My stored procedures
are java stored procedures, all FENCED and directly placed in
\sqllib\function directory (not built into JAR files).

While the manuals state that SQLJ.REFRESH_CLASSES() only refreshes the
routines built into JAR files, I have been successfully refreshing my
JDBC stored procedures with this function.

A couple of days back, I started developing SQLJ stored procedures and
it took me a long while to figure out that all the strange errors I
was receiving while attempting to run the SQLJ stored procedures
(messages like arguments not being compatible etc.) were because
SQLJ.REFRESH_CLASSES() was NOT refreshing my SQLJ stored procedures in
\sqllib\function. I had to stop and start the database manager
everytime I changed and recompiled a stored procedure. This solved the
problem.

KEEPFENCED in dbm config. file is set to YES (default).

Anyway, so my question is: Is someone on the list aware of what the
deal with SQLJ.REFRESH_CLASSES() is? Why does it work with JDBC
procedures and not with SQLJ procedures. Actually, per the manual, it
should work *only* for stored procedures that are built into JAR
files. Since my JDBC stored procedures are not built into JAR files,
SQLJ.REFRESH_CLASSES() should not have worked even with JDBC.

What are your experiences in this regard.

TIA
Raquel.

Nov 12 '05 #4
Raquel wrote:
UDB PE 8.1 on Win XP.

ok, this function caused a lot of grief today. My stored procedures
are java stored procedures, all FENCED and directly placed in
\sqllib\function directory (not built into JAR files).

While the manuals state that SQLJ.REFRESH_CLASSES() only refreshes the
routines built into JAR files, I have been successfully refreshing my
JDBC stored procedures with this function.

A couple of days back, I started developing SQLJ stored procedures and
it took me a long while to figure out that all the strange errors I
was receiving while attempting to run the SQLJ stored procedures
(messages like arguments not being compatible etc.) were because
SQLJ.REFRESH_CLASSES() was NOT refreshing my SQLJ stored procedures in
\sqllib\function. I had to stop and start the database manager
everytime I changed and recompiled a stored procedure. This solved the
problem.

KEEPFENCED in dbm config. file is set to YES (default).

Anyway, so my question is: Is someone on the list aware of what the
deal with SQLJ.REFRESH_CLASSES() is? Why does it work with JDBC
procedures and not with SQLJ procedures. Actually, per the manual, it
should work *only* for stored procedures that are built into JAR
files. Since my JDBC stored procedures are not built into JAR files,
SQLJ.REFRESH_CLASSES() should not have worked even with JDBC.

What are your experiences in this regard.

TIA
Raquel.


It should work with all fenced java stored procedures. Set KEEPFENCED to
NO would probably get around the problem. However, I am surprised that
sqlj would make a difference here. Which fixpack are you on? What kind
of changes are you making? SQLJ creates static packages, so maybe it's
not the stored procedure that is not getting updated, rather you were
using a cached package.

Nov 12 '05 #5
>
If the manual does *not* state that it works for non-jar files, than you
can't rely on your tests. You were just lucky that it did work with JDBC
classes in the first place.


Well, the manual does not say that you can *not* use
SQLJ.REFRESH_CLASSES for non-jar files. Here is the exact section from
the manual:

"
For updating Java™ routines that are built into JAR files, you must
issue a
CALL SQLJ.REFRESH_CLASSES() statement to force DB2® to load the new
classes. If you do not issue the CALL SQLJ.REFRESH_CLASSES() statement
after you update Java routine classes, DB2 continues to use the
previous
versions of the classes. DB2 refreshes the classes when a COMMIT or
ROLLBACK occurs. The CALL SQLJ.REFRESH_CLASSES() statement only
applies to FENCED routines. To update NOT FENCED routines, you must
either restart the database manager and replace the class, or use the
steps
described above to create a new class and use the ALTER statement to
reference it.
"

Thanks.
Raquel.
Nov 12 '05 #6
Sean McKeough <mc******@nospam.ca.ibm.com> wrote in message news:<cb**********@hanover.torolab.ibm.com>...
It should work for both...we destroy the classloader when this function
is called. Can you contact support?


Sean, pardon my ignorance in this regard, but what do you mean by
"..we destroy the classloader when this function is called..". What is
classloader and how do you destroy it and how does it help to refresh
classes...probably herein lies the clue to my problem. I am using
8.1.3.

TIA
Raquel.
Nov 12 '05 #7
Raquel wrote:

If the manual does *not* state that it works for non-jar files, than you
can't rely on your tests. You were just lucky that it did work with JDBC
classes in the first place.
Well, the manual does not say that you can *not* use


So it does mean that REFRESH_CLASSES is supported for JAR files. That's
all. If you use it for anything else, you can't complain if it doesn't
work.
SQLJ.REFRESH_CLASSES for non-jar files. Here is the exact section from
the manual:

"
For updating Java™ routines that are built into JAR files, you must
issue a
CALL SQLJ.REFRESH_CLASSES() statement to force DB2® to load the new
classes. If you do not issue the CALL SQLJ.REFRESH_CLASSES() statement
after you update Java routine classes, DB2 continues to use the
previous
versions of the classes. DB2 refreshes the classes when a COMMIT or
ROLLBACK occurs. The CALL SQLJ.REFRESH_CLASSES() statement only
applies to FENCED routines. To update NOT FENCED routines, you must
either restart the database manager and replace the class, or use the
steps
described above to create a new class and use the ALTER statement to
reference it.
"


Yeah, because it doesn't say anything about non-JAR files, it would mean
that non-JAR files are not supported. End of story.

Granted, Sean said that it should work for all Java classes. So I would
trust him in that case.

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #8
I now have thoroughly conducted various tests and following are the
results. They are consistent whether the stored procedures are JDBC or
SQLJ (so, at least that's good). I am at 8.1.3 UDB PE on XP. As
already mentioned, all my procedures are defined as FENCED and are in
\sqllib\function library (and are not defined as JAR files).

SQLJ.REFRESH_CLASSES() does not have ANY effect at all; in other words
executing it does NOT refresh the stored procedure code (in my
case...that is in case of stored procedures directly defined in
\sqllib\function, probably it does in case stored procedures are
defined in JAR format).

The parameter that does make a difference is: KEEPFENCED.

1. If KEEPFENCED=YES, it is imperitive to issue a db2stop/db2start to
refresh the stored procedure bytecode(once you change the stored
procedure and compile it).
2. If KEEPFENCED=NO, the stored procedures bytecode is automatically
refreshed (the moment you compile your changed procedure).

Thanks.
Raquel.
Nov 12 '05 #9
The classloader is an object used by java to manage classes. When you're
running a JVM, it has a default classloader...this loader will cache
classes etc. We have our own version of a classloader, that we can
adjust the behavior of...in particular, we can recycle it, so that it
_should_ pick up new versions of classes in the path.

I'm wondering if in your case SQLJ is caching something we can't control
....not sure though (might be worth trying to put your sqlj classes in a
jar)...

Raquel wrote:
Sean McKeough <mc******@nospam.ca.ibm.com> wrote in message news:<cb**********@hanover.torolab.ibm.com>...
It should work for both...we destroy the classloader when this function
is called. Can you contact support?

Sean, pardon my ignorance in this regard, but what do you mean by
"..we destroy the classloader when this function is called..". What is
classloader and how do you destroy it and how does it help to refresh
classes...probably herein lies the clue to my problem. I am using
8.1.3.

TIA
Raquel.

Nov 12 '05 #10
You're either missing a fixpack, or else something is wrong with the
code...you don't want to go to keepfenced=no...you're paying the cost of
starting a jvm on every sp invocation.

Raquel wrote:
I now have thoroughly conducted various tests and following are the
results. They are consistent whether the stored procedures are JDBC or
SQLJ (so, at least that's good). I am at 8.1.3 UDB PE on XP. As
already mentioned, all my procedures are defined as FENCED and are in
\sqllib\function library (and are not defined as JAR files).

SQLJ.REFRESH_CLASSES() does not have ANY effect at all; in other words
executing it does NOT refresh the stored procedure code (in my
case...that is in case of stored procedures directly defined in
\sqllib\function, probably it does in case stored procedures are
defined in JAR format).

The parameter that does make a difference is: KEEPFENCED.

1. If KEEPFENCED=YES, it is imperitive to issue a db2stop/db2start to
refresh the stored procedure bytecode(once you change the stored
procedure and compile it).
2. If KEEPFENCED=NO, the stored procedures bytecode is automatically
refreshed (the moment you compile your changed procedure).

Thanks.
Raquel.

Nov 12 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: chaos | last post by:
Hello, i have problems using sqlj in the following environment. I use type 4 driver com.ibm.db2.jcc.DB2Driver and connect succesful to 8.1. db2-Database(DRDA)(Informational tokens are "DB2...
0
by: Bernard Dhooghe | last post by:
DB2 UDB V8.1 Fixpak 4 AIX 5.1 CLASSPATH: /usr/opt/db2_08_01/java/db2jcc.jar:/usr/opt/db2_08_01/java/db2jcc_license_cu.jar:/usr/opt/db2_08_01/java/sqlj.zip:/usr/java131/jre/lib/rt.jar: Program:...
5
by: Raquel | last post by:
This is a very simple DB2 SQLJ stored procedure. The problem is that it seems to run fine but returns NOTHING. I mean..as if nothing has happened..not resultset is returned. I am passing value...
2
by: Raquel | last post by:
UDB V8.1.3 on XP. While trying out SQLj procedures, I just 'compile' my stored procedure code (by command sqlj program-name.sqlj) and run it. That's it. So, how and when is db2profc and all the...
12
by: Rhino | last post by:
I am having an odd problem: the sqlj command on my system doesn't work. I am running DB2 (LUW) V8 (FP8) on WinXP. I haven't done an sqlj program since Version 6 of DB2 (LUW) so I checked the...
7
by: Jean-Marc Blaise | last post by:
Hi, The dev center calls sqlj.DB2_UPDATEJARINFO ('JMARC.JMB','JMB','file:JMB.sqlj') to update the sqlj routine source. I tried in CLP from the directory containing jar and sqlj files (Windows...
0
by: shibubaby | last post by:
Hi All, I am trying to compile some embedded SQL using the SQLJ in DB2 environment. My setup is as follows. 1) Fedora Core 5 2)IBM DB2 V8.2 I installed both the client/admin tools in the DB2...
1
by: vasilip | last post by:
I'm trying to insert large polygon data via sql statement. since the data was over 32k I had to use sqlj to insert my data. I made a class that inserts the data. ran sqlj, generated the .java...
0
by: ajitkathar | last post by:
In my SQLJ procedure , there is call to another stored procedure using a callable statement. But during excecution when .excute() happens . . the DB2 V7 database shuts down. Plz help. Follwing...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.