I'm sure my question has been asked several times before, but I can't seem to find a fitting thread with the solution in this forum. Hope any of you has the patience to guide me through this.
I am "educating myself on technology", as it says on the respective IBM sites, so I downloaded a WebSphere Application Server v7 (base trial) and am experimenting with this now. I deployed a simple application which makes a connection to an Oracle Express DB (10g Express Edition Release 10.2.0.1.0) - that works, so I must have gotten something right. (Both the App-Server and the DB are running on localhost. For previous experiments I have changed Oracle's listener port to 1621 - in case anyone wonders.)
Now I am trying to test the oracle-connection with a stand-alone java-program I found on the net and I can't get the thing to acknowledge the driver: Where does this ojdbc14.jar go ???
Here's the program:
Thats my classpath:
And here is all the places where I dropped the driver:
The prog compiles alright, but when executed stops at line 15, even when I add the current directory to the classpath-option via
I keep getting "Exception: oracle.jdbc.OracleDriver" from the prog. I'm sure this is just some minor fault but I am absolutely stuck. Any help much appreciated, thanks in advance
That path is a relative path, which means it's relative to your current working directory. So if your current working directory was (say) "/users/dirk", that path would represent
first of all - thanks for the quick reply! Unfortunately that didn't help. I'm on Ubuntu, so there is no directory /users/... There's just /home/... and e.g. /home/dirk
Both get the same "Exception: oracle.jdbc.OracleDriver". So now I wonder is this the correct driver for Oracle Express DB (10g Express Edition Release 10.2.0.1.0)? (I guess it must be, because that's the driver I installed into the app-server and there it works.) Or am I using the "wrong" jdk? I have openjdk-6-jdk?
Well for one thing, classpath aside, your code as shown will not get a Connection except on the first shot. If the first try throws an Exception all the other attempts to get the Connection will not be tried.
Unless you're using specific objects from the Oracle driver, you don't need to include the Oracle driver to compile your code. Also, have you tried Class.forName("oracle.jdbc.driver.OracleDriver"); instead?
Provide a copy of the EXACT javac and java commands you're running, the paths from which you're running it, the resulting stacktrace/error message and the source of the java file you're trying to compile/run.
I'm afraid I don't quite see where you're getting at: The complete code is in my first post, as well as the javac-command I used. Below a copy of the things I'm trying, this time with the directory paths:
The Oracle-DB is running, I'm on a Linux VM (Ubuntu, lucid), I use openjdk 6, I changed the driver-definition both in the import statement and in the Class.forName statement according to your suggestion to oracle.jdbc.driver.OracleDriver.
Have you any suggestions as to what kind of trace I could try?
it works now - although I'm not sure why. (As I said: absolute newbie.)
First I included the directory once more in the cp-argument:
(I saw that when working with a mySQL-example. I don't understand why this is necessary, though.)
got an error with the driver import so I commented it out
when I finally got to the "driver loaded ok" message I finagled it out with the help of google that the connection-string must include "user" and "password" as well, like
Best greetings,
Dirk
Post by:autobot
Be reasonable. You can't destroy everything. Where would you sit? How would you read a tiny ad?
a bit of art, as a gift, that will fit in a stocking