This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques and have Mario Casciaro & Luciano Mammino on-line!
See this thread for details.
Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Connecting without username/password

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 22458
121
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 (jdbc:oracle:oci8:@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
Marshal
Posts: 22458
121
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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(jdbc:oracle:thin:@databasestuff);
 
Hoo hoo hoo! Looks like we got a live one! Here, wave this tiny ad at it:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic