Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Load access manager from database 1

Status
Not open for further replies.

slaforce

Programmer
Jul 29, 2002
77
US
Has anybody ever wrote a batch program that can load access manager user classes and class from an oracle database table. I have used the access manager batch utility before - but I'm not sure how to populate the input file based on data from a table. Any advice?
 
I wrote a VBA script that pulled UserClasses and User data from Access Manager, then created Input Files to load a new version of Access Manager. The script then created Batch files and called them to load the files into access manager.

It's just a matter of building your input files with the right textual format and syntax.

Do you have any experience scripting?

I am what I am based on the decisions I have made.

DoubleD [bigcheeks]
 
How many users were you working with. I don't have that much experience with scripting, but I have created the batch files that you can add to the access manager batch program. What did your script look like?
 
I was dealing with @ 1000 users. I broke them into batches to ensure I wouldn't completed blow the system.
Script is too lengthy to post here, but it looped through each of the folders, each user in each folder, then properties and objects for each user.
To create the input files, I just opened a text file and starting dumping info into it line by line.

What exactly are you looking to accomplish, I might be able to share that specific block of code with you.

I am what I am based on the decisions I have made.

DoubleD [bigcheeks]
 
Thanks DoubleD -

How long did it take you to create the input file. I have user's id's and passwords in a database. I need to add those users to access manager and assign the id's and passwords. I also need to add the users to a userclass.
 
It took about 15 minutes to pull the data from Access Manager and populate the input files.
Then another 2 hours to load the 1000 users into the new namespace. I'll look through my code and see if I can cut out what you're looking for.

I am what I am based on the decisions I have made.

DoubleD [bigcheeks]
 
Thanks for your help. I think my problem is going to be populating the input files since I don't have data from Access Manager to pull from.
 
Here's a sample of code that would create an Input file for Users in an Access Table. You should be able to easily modify this code to create an Add Users file.
All you'll need to do is link the Oracle table into Access, then you can use Access to run this VBA script.

Code:
Sub Update_User_List(strFile As String)
On Error GoTo Err_Update_User_List

' *=============================================================================================
' * Updates Users in a Namespace
' *=============================================================================================
   
    Dim rstUsers As DAO.Recordset
    Dim strUserProp As String
    Dim I As Integer
    Dim FileNum As Integer
    Dim RecNum As Integer
    Dim strFileName As String
    Dim BatFile As String

' Put list of Users
Set rstUsers = CurrentDb.OpenRecordset("qselUsersToUpdate")

RecNum = 1
FileNum = 1

Do While RecNum <= rstUsers.RecordCount
    I = 1
    strFileName = strFile & FileNum & ".txt"
    Open strFileName For Output As #1
        Print #1, "//Updates Users in Namespace"
    Do Until I > 150 Or rstUsers.EOF
        strUserProp = "SetUserProperty, " & Q & rstUsers!User_Name & Sep
        Print #1, "ChangeUserName, " & Q & rstUsers!S10_USERID & Sep & rstUsers!User_Name & Q
        If Not IsNull(rstUsers!USER_DESC) Then
            Print #1, strUserProp & "Description" & Sep & rstUsers!USER_DESC & Q
        End If
        If Not IsNull(rstUsers!USER_EMAIL) Then
            Print #1, strUserProp & "Email" & Sep & rstUsers!USER_EMAIL & Q
        End If
        If Not IsNull(rstUsers!USER_FIRST) Then
            Print #1, strUserProp & "FirstName" & Sep & rstUsers!USER_FIRST & Q
        End If
        If Not IsNull(rstUsers!USER_LAST) Then
            Print #1, strUserProp & "LastName" & Sep & rstUsers!USER_LAST & Q
        End If
        If Not IsNull(rstUsers!USER_PHONE) Then
            Print #1, strUserProp & "PhoneNumber" & Sep & rstUsers!USER_PHONE & Q
        End If
        Print #1, "SetUserFolder, " & Q & rstUsers!User_Name & Sep & rstUsers!FOLDER_NAME & Q
        rstUsers.MoveNext
        RecNum = RecNum + 1
        I = I + 1
    Loop
    Close #1
    BatFile = "C:\PROD\BatchFiles\7." & FileNum & "_UpdateUsers.bat"
    Open BatFile For Output As #2
    Print #2, "c:\progra~1\cognos~1\cer1\bin\AccessAdmMaint -namespace=default -uid=Administrator -pass=password -filetype=2 -filename=" & strFileName
    Close #2

    Print #99, StdLine & strFileName

    FileNum = FileNum + 1
Loop

Exit_Update_User_List:
    rstUsers.Close
    Set rstUsers = Nothing
    Close #1
    Close #2
    Close #3
    DoCmd.SetWarnings True
Exit Sub

Err_Update_User_List:
   MsgBox "Error #: " & Err & " " & Error & Chr(13) & "Error occurred during Update_User_List"
   Resume Exit_Update_User_List
            
End Sub

If you have questions about how this works, let me know.

I am what I am based on the decisions I have made.

DoubleD [bigcheeks]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top