By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,480 Members | 1,144 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,480 IT Pros & Developers. It's quick & easy.

sqlj Command Doesn't Work

P: n/a
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

At first I thought this might be a PATH issue but when I went into the
sqllib/bin directory, I got the same result, even though sqlj.exe is right
there. I was simply doing this command:

sqlj help

I checked Google and can't find any record of anyone else having this
problem. I can't see anything in the manuals about any special setup that I
have to do to make the sqlj command work. I know the command still exists
because it is still documented in the manuals.

Does anyone have any idea why the command isn't working?

For what it's worth, I also tried to use the bldsqljs.bat batch file in the
samples\java\sqlj directory but the same thing happens. For example, given
this command:

bldsqljs SpServer rhino rhinopw

I get:

Exception in thread "main" java.lang.NoClassDefFoundError:
sqlj/tools/Sqlj
Exception in thread "main" java.lang.NoClassDefFoundError:
com/ibm/db2/jcc/sqlj/Customizer
The syntax of the command is incorrect.
The syntax of the command is incorrect.

I'm following the instructions in the manual but both the sqlj and
db2sqljcustomize commands don't work. What's wrong?
--
Rhino
Nov 12 '05 #1
Share this Question
Share on Google+
12 Replies


P: n/a
Rhino wrote:
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


Did you already look at the tutorials at developerWorks?

http://www.ibm.com/developerworks/ed...HW11&S_CMP=LIB
http://www.ibm.com/developerworks/ed...HW11&S_CMP=LIB
https://www14.software.ibm.com/webap...rce=dw-db2sqlj

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #2

P: n/a

"Knut Stolze" <st****@de.ibm.com> wrote in message
news:d2**********@fsuj29.rz.uni-jena.de...
Rhino wrote:
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
Did you already look at the tutorials at developerWorks?

http://www.ibm.com/developerworks/ed...HW11&S_CMP=LIB http://www.ibm.com/developerworks/ed...HW11&S_CMP=LIB https://www14.software.ibm.com/webap...rce=dw-db2sqlj

Thanks for the suggestions, Knut, but I already know the basics of how to
use SQLJ; I did a few SQLJ programs back in DB2 V6.1. I checked out these
links anyway (the second one is dead by the way) but they don't seem to
touch on my problem.

I don't see why this command:

sqlj help

shouldn't work, especially if I execute it in the sqllib/bin directory, but
I get this message instead of help information regardless of where I run the
command:

Exception in thread "main" java.lang.NoClassDefFoundError:
sqlj/tools/Sqlj

It looks like some kind of installation/setup issue but I don't have any
idea where to look. The file sqlj.exe is present in sqllib/bin and sqlj.zip
is present in sqllib/java. Is there anything else I need to do to make the
sqlj command work??

I'm running DB2 V8 (Linux, Unix, and Windows) Fixpack 8, on Windows XP.

Rhino
Nov 12 '05 #3

P: n/a
Rhino wrote:
"Knut Stolze" <st****@de.ibm.com> wrote in message
news:d2**********@fsuj29.rz.uni-jena.de...
Rhino wrote:

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


Did you already look at the tutorials at developerWorks?


http://www.ibm.com/developerworks/ed...HW11&S_CMP=LIB

http://www.ibm.com/developerworks/ed...HW11&S_CMP=LIB

https://www14.software.ibm.com/webap...rce=dw-db2sqlj

Thanks for the suggestions, Knut, but I already know the basics of how to
use SQLJ; I did a few SQLJ programs back in DB2 V6.1. I checked out these
links anyway (the second one is dead by the way) but they don't seem to
touch on my problem.

I don't see why this command:

sqlj help

shouldn't work, especially if I execute it in the sqllib/bin directory, but
I get this message instead of help information regardless of where I run the
command:

Exception in thread "main" java.lang.NoClassDefFoundError:
sqlj/tools/Sqlj

It looks like some kind of installation/setup issue but I don't have any
idea where to look. The file sqlj.exe is present in sqllib/bin and sqlj.zip
is present in sqllib/java. Is there anything else I need to do to make the
sqlj command work??

I'm running DB2 V8 (Linux, Unix, and Windows) Fixpack 8, on Windows XP.

Rhino

Here is - I presume - expected output?:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>sqlj help
Error: help is not a valid input filename
Total 1 error.
Jan M. Nelken
Nov 12 '05 #4

P: n/a
Jan M. Nelken wrote:
Here is - I presume - expected output?:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>sqlj help
Error: help is not a valid input filename
Total 1 error.


Sorry - case of premature ENTERnization ...

Perhaps this is what you wanted to try:

C:\>sqlj -help
Usage: sqlj [options] file1.sqlj [file2.java] ...
where options include:
-d=<directory> root directory for generated binary files
-encoding=<encoding> Java encoding for source files
-status print status during translation
-compile=false do not compile generated Java files
-linemap instrument compiled class files from sqlj source
-ser2class convert generated *.ser files to *.class files
-C-<option> pass -<option> to compiler
-C-help get help on compiler
-C-classpath classpath for translation and compilation
-C-sourcepath sourcepath for translation and compilation
-J-<option> pass -<option> to the JavaVM running SQLJ
-version get SQLJ version
-smap create SMAP file for Java Debugging Support
-db2optimize generate DB2 specific optimized code for Connectio
n context

Note: place -<key>=<value> in sqlj.properties as sqlj.<key>=<value>
Jan M. Nelken
Nov 12 '05 #5

P: n/a
On 3/30/2005 14:00, Jan M. Nelken wrote:
Rhino wrote:
"Knut Stolze" <st****@de.ibm.com> wrote in message
news:d2**********@fsuj29.rz.uni-jena.de...
Rhino wrote:
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

Did you already look at the tutorials at developerWorks?


http://www.ibm.com/developerworks/ed...HW11&S_CMP=LIB

http://www.ibm.com/developerworks/ed...HW11&S_CMP=LIB

https://www14.software.ibm.com/webap...rce=dw-db2sqlj

Thanks for the suggestions, Knut, but I already know the basics of how to
use SQLJ; I did a few SQLJ programs back in DB2 V6.1. I checked out these
links anyway (the second one is dead by the way) but they don't seem to
touch on my problem.

I don't see why this command:

sqlj help

shouldn't work, especially if I execute it in the sqllib/bin directory, but
I get this message instead of help information regardless of where I run the
command:

Exception in thread "main" java.lang.NoClassDefFoundError:
sqlj/tools/Sqlj

It looks like some kind of installation/setup issue but I don't have any
idea where to look. The file sqlj.exe is present in sqllib/bin and sqlj.zip
is present in sqllib/java. Is there anything else I need to do to make the
sqlj command work??

I'm running DB2 V8 (Linux, Unix, and Windows) Fixpack 8, on Windows XP.

Rhino

Here is - I presume - expected output?:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>sqlj help
Error: help is not a valid input filename
Total 1 error.
Jan M. Nelken


I don't run sqlj, but here is what I get when I run it with -help
from the command line:

bin/sqlj -help
Usage: sqlj [options] file1.sqlj [file2.java] ...
where options include:
-d=<directory> root directory for generated binary files
-encoding=<encoding> Java encoding for source files
-status print status during translation
-compile=false do not compile generated Java files
-linemap instrument compiled class files from sqlj source
-ser2class convert generated *.ser files to *.class files
-C-<option> pass -<option> to compiler
-C-help get help on compiler
-J-<option> pass -<option> to the JavaVM running SQLJ
-version get SQLJ version
-smap create SMAP file for Java Debugging Support
Note: place -<key>=<value> in sqlj.properties as sqlj.<key>=<value>

DB2 doesn't allow the running of a lot of its utilities unless you
have a lot of environment variables set. For example, when I try to
run db2.exe, it says:

DB21061E Command line environment not initialized.

Perhaps sqlj.exe expects you to have the various Jar files in
their 'java' directory on the CLASSPATH variable?

Also, try running the DB2 command window (which provides a CMD.EXE
style window with the DB2 environment all set up) and see if you
can run the sqlj process from there?

Sorry, I'm just guessing here. I do very little with DB2.
Nov 12 '05 #6

P: n/a

"Mark Hansen" <me*@NOSPAMunify.com> wrote in message
news:11*************@corp.supernews.com...
On 3/30/2005 14:00, Jan M. Nelken wrote:
Rhino wrote:
"Knut Stolze" <st****@de.ibm.com> wrote in message
news:d2**********@fsuj29.rz.uni-jena.de...

Rhino wrote:
>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

Did you already look at the tutorials at developerWorks?

http://www.ibm.com/developerworks/ed...HW11&S_CMP=LIB
http://www.ibm.com/developerworks/ed...HW11&S_CMP=LIB
https://www14.software.ibm.com/webap...rce=dw-db2sqlj
Thanks for the suggestions, Knut, but I already know the basics of how to use SQLJ; I did a few SQLJ programs back in DB2 V6.1. I checked out these links anyway (the second one is dead by the way) but they don't seem to
touch on my problem.

I don't see why this command:

sqlj help

shouldn't work, especially if I execute it in the sqllib/bin directory, but I get this message instead of help information regardless of where I run the command:

Exception in thread "main" java.lang.NoClassDefFoundError:
sqlj/tools/Sqlj

It looks like some kind of installation/setup issue but I don't have any idea where to look. The file sqlj.exe is present in sqllib/bin and sqlj.zip is present in sqllib/java. Is there anything else I need to do to make the sqlj command work??

I'm running DB2 V8 (Linux, Unix, and Windows) Fixpack 8, on Windows XP.

Rhino

Here is - I presume - expected output?:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>sqlj help
Error: help is not a valid input filename
Total 1 error.
Jan M. Nelken


I don't run sqlj, but here is what I get when I run it with -help
from the command line:

bin/sqlj -help
Usage: sqlj [options] file1.sqlj [file2.java] ...
where options include:
-d=<directory> root directory for generated binary files
-encoding=<encoding> Java encoding for source files
-status print status during translation
-compile=false do not compile generated Java files
-linemap instrument compiled class files from sqlj

source -ser2class convert generated *.ser files to *.class files -C-<option> pass -<option> to compiler
-C-help get help on compiler
-J-<option> pass -<option> to the JavaVM running SQLJ
-version get SQLJ version
-smap create SMAP file for Java Debugging Support
Note: place -<key>=<value> in sqlj.properties as sqlj.<key>=<value>

DB2 doesn't allow the running of a lot of its utilities unless you
have a lot of environment variables set. For example, when I try to
run db2.exe, it says:

DB21061E Command line environment not initialized.

Perhaps sqlj.exe expects you to have the various Jar files in
their 'java' directory on the CLASSPATH variable?

Also, try running the DB2 command window (which provides a CMD.EXE
style window with the DB2 environment all set up) and see if you
can run the sqlj process from there?
I get the same error message when I run the command from a DB2 Command
Window.
Sorry, I'm just guessing here. I do very little with DB2.


I think you may be on to something anyway; this feels like a setup problem
and I suspect that you're right about having to set some environment
variables to make sqlj work. Unfortunately, I don't know which ones! I can't
find anything that looks like an sqlj setup checklist in the manuals but
maybe I just haven't looked in the right places or specified the right
search terms.

If anyone can point me to such a list, I would greatly appreciate it.
Obviously, something is wrong in my environment but I have no idea what to
look for.

Rhino
Nov 12 '05 #7

P: n/a

"Jan M. Nelken" <Un**********@Invalid.Domain> wrote in message
news:42********@news1.prserv.net...
Jan M. Nelken wrote:
Here is - I presume - expected output?:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>sqlj help
Error: help is not a valid input filename
Total 1 error.
Sorry - case of premature ENTERnization ...

Perhaps this is what you wanted to try:

C:\>sqlj -help
Usage: sqlj [options] file1.sqlj [file2.java] ...
where options include:
-d=<directory> root directory for generated binary files
-encoding=<encoding> Java encoding for source files
-status print status during translation
-compile=false do not compile generated Java files
-linemap instrument compiled class files from sqlj

source -ser2class convert generated *.ser files to *.class files -C-<option> pass -<option> to compiler
-C-help get help on compiler
-C-classpath classpath for translation and compilation
-C-sourcepath sourcepath for translation and compilation
-J-<option> pass -<option> to the JavaVM running SQLJ
-version get SQLJ version
-smap create SMAP file for Java Debugging Support
-db2optimize generate DB2 specific optimized code for Connectio n context

Note: place -<key>=<value> in sqlj.properties as sqlj.<key>=<value>

Thanks, Jan, for your suggestions. I tried using a full and complete sqlj
command with the various parameters supplied as per your note before I ever
posted in the first place and always got the same error message:

Exception in thread "main" java.lang.NoClassDefFoundError:
sqlj/tools/Sqlj
Finally, I tried the simplest possible case: I did an sqlj -help (which I
mistyped in my original note as 'sqlj help') from the sqllib/bin directory
where the sqlj command resides and still got the same error message.
According to the manuals 'sqlj -help' is a perfectly valid command and
should produce meaningful results, not the error message I am getting.

This feels like some kind of a setup issue; perhaps I need to run some kind
of setup script or environment variable before the sqlj command will work.
But I have no idea what I need to do and can't find anything in the manual.

Rhino
Nov 12 '05 #8

P: n/a
On 3/31/2005 06:50, Rhino wrote:
"Mark Hansen" <me*@NOSPAMunify.com> wrote in message
news:11*************@corp.supernews.com...
On 3/30/2005 14:00, Jan M. Nelken wrote:
> Rhino wrote:
>> "Knut Stolze" <st****@de.ibm.com> wrote in message
>> news:d2**********@fsuj29.rz.uni-jena.de...
>>
>>>Rhino wrote:
>>>
>>>
>>>>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
>>>
>>>Did you already look at the tutorials at developerWorks?
>>>
>>>
>>
>> http://www.ibm.com/developerworks/ed...HW11&S_CMP=LIB >>
>> http://www.ibm.com/developerworks/ed...HW11&S_CMP=LIB >>
>> https://www14.software.ibm.com/webap...rce=dw-db2sqlj >>
>> Thanks for the suggestions, Knut, but I already know the basics of how to >> use SQLJ; I did a few SQLJ programs back in DB2 V6.1. I checked out these >> links anyway (the second one is dead by the way) but they don't seem to
>> touch on my problem.
>>
>> I don't see why this command:
>>
>> sqlj help
>>
>> shouldn't work, especially if I execute it in the sqllib/bin directory, but >> I get this message instead of help information regardless of where I run the >> command:
>>
>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> sqlj/tools/Sqlj
>>
>> It looks like some kind of installation/setup issue but I don't have any >> idea where to look. The file sqlj.exe is present in sqllib/bin and sqlj.zip >> is present in sqllib/java. Is there anything else I need to do to make the >> sqlj command work??
>>
>> I'm running DB2 V8 (Linux, Unix, and Windows) Fixpack 8, on Windows XP.
>>
>> Rhino
>>
>>
>
>
> Here is - I presume - expected output?:
>
> Microsoft Windows XP [Version 5.1.2600]
> (C) Copyright 1985-2001 Microsoft Corp.
>
> C:\>sqlj help
> Error: help is not a valid input filename
> Total 1 error.
>
>
> Jan M. Nelken


I don't run sqlj, but here is what I get when I run it with -help
from the command line:

bin/sqlj -help
Usage: sqlj [options] file1.sqlj [file2.java] ...
where options include:
-d=<directory> root directory for generated binary files
-encoding=<encoding> Java encoding for source files
-status print status during translation
-compile=false do not compile generated Java files
-linemap instrument compiled class files from sqlj

source
-ser2class convert generated *.ser files to *.class

files
-C-<option> pass -<option> to compiler
-C-help get help on compiler
-J-<option> pass -<option> to the JavaVM running SQLJ
-version get SQLJ version
-smap create SMAP file for Java Debugging Support
Note: place -<key>=<value> in sqlj.properties as sqlj.<key>=<value>

DB2 doesn't allow the running of a lot of its utilities unless you
have a lot of environment variables set. For example, when I try to
run db2.exe, it says:

DB21061E Command line environment not initialized.

Perhaps sqlj.exe expects you to have the various Jar files in
their 'java' directory on the CLASSPATH variable?

Also, try running the DB2 command window (which provides a CMD.EXE
style window with the DB2 environment all set up) and see if you
can run the sqlj process from there?

I get the same error message when I run the command from a DB2 Command
Window.
Sorry, I'm just guessing here. I do very little with DB2.


I think you may be on to something anyway; this feels like a setup problem
and I suspect that you're right about having to set some environment
variables to make sqlj work. Unfortunately, I don't know which ones! I can't
find anything that looks like an sqlj setup checklist in the manuals but
maybe I just haven't looked in the right places or specified the right
search terms.

If anyone can point me to such a list, I would greatly appreciate it.
Obviously, something is wrong in my environment but I have no idea what to
look for.

Rhino


The error your getting is a Java error that it can't find a class.
You should try setting the CLASSPATH environment variable to the
Jar in the DB2/java directory that contains that class, then repeate
as necessary to get the thing working.

This assumes of course that the sqlj executable doesn't override the
CLASSPATH setting.

The current error was:
>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>>>sqlj/tools/Sqlj


So look for a Jar file that contains "sqlj/tools/Sqlj.class", and
put it on the CLASSPATH setting.

CLASSPATH is set just like PATH. So on Windows platforms, like looks
like this:

"path to Jar;path to Jar2;path to Jar3;"

It can include elements besides Jars, but you get the idea...
--
Mark Hansen, PP-ASEL
Sacramento, CA
Nov 12 '05 #9

P: n/a

"Mark Hansen" <me*@NOSPAMunify.com> wrote in message
news:11*************@corp.supernews.com...
On 3/31/2005 06:50, Rhino wrote:
"Mark Hansen" <me*@NOSPAMunify.com> wrote in message
news:11*************@corp.supernews.com...
On 3/30/2005 14:00, Jan M. Nelken wrote:

> Rhino wrote:
>> "Knut Stolze" <st****@de.ibm.com> wrote in message
>> news:d2**********@fsuj29.rz.uni-jena.de...
>>
>>>Rhino wrote:
>>>
>>>
>>>>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
>>>
>>>Did you already look at the tutorials at developerWorks?
>>>
>>>
>>
>>

http://www.ibm.com/developerworks/ed...HW11&S_CMP=LIB >>
>>

http://www.ibm.com/developerworks/ed...HW11&S_CMP=LIB
>>
>>

https://www14.software.ibm.com/webap...rce=dw-db2sqlj
>>
>> Thanks for the suggestions, Knut, but I already know the basics of how to
>> use SQLJ; I did a few SQLJ programs back in DB2 V6.1. I checked out

these
>> links anyway (the second one is dead by the way) but they don't seem
to >> touch on my problem.
>>
>> I don't see why this command:
>>
>> sqlj help
>>
>> shouldn't work, especially if I execute it in the sqllib/bin directory,
but
>> I get this message instead of help information regardless of where I

run the
>> command:
>>
>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> sqlj/tools/Sqlj
>>
>> It looks like some kind of installation/setup issue but I don't have

any
>> idea where to look. The file sqlj.exe is present in sqllib/bin and

sqlj.zip
>> is present in sqllib/java. Is there anything else I need to do to
make the
>> sqlj command work??
>>
>> I'm running DB2 V8 (Linux, Unix, and Windows) Fixpack 8, on Windows
XP. >>
>> Rhino
>>
>>
>
>
> Here is - I presume - expected output?:
>
> Microsoft Windows XP [Version 5.1.2600]
> (C) Copyright 1985-2001 Microsoft Corp.
>
> C:\>sqlj help
> Error: help is not a valid input filename
> Total 1 error.
>
>
> Jan M. Nelken

I don't run sqlj, but here is what I get when I run it with -help
from the command line:

bin/sqlj -help
Usage: sqlj [options] file1.sqlj [file2.java] ...
where options include:
-d=<directory> root directory for generated binary files -encoding=<encoding> Java encoding for source files
-status print status during translation
-compile=false do not compile generated Java files
-linemap instrument compiled class files from sqlj source
-ser2class convert generated *.ser files to *.class

files
-C-<option> pass -<option> to compiler
-C-help get help on compiler
-J-<option> pass -<option> to the JavaVM running
SQLJ -version get SQLJ version
-smap create SMAP file for Java Debugging Support Note: place -<key>=<value> in sqlj.properties as sqlj.<key>=<value>

DB2 doesn't allow the running of a lot of its utilities unless you
have a lot of environment variables set. For example, when I try to
run db2.exe, it says:

DB21061E Command line environment not initialized.

Perhaps sqlj.exe expects you to have the various Jar files in
their 'java' directory on the CLASSPATH variable?

Also, try running the DB2 command window (which provides a CMD.EXE
style window with the DB2 environment all set up) and see if you
can run the sqlj process from there?

I get the same error message when I run the command from a DB2 Command
Window.
Sorry, I'm just guessing here. I do very little with DB2.


I think you may be on to something anyway; this feels like a setup

problem and I suspect that you're right about having to set some environment
variables to make sqlj work. Unfortunately, I don't know which ones! I can't find anything that looks like an sqlj setup checklist in the manuals but
maybe I just haven't looked in the right places or specified the right
search terms.

If anyone can point me to such a list, I would greatly appreciate it.
Obviously, something is wrong in my environment but I have no idea what to look for.

Rhino


The error your getting is a Java error that it can't find a class.
You should try setting the CLASSPATH environment variable to the
Jar in the DB2/java directory that contains that class, then repeate
as necessary to get the thing working.

This assumes of course that the sqlj executable doesn't override the
CLASSPATH setting.

The current error was:
>> >>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> >>>>sqlj/tools/Sqlj


So look for a Jar file that contains "sqlj/tools/Sqlj.class", and
put it on the CLASSPATH setting.

CLASSPATH is set just like PATH. So on Windows platforms, like looks
like this:

"path to Jar;path to Jar2;path to Jar3;"

It can include elements besides Jars, but you get the idea...

I've just gone over the list of instructions in the "Setting up the Java
environment" and "Setting up the Windows Java environment" sections of the
Info Center again and feel that I am doing everything that they require. The
only change I made was the sequence of the jars in the classpath; the manual
insisted that the db2java.zip, db2jcc.jar, db2jcc_license_cu.jar, and
sqlj.zip jars were first in the classpath and they weren't so I moved them
to immediately after the '.' directory. I saved the environment variables
and rebooted to make sure that the changes had taken effect but I still got
the same error at both a regular command prompt and the DB2 Command Window.

I also had a look at the DB2 environment variables to see if anything there
looked like it might affect SQLJ but I couldn't see anything other than
DB2COMM; DB2COMM is already set to TCPIP.

I also had a look at sqlj.zip and verified that it contains Sqlj.class; the
path for this class is sqlj\tools
and sqlj.zip is in my classpath.

I'm really baffled here. I've spent hours messing with this and can't get to
square one.

I have no problems writing, preparing and running JDBC programs but I can't
do *anything* with SQLJ.

Does anyone have any ideas?

Rhino

Nov 12 '05 #10

P: n/a
I have resolved my problem with the sqlj command.

In case anyone else ever has the same problem and researches it via Google,
the solution to the problem was very simple. First, a bit of background.

In the course of playing with my classpath to try to resolve this problem, I
noticed that I had two classpath environment variables, one a 'user'
variable and one a 'system' variable. I'm running Windows XP Pro. The 'user'
version of classpath pointed only to a Photo editing program I have; the
'system' version of classpath pointed to all of my DB2 Java/SQL jars and
zips.

My system has been like this for a few years now and this has never been a
problem up to now. I'd always just assumed that Windows was concatenating
the two classpaths together and never really touched the 'user' classpath:
whenever I had a change to make, I made it to the 'system' classpath and it
always seemed to work.

However, because the sqlj command (and db2sqljcustomize) were always getting
classpath errors even though I had the correct jars and zips in the 'system'
classpath, I began to suspect that only the 'user' classpath was being seen,
NOT the concatenation of both the 'user' and 'system' classpath. I posted to
a couple of newsgroups to ask about this and was told that if the same
environment variable was defined in both the 'user' and 'system' areas, the
'user' one took precedence and the 'system' was ignored, i.e. there is no
concatenation!

The solution to the problem was easy: I added the contents of my 'user'
classpath to my 'system' classpath and deleted the 'used' classpath. My sqlj
and db2sqljcustomize commands immediately began working; I didn't even have
to reboot. (One of the people who replied to my question gave me a link to
an article that said you normally have to reboot before you will see changes
to 'system' environment variables.)

--

The thing that I don't understand about this is why everything except the
sqlj/db2sqljcustomize commands worked so well for several years when I had
two different versions of the classpath running. I would have thought that
all of my DB2 Java-related stuff would have given me big problems years ago
due to this situation. But, somehow, everything was fine right up until I
started to play with sqlj.

Perhaps this will make sense once I have thought about it some more....

Rhino
Nov 12 '05 #11

P: n/a
On 4/1/2005 05:57, Rhino wrote:
I have resolved my problem with the sqlj command.

In case anyone else ever has the same problem and researches it via Google,
the solution to the problem was very simple. First, a bit of background.

In the course of playing with my classpath to try to resolve this problem, I
noticed that I had two classpath environment variables, one a 'user'
variable and one a 'system' variable. I'm running Windows XP Pro. The 'user'
version of classpath pointed only to a Photo editing program I have; the
'system' version of classpath pointed to all of my DB2 Java/SQL jars and
zips.

My system has been like this for a few years now and this has never been a
problem up to now. I'd always just assumed that Windows was concatenating
the two classpaths together and never really touched the 'user' classpath:
whenever I had a change to make, I made it to the 'system' classpath and it
always seemed to work.

However, because the sqlj command (and db2sqljcustomize) were always getting
classpath errors even though I had the correct jars and zips in the 'system'
classpath, I began to suspect that only the 'user' classpath was being seen,
NOT the concatenation of both the 'user' and 'system' classpath. I posted to
a couple of newsgroups to ask about this and was told that if the same
environment variable was defined in both the 'user' and 'system' areas, the
'user' one took precedence and the 'system' was ignored, i.e. there is no
concatenation!
This is true for *all* variables on Windows. This has nothing to do
with Java, DB2 or the CLASSPATH setting in particular.

The "User" setting for a variable will always override the "System"
setting for that variable. If you want to include the System setting
in the User setting, you can set the User variable like this:

%CLASSPATH%;user-classpath-entries

That way, your User classpath setting will be set to the System classpath
setting, then any of your additional setting will be added on to the
end.


The solution to the problem was easy: I added the contents of my 'user'
classpath to my 'system' classpath and deleted the 'used' classpath. My sqlj
and db2sqljcustomize commands immediately began working; I didn't even have
to reboot. (One of the people who replied to my question gave me a link to
an article that said you normally have to reboot before you will see changes
to 'system' environment variables.)
Or, you could have just corrected the "User" setting, as mentioned above.

--

The thing that I don't understand about this is why everything except the
sqlj/db2sqljcustomize commands worked so well for several years when I had
two different versions of the classpath running. I would have thought that
all of my DB2 Java-related stuff would have given me big problems years ago
due to this situation. But, somehow, everything was fine right up until I
started to play with sqlj.

Perhaps this will make sense once I have thought about it some more....

Rhino


Nov 12 '05 #12

P: n/a

"Mark Hansen" <me*@NOSPAMunify.com> wrote in message
news:11*************@corp.supernews.com...
On 4/1/2005 05:57, Rhino wrote:
I have resolved my problem with the sqlj command.

In case anyone else ever has the same problem and researches it via Google, the solution to the problem was very simple. First, a bit of background.

In the course of playing with my classpath to try to resolve this problem, I noticed that I had two classpath environment variables, one a 'user'
variable and one a 'system' variable. I'm running Windows XP Pro. The 'user' version of classpath pointed only to a Photo editing program I have; the
'system' version of classpath pointed to all of my DB2 Java/SQL jars and
zips.

My system has been like this for a few years now and this has never been a problem up to now. I'd always just assumed that Windows was concatenating the two classpaths together and never really touched the 'user' classpath: whenever I had a change to make, I made it to the 'system' classpath and it always seemed to work.

However, because the sqlj command (and db2sqljcustomize) were always getting classpath errors even though I had the correct jars and zips in the 'system' classpath, I began to suspect that only the 'user' classpath was being seen, NOT the concatenation of both the 'user' and 'system' classpath. I posted to a couple of newsgroups to ask about this and was told that if the same
environment variable was defined in both the 'user' and 'system' areas, the 'user' one took precedence and the 'system' was ignored, i.e. there is no concatenation!
This is true for *all* variables on Windows. This has nothing to do
with Java, DB2 or the CLASSPATH setting in particular.

Yes, I know that *now* but I didn't know at the time that I posted the
original question. In hindsight, this was not a DB2 problem at all. However,
since this is the first time the problem manifested itself and it was only a
problem in DB2, it seemed reasonable to think it might be a DB2 problem.
Now, of course, I know better.
The "User" setting for a variable will always override the "System"
setting for that variable. If you want to include the System setting
in the User setting, you can set the User variable like this:

%CLASSPATH%;user-classpath-entries

That way, your User classpath setting will be set to the System classpath
setting, then any of your additional setting will be added on to the
end.
Sure, I suppose that would work too, PROVIDED that Windows was getting the
value of
%CLASSPATH% from the system version of the variable. I'm not certain of that
myself - it didn't come up in any of the other posts or references I saw -
but it is very possibly true. But getting rid of one of the classpaths makes
the whole thing that much less ambiguous; there is only one now so there is
no doubt whatever about which classpath is being used.

The solution to the problem was easy: I added the contents of my 'user'
classpath to my 'system' classpath and deleted the 'used' classpath. My sqlj and db2sqljcustomize commands immediately began working; I didn't even have to reboot. (One of the people who replied to my question gave me a link to an article that said you normally have to reboot before you will see changes to 'system' environment variables.)


Or, you could have just corrected the "User" setting, as mentioned above.

Rhino
Nov 12 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.