| Author |
Connecting without username/password
|
Heiko Graf
Greenhorn
Joined: Jan 10, 2008
Posts: 6
|
|
Greetings Ranchers. I'm having the following problem: I need to make a program (executable jar) that connects to an oracle database. Normaly I would do something like this: BUT I am not allowed to code the username and password into the code, into a properties file or prompt the user for it. According to our database admin I should ommit username and password like this: In this case, when the databse is called, it should look for the operating system user and give him the correct connection. So I tried his aproach, but everytime I leave out user/pass i get a java.sql.SQLException: Illegal arguments in call (I hope it is the correct translation, it reads: Ung�ltige Argumente in Aufruf) Google always came up with "just give it user/pass", but as I can't do that, I'm rather helpless at the moment. Can somebody point me into a direction where to find a solution?
|
Klingon multitasking systems do not support "time-sharing". When a Klingon program wants to run, it challenges the scheduler in hand-to-hand combat and owns the machine
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
If you want to do this you'll need a driver that supports NTLM. I'm not sure the driver's supplied by Oracle do this; I might be wrong about the OCI driver - its been a long time since I looked at that.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
Furthermore, remove the / jdbc racle:thin:@databasestuff The / is used to separate the user and password.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Heiko Graf
Greenhorn
Joined: Jan 10, 2008
Posts: 6
|
|
I made some progress, at least I hope this is going into the right direction. I updatet to a better driver and left out the /. Furthermore, my db admin gave me some files with wich to work (libclntsh.so.10.1, libnnz10.so, libnnz10.so, libociei.so and libocijdbc10.sh). With these files I should be able to switch from thin to oci8 (jdbc racle ci8:@databasestuff). I no longer get the previous errormessage, now I get: Exception in thread "main" java.lang.UnsatisfiedLinkError: /xxxxx/libocijdbc10.so: ld.so.1: java: fatal: /xxxxx/libocijdbc10.so: wrong ELF class: ELFCLASS64 The libocijdbc10.so file that I use is the same file that a program named sqlplus uses. And with sqlplus my db admin can connect without username/password. Any ideas why the file wont work for me? [ January 15, 2008: Message edited by: Heiko Graf ]
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
Just a guess: the db admin is working on a 64 bit Linux/Unix, and you're on a 32 bit Linux/Unix. You should get those files for your own distribution, preferable through its own package management tools.
|
 |
Heiko Graf
Greenhorn
Joined: Jan 10, 2008
Posts: 6
|
|
Ok, I got it worked out now. If anybody want's to do the same, this is what I did. I switched from ojdbc14.jar to ojdbc5.jar. (On the PC I have to use java 1.4, but on unix we work with versin 1.5) I used the thin driver, and no /. c = DriverManager.getConnection(jdbc racle:thin:@databasestuff);
|
 |
 |
|
|
subject: Connecting without username/password
|
|
|