Solved

Accessing operating system's user/password database from Java

Posted on 2004-08-12
18
252 Views
Last Modified: 2010-03-31
I have to write a network server application which mantains a user/password list. I haven't started writing, I am still designing it, but I have thought of Java as, being a server, the more platforms it works on, the better, in addition to the rest of Java benefits. But the application needs to synchronize its user/password list with the the operating system user database. Windows 2000/XP/2003 Server user database synchronization is mandatory, and Windows NT 4 and Linux/Unix/*BSD is also important, but it could be sacrificed, depending on the difficulty, time needed/available and libraries available for it.
My questions are: How do I access the user database of the three operating system families I mentioned above from Java? is there a class or library that does this in a platform-independent way? if not, what are the best libraries for each OS family? or is there a way to do it with the Java API?.
As a last option, I could accept discarding multiplatform support and using C#, just in case .NET libraries have very good support for this, and Java a very bad one.

0
Comment
Question by:pulupul
  • 8
  • 7
18 Comments
 
LVL 15

Accepted Solution

by:
Javatm earned 500 total points
ID: 11788663
Depending on what you need ???

If you have a seperate database engine like MySQL then you can access it through JDBC but if you mean that you have to access it through
plathform specific directly from OS then you need to use JNI and have the other language handle the OS communication and use JNI to
access it and Java for interface.

Some tutorials for it :
http://java.sun.com/docs/books/tutorial/native1.1/
http://java.sun.com/docs/books/tutorial/jdbc/

Hope that helps . . .
Javatm

0
 
LVL 15

Expert Comment

by:Javatm
ID: 11788696
Otherwise there is no other way than to use other language like C++ or C#.

Hope that helps . . .
Javatm
0
 
LVL 3

Author Comment

by:pulupul
ID: 11788777
I don't know if I explained myself correctly. I plan to use no database, unless required by some library. What I am asking is how to acces the internal OS user list, the one that in Windows XP/2000 you access by clicking Start->Run and typing lusrmgr.msc, and the one that in Linux is stored in /etc/passwd and /etc/passwd/shadow if using shadowed passwords.
0
 
LVL 15

Expert Comment

by:Javatm
ID: 11788997
Its an OS Specific part you can call a batch file from java or to run the lusrmgr.msc but for handling it, you have to use certain libraries which can
be done by other language and access it using JNI and use Java as an interface. Other solution would be using other language for direct access
to the OS like C++ or C# as what I said earlier.

Hope that helps . . .
Javat,
0
 
LVL 3

Author Comment

by:pulupul
ID: 11789043
Ok, thanks for the JNI info. I want to clarify that what I want is not to run lusrmgr.msc, but to programatically access the user database that lusrmgr.msc shows.
0
 
LVL 15

Expert Comment

by:Javatm
ID: 11789519
> I want to clarify that what I want is not to run lusrmgr.msc, but to programatically access the user database that lusrmgr.msc shows.

We can run and show lusrmgr.msc in java but to programatically access and use it is not possible unless you use JNI and other language
to programatically use it.
0
 
LVL 15

Expert Comment

by:Javatm
ID: 11789556
So which means to you have to invest your self through JNI and other native language or just use C++ and C#.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 3

Author Comment

by:pulupul
ID: 11799308
What I need is a library that handles this.
0
 
LVL 15

Expert Comment

by:Javatm
ID: 11802920
>  What I need is a library that handles this.

If you have an open library in C or C++ which handles the neccessary task for it then call it JNI and use Java
as an interface to intract w/ it, this is the best way you can do it or else just use the .NET platform.
0
 
LVL 15

Expert Comment

by:Javatm
ID: 11802931
Here's another help from borland :
http://bdn.borland.com/article/0,1410,20679,00.html
0
 
LVL 3

Author Comment

by:pulupul
ID: 11803580
Ok, if someone could tell me a library in Java or C/C++ (or C# as a last resort) that does the job, I will be satisfied.
0
 
LVL 3

Author Comment

by:pulupul
ID: 11850785
JNI in conjunction with what I was told here: http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_21095702.html, might do the job.
0
 
LVL 15

Expert Comment

by:Javatm
ID: 11857725
You have to find a specific library maybe in C or C++ and handle it in JNI and make the calls from it to Java as the interface.
0
 
LVL 3

Author Comment

by:pulupul
ID: 11858957
Sure. From the guidelines:
"If you have given the Expert(s) ample time to respond to your clarification posts" - I have.
"and you have responded to each of their posts providing requested information" - I have.
"or if the answers, after clarification, lack finality or do not completely address the issue presented". This is the case. I was asking for a library or a method to access the OS's user/password list. What Javatm told me was a method to use libraries written in other languages, which is a different thing. In addition, I have the feeling that Javatm wasn't fully understanding what I was saying in my comments.

Anyway, I appreciate the answer. If you guys still think this is a B grader, I have no problem in giving it.
0
 
LVL 3

Author Comment

by:pulupul
ID: 11869165
I think the answer can be useful to someone who in the future asks the same question, and I don't need a refund.
But if you want me to give a B grade, I will give it happily.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Systems talking to each other 5 126
JAVA part two 5 58
Where to store the queries for modification of table 4 55
eclipse shortcuts 9 45
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now