Hello all:
I've searched on this wonderful ranch far and wide and have found shadows and pieces of things that I am searching. I am hoping that the cattle that rustle up the dust will settle down for a while to let the dust clear so that I may find a definitive answer.
Environment:
Client: Win XP-Pro,
JAVA application, compiled using the 'old-fashion' method of a "C:" prompt and finally figuring out how to get a clean compile with the -classpath and file names in the correct sequence. It was like a rooky roping a steer, all trial and error with a little jibing from the old hands that stood by and chuckled, however, I finally did it.
Still using the "C:" prompt, I attempted to execute my JAVA.class and, with the same cow-hands looking on just getting dustier and not really helping out, I figured out the syntax and incorporated the -cp (classpath) and the several files, separated by semi-colons and then the right spacing.
The Server: DB2 UDB z/OS database. I have been able to use the IBM (PC-based) application developer to get a successful connection to that system and talk and share information, so I know I've got the ODBC parameters in the system working.
The execution: IT's the same topic that many other greenhorns have been frustrated getting from their executions: "java.sql.SQLException: No suitable driver".
It's frustrating after all the research that is incomplete that says, "you need a classpath" definition to point to the driver file. Well, here's the rub: there are at least three places that I've found that one can possibly make classpath definitions, 1) with a "C:" set command, 2) in the JAVAC command and 3) in the JAVA command. It boggles my mind that if JAVA is a "compile-once use anywhere" language, why doesn't it include the driver in at compile (JAVAC) time, but also needs it at run (JAVA) time? But, that's not important, right now to me.
What's important is where did I mess up and why doesn't it work?
client code snippet follows:
String url = "jdbc
b2
71A";
try {
Class.forName( "COM.ibm.db2.jdbc.net.DB2Driver" );
connection = DriverManager.getConnection(
url, username, password );
}
I've also tried the "....jdbc.app.DB2Driver" variation, too.
Yes, I have supplied other parameters for username and password in earlier code.
So, then my guru friends I do the following, JAVAC:
javac -g d:\javajdbc\DisplayQueryResults.java -classpath d:\db2v813base\java\db2java.zip
compiles cleanly, then I run:
java -cp d:\javajdbc;d:\db2v813base\java\db2java.zip DisplayQueryResults
Where I then get:
Unable to connect
java.sql.SQLException: No suitable driver
So, what name can i use to search using the power of window's search to once and for all resolve this nagging issue?
Thank you in advance for your sticking with the long, but i hope, complete explaination.
Regards,
Gary Joehlin
Colorado Springs, CO
Near the Flying "W" ranch