Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connecting without username/password

 
Heiko Graf
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rob Spoor
Sheriff
Pie
Posts: 20492
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Furthermore, remove the /
jdbcracle:thin:@databasestuff

The / is used to separate the user and password.
 
Heiko Graf
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 (jdbcracleci8:@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
Pie
Posts: 20492
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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(jdbcracle:thin:@databasestuff);
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic