hi Chris,
[SNIP]
After setting the classpath, I run the program from the command line
(call prog1).
It still is giving me the exact same error.
[SNIP]
I don't see anything wrong with your RPG code (at least, nothing that
would lead to the error you're experiencing.) You specify
"com.microsoft.sqlserver.jdbc.SqlServerDriver" as the driver name --
which is the correct name. (But I already knew that from the error
message you posted.)
You need to figure out why!
A JAR file is really just a ZIP file that contains directories and Java
executables. Inside this particular JAR file should be a directory named
"com" that contains a subdirectory named "microsoft", that contains a
subdirectory named "sqlserver", which contains "jdbc". Inside that
"jdbc" directory there should be a file called SqlServerDriver.class.
Please verify that this is the case as follows:
a) Type STRQSH to get into QShell
b) Type: cd /my/dir
to get to the directory where you placed the sqljdbc.jar file.
c) Type: jar xvf sqljdbc.jar
This will "unzip" the JAR file, extracting all of the
files from it.
d) Type: cd com/microsoft/sqlserver/jdbc
To switch to the correct directory from the files you just
extracted.
e) Type: ls -l SQLServerDriver.class
This will show you the SQLServerDriver.class file.
f) Type: javap -classpath SQLServerDriver.class -public SQLServerDriver
This tells Java to print information about the SQLServerDriver class
that's compiled into the SQLServerDriver.class disk object. It'll
give you lots of information, but the key bit that I'm looking for
is the text that says:
public final class com.microsoft.sqlserver.jdbc.SQLServerDriver
extends java.lang.Object implements java.sql.Driver{
This tells you that this classname (which is the same one from your
RPG code) implements java.sql.Driver -- meaning that it's truly
a JDBC driver that you can use.
Anyway, if all of these steps work successfully... then you must still
be doing something wrong with your CLASSPATH setting. If these steps
do not work successfully, please tell me what happens, and maybe I'll
be able to offer additional advice.
As an Amazon Associate we earn from qualifying purchases.