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



Hi Chris,

that particular Java class is located in the file named sqljdbc.jar from Microsoft (which, as far as I know, is the only JAR file you need. I don't know what all of the other JAR files you mentioned are, but you might try removing them in case they cause a conflict.)

Please ensure that the sqljdbc.jar file is not corrupt, and that it's the Type 4 driver from Microsoft.

Please also ensure that you are using version 1.4 (or higher) of the JVM. Microsoft does not support older versions.

If you've placed the JAR file in /QIBM/UserData/Java400/ext, then please, please DO NOT add it to your CLASSPATH. You'll only make matters worse. The best course of action is to REMOVE it from the /QIBM/UserData/Java400/ext directory, and ONLY put it in your CLASSPATH, but it should also work if it's not in your CLASSPATH, but is only in that "ext" directory.

If you decide to use the CLASSPATH as I recommend, then please ensure the following:

a) The word CLASSPATH should be in all caps. No lowercase.

b) The full jar file should be listed in the CLASSPATH. i.e., it should be /my/dir/sqljdbc.jar. If you only provide the directory name, it won't work.

c) The CLASSPATH must be set before using *any* Java in the job, because the JVM is only loaded once per i5/OS job, and the CLASSPATH is only considered at the time that the JVM is loaded. If you've already run something that uses Java, you will need to sign off and sign back on, then set the CLASSPATH, then run your JDBC program.

d) The QIBM_RPG_JAVA_PROPERTIES variable is not necessary to find the class, but it might be useful for other things (such as selecting which JVM is used if more than one are installed on your system.) Like CLASSPATH, QIBM_RPG_JAVA_PROPERTIES must be set prior to running any Java in the job.

Good luck


Christopher Anderson wrote:
Hello everybody!
I'm attempting to access a MS SQL Server database from RPG and am basing
my attempts on Scott Klement's article on the subject (Here -
http://www.systeminetwork.com/artarchive/newsletter/w/1001/i/-1/a/54759/
index.html)

I have created all of the objects recommended in the article but when I
run the program, I get the following error:

java.lang.NoClassDefFoundError:
com/microsoft/sqlserver/jdbc/SqlServerDriver at java.lang.Throwable.<init>(Throwable.java:195)

at java.lang.Error.<init>(Error.java:49)

at
java.lang.NoClassDefFoundError.<init>(NoClassDefFoundError.java:40
)


This error seems to be telling me the classpath is set incorrectly or
that the correct class cannot be found at the location. I have
msbase.jar, mssqlserver.jar, msutil.jar and sqljdbc.jar in directory
/QIBM/UserData/Java400/ext. I'm under the impression that the java
virtual machine on the System I defaults to looking in that directory
without any modifications to the classpath variable.
I also have tried adding the QIBM_RPG_JAVA_PROPERTIES environment
variable to the list but still got the error. I tried manually setting
the classpath at both the *sys and *job level.
I'm sorry if this is a stupid question but I'm running out of ideas.
What am I missing?

Thank you,
Chris Anderson
Waukesha, WI



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.