473,765 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQLJ.REFRESH_CL ASSES() ....

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\functio n directory (not built into JAR files).

While the manuals state that SQLJ.REFRESH_CL ASSES() 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_CL ASSES() was NOT refreshing my SQLJ stored procedures in
\sqllib\functio n. 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_CL ASSES() 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_CL ASSES() should not have worked even with JDBC.

What are your experiences in this regard.

TIA
Raquel.
Nov 12 '05 #1
10 4117
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\functio n directory (not built into JAR files).

While the manuals state that SQLJ.REFRESH_CL ASSES() 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\functio n directory (not built into JAR files).

While the manuals state that SQLJ.REFRESH_CL ASSES() 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_CL ASSES() was NOT refreshing my SQLJ stored procedures in
\sqllib\functio n. 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_CL ASSES() 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_CL ASSES() 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\<s chema>\ 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.goo gle.com...
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\functio n directory (not built into JAR files).

While the manuals state that SQLJ.REFRESH_CL ASSES() 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_CL ASSES() was NOT refreshing my SQLJ stored procedures in
\sqllib\functio n. 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_CL ASSES() 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_CL ASSES() 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\functio n directory (not built into JAR files).

While the manuals state that SQLJ.REFRESH_CL ASSES() 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_CL ASSES() was NOT refreshing my SQLJ stored procedures in
\sqllib\functio n. 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_CL ASSES() 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_CL ASSES() 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_CL ASSES 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_CL ASSES() statement to force DB2® to load the new
classes. If you do not issue the CALL SQLJ.REFRESH_CL ASSES() 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_CL ASSES() 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******@nospa m.ca.ibm.com> wrote in message news:<cb******* ***@hanover.tor olab.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...proba bly 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_CL ASSES 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_CL ASSES() statement to force DB2® to load the new
classes. If you do not issue the CALL SQLJ.REFRESH_CL ASSES() 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_CL ASSES() 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\functio n library (and are not defined as JAR files).

SQLJ.REFRESH_CL ASSES() 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\functio n, 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...t his 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******@nospa m.ca.ibm.com> wrote in message news:<cb******* ***@hanover.tor olab.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...proba bly herein lies the clue to my problem. I am using
8.1.3.

TIA
Raquel.

Nov 12 '05 #10

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

Similar topics

1
3140
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 v8.1.0.32", "s031027", "MI00060", and FixPak "4".Product is installed at "/opt/IBM/db2/V8.1"). It runs in an applicationcontainer (jdk1.4, linux). I tried all other drivers without success.
0
1525
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: tmp0.sqlj import java.sql.*; import sqlj.runtime.*; import sqlj.runtime.ref.*;
5
5166
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 'D11' to :workdept and I have checked in the table that 6 rows should have returned. Any ideas why no resultset is being returned. import java.sql.*; import sqlj.runtime.*; import sqlj.runtime.ref.*; import java.io.*; // Input/Output classes
2
1543
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 other commands needed? The stored procedure seems to run without executing these commands as well. In fact, I experience no difference between methods of preparing JDBC or SQLj procedures other than the fact that JDBC procedures are compiled with...
12
5377
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 manuals for the proper techniques to prepare an sqlj program. When I went to try the sqlj command, I got this: Exception in thread "main" java.lang.NoClassDefFoundError: sqlj/tools/Sqlj
7
2355
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 8.2 FP9): db2 connect to sample db2 call sqlj.DB2_UPDATEJARINFO ('JMARC.JMB','JMB','file:JMB.sqlj')
0
1739
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 and created data base instance. I am able sucessfully play with the DB2 related commands.
1
3489
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 and .ser files then used db2profc to bind the ser file.. not exacly 100% sure what this is about.. but I kind of get the idea.. I imported the java file into my project and attempted to use it..
0
1268
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 is the code . . ************ CAL02RSCAL.sqlj which call another PL/SQL Strored procedure TESTRSFILEPL written in DB2 ******************* package PAKCAL02RSCAL ; import java.sql.*;
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9951
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9832
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.