× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Since this is the first time I am learning this I was trying to read all I could, and I think I have confused myself with all the problems members had on the iseriesnetwork forums. So is the best way to establish the classpath thru the ADDENVVAR command? Then I would not need the classpath in my programs.

I ask our system administrator to add the jTDS jar files on the /QIBM/UserData/Java400/ext directory, from what I am reading that is not the best place?

Thanks a lot, Kim

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Wednesday, December 05, 2012 5:38 PM
To: RPG programming on the IBM i / System i
Subject: Re: accessing SQL db in RPG

Hi Kim,

On 12/5/2012 1:53 PM, Kim Massar wrote:
I ran it this morning and it was ok, then I added the query part back
into the program and recompiled it. Now I am getting the
NoClassDefFoundError:.

This means it can't find a class definition. With JDBC, you typically will have classes defined in a JAR file (which, under the covers, is really just a glorified ZIP file containing compiled Java classes).

Java will read the CLASSPATH environment variable for the list of JAR files (or other containers, such as directories) that might contain class definitions.

You didn't say which Java class is missing -- but, as most of JDBC is built-in to Java, I suspect it's the specific database driver that's missing. Have you placed your JAR file into the CLASSPATH?

Also, MSSQLTEST is an old example that I do not like:

1) It attempts to set the CLASSPATH inside the RPG program that uses it.
IMHO, that's not a good idea. (I did not write the code in this example, this was provided by someone else.)

2) It uses the sqljdbc.jar driver from Microsoft that in my opinion, isn't a very good driver. I recommend using the jTDS one instead.


Could I be getting the error because it was defined from running this
morning and now I am trying to define it again? Thanks

Aside from the CLASSPATH stuff I mentioned, above... My only guess is
that something got messed up in the JVM. Signing off and back on again
will give you a fresh JVM, and will cause Java to re-load the CLASSPATH
as well. (So make sure it's set properly before starting any Java
programs in the fresh job.)

-SK

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.