× 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.



I found my error, when I went back in to add the query part I must have deleted the 'c' in sourceforge and didn't realize it. I had earlier replaced the Microsoft driver for the sourceforge driver. Thanks

-----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 ...

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.