File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Populate LDAP with DB records Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Populate LDAP with DB records" Watch "Populate LDAP with DB records" New topic
Author

Populate LDAP with DB records

Chris Loschen
Greenhorn

Joined: Nov 28, 2007
Posts: 10
Hi all,

I'm setting up some performance testing, and to do so, I need to set up a lot of dummy users and user groups. I've got a SQL script that does this quite well in our database, but our system checks against a SunOne LDAP server and when something is in the database but not in LDAP, it automatically disables it. My tests won't work if the user is not able to log in because they've been disabled... (sigh)

So I'm trying to figure out how to get these user and user groups from my database into the LDAP system. I was trying to just read the database and write each entry to LDAP if it doesn't already exist, and that might still work, but I've been having trouble getting the JDBC connection running properly outside of our usual container and so on.

An idea came up today that might be useful: if I could write an ldif file either from my database tables or maybe even while running the inital SQL script, I could then import the ldif file and get my entries that way.

My question(s): are there any tools or guidance for accomplishing writing that ldif file? Would I be better served by keeping with my initial path? Any suggestions for a better approach to my problem?

Thanks in advance!

Chris
Chris Loschen
Greenhorn

Joined: Nov 28, 2007
Posts: 10
Bounced... any ideas? Thanks.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8867
    
    8

What container are you using?
I'm using Weblogic and it has a script tool called WLST which can be used for all kinds of tasks, exporting and importing users from/to LDAP included.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Chris Loschen
Greenhorn

Joined: Nov 28, 2007
Posts: 10
Thanks for the suggestion!

I'm using WebLogic 9.2 and 10 -- eventually JBoss too.

I'm already using WLST to automate domain creation, but I hadn't thought it would have any use here. I've got users and groups in my Oracle database tables (the results of my SQL scripts), but not in LDAP. In WebLogic, I see the users and groups that are in LDAP (or any other authenticators I have set up), but I don't see anything from my database there, or at least I don't think I do. So how would WebLogic import the data if it can't see it?

Chris
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8867
    
    8

WLST is a Python shell, and it has Jython so whatever Python and Java can do (i.e. database access), WLST can do.
Unfortunately, I don't know of a shortcut to get an LDIF out of the database. Once you do, it's pretty simple to import it to the database using the authenticator importData method.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Populate LDAP with DB records