Connecting to Oracle using Java API

I'm fairly new to Oracle, but what I'm trying to do should be straight forward (at least that's what I thought). I'm simply trying to connect to an Oracle database using the latest java API (J2SE 1.4.1).
I downloaded JDBC OCI (type 2) driver form the Oracle Web site along with the appropriate DLL; however when I try to run the following two lines
String dbUrl = "jdbc:oracle:oci8:@test";
String user = "user";
String password = "password";
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection c = DriverManager.getConnection(dbUrl, user, password);
I get the following error message:
"java.exe - Entry Point Not Found
The procedure entry point slzsetevar could not be located in the dynamic link library oracore8.dll."
Please note that I am running under Windows 2000 Pro, have Oracle Client 8.1.5 installed, and am able to connect to the same Oracle database using ODBC and PowerBuilder native drivers.
Then I read somewhere that I should use 8.1.7 version of the Oracle client software, so I downloaded it from the Oracle Web site. However when I try to install it under Windows 2000 (by double-clicking on the setup.exe) nothing happens!!!
Any ideas?!

Sorry, I should have been more specific. The error message I was referring to shows up in a pop-up windows when I try to run the program. The actual java error message (that shows up in the command prompt window) is as follows:
"Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\WINNT\system32\ocijdbc8.dll: The specified procedure could not be found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1473)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1397)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:832)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:192)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:142)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:214)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:193)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at lookup.main(lookup.java:16)"
I'm running the program through Windows 200 Pro command prompt, and the version of java is, as I mentioned in the previous message, 1.4.1:
java -version
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

Similar Messages

  • User permission issue in connecting to Oracle using java in Cent OS

    Hi ,
    I am facing a peculiar issue and since I am new to Cent OS, I hope somebody can help me.
    I am using Cent OS 4.2 and I installed Oracle client 10.2 in cent os 4.2.
    I am having a java application which connects to Oracle server in another Linux system using Oracle OCI driver which comes along with Oracle client
    I have a user called user1 which belongs to group group1 as primary group and my application runs under this user user1.
    This user is a member of oinstall group (which is the group for oracle uesr which has access to oracle client directories/files)
    But when my application tries to connect to Oracle server, I am getting connectivity error saying "Oracle driver not found" or "cannot load libocijdbc10.so". All environment variables like ORACLE_HOME, PATH,CLASSPATH, LD_LIBRARY_PATH are set properly.
    The permissions to Oracle folder/files are rwx for owner(oracle user) , rx for group(oinstall) and none for others
    What we observed are
    1. When the application is start under root user, it works
    2. When we give rx permission to others, it works
    3. When we make oinstall group as the primary group for my user user1, it works
    My questions here
    1. Why it is not working even though my user user1 is a member of oinstall group
    2. Why it is working when I make oinstall as the primary group
    3. Is there any difference in security policy of RHEL and Cent OS
    4. How can I access libraries from multiple folders which created by different user and belongs to different groups, if this is the case
    I never faced this issue in RHEL4
    Hope some body can help me.
    Regards
    Sunil

    Sorry, I should have been more specific. The error message I was referring to shows up in a pop-up windows when I try to run the program. The actual java error message (that shows up in the command prompt window) is as follows:
    "Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\WINNT\system32\ocijdbc8.dll: The specified procedure could not be found
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1473)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1397)
    at java.lang.Runtime.loadLibrary0(Runtime.java:788)
    at java.lang.System.loadLibrary(System.java:832)
    at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:192)
    at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:142)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:214)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:193)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at lookup.main(lookup.java:16)"
    I'm running the program through Windows 200 Pro command prompt, and the version of java is, as I mentioned in the previous message, 1.4.1:
    java -version
    java version "1.4.1_01"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
    Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

  • Error in connection to oracle using java

    hi ,
    i am tring to make a connection to oracle database using java with this code
    public class DataBase {
    public DataBase(){
    Connection connection = null;
    try {
    // Load the JDBC driver
    String driverName = "oracle.jdbc.dirver.OracleDriver";
    Class.forName(driverName);
    // Create a connection to the database
    String serverName = "http://localhost:7777";
    String portNumber = "1521";
    String sid = "ora9i";
    String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
    String username = "scott";
    String password = "tiger";
    connection = DriverManager.getConnection(url, username, password);
    } catch (ClassNotFoundException e) {
    JOptionPane.showMessageDialog(null,"Coud not find the database driver ");
    // Could not find the database driver
    } catch (SQLException e) {
    JOptionPane.showMessageDialog(null,"Coud not connect to the database ");
    // Could not connect to the database
    public static void main(String[] args) {
    new DataBase();
    i always got the compilation error Coud not find the database driver
    i am using oracle9i and jdk1.5.0_04 and my classpath is C:\oracle\ora92\jdbc\lib\ojdbc14.zip;C:\oracle\ora92\jdbc\lib\orai18n.zip
    i am realy stuck with this so any one can help me with this probelm
    thanks alot,

    thanks for your reply,
    yes i changed the server name and i verified the location of the JDBC driver file(s) on my computer. any way i solved my problem.
    you know there was a misunderstanding in what you mean by classpath, i thought that i have to change the classpath from control panel>system>advance>enviroment variable
    and then select classpaht and edit it. i was doing this but this is didn't work.
    then i don't know why i did that
    i went to java program and select my project,right click on it and then select properties>java build path and then select "add external Jars" button and then i simply choose them and add them to my project. and finaly it worked.
    thanks alot

  • How to use java api for function activity in embed oracle workflow?

    because i can't install standalone oracle workflow successfully.
    pls tell me how to use java api for function activity in embed oracle workflow?
    are there some patch or pulg-in package?
    ths a lot...........

    The Java Function Activity Agent is not certified for Oracle Workflow embedded in Oracle Applications. Installing standalone workflow should be a lot easier than what you have found, although it looks like you did hit a Pentium 4 issue with the Oracle Universal Installer. I suggest you contact Oracle Support or Oracle Consulting for assistance.
    because i can't install standalone oracle workflow successfully.
    pls tell me how to use java api for function activity in embed oracle workflow?
    are there some patch or pulg-in package?
    ths a lot...........

  • Problem in using Java API

    While running the sample code of adding document in the home folder using java api.
    i am facing following propblem:-
    java.lang.NoClassDefFoundError: com/inprise/vbroker/CORBA/portable/Skeleton
    at
    oracle.ifs.beans.LibraryService.connectLocal(LibraryService.java:519)
    at oracle.ifs.beans.LibraryService.connect(LibraryService.java:377)
    at CreateDocument.Helloworld(CreateDocument.java:30)
    at CreateDocument.main(CreateDocument.java:58)
    com/
    pls suggest asap

    You must not have the complete IFS_BASE_CLASSPATH defined in your CLASSPATH environment variable. The easiest way to do this is to type ". ifsenv.sh" on Solaris (or run ifsenv.bat on NT). Then you can invoke java like this:
    java -classpath $CLASSPATH:$IFS_BASE_CLASSPATH ...
    (your standard JDK classes should already be in the CLASSPATH; append our classpath to it)

  • IllegalStateException while invoking livecycle formserver using java api

    I am new to livecycle formserver.when i am trying to invoke formserver using java api ,it is giving illegal state exception.My servlet application to invoke formserver is deployed in tomcat 5.o in one system and jboss with formserver is in anohter system.
    I am using the following properties to connect formserver in another system.
    Properties ConnectionProps = new Properties();
    ConnectionProps.setProperty("DSC_DEFAULT_EJB_ENDPOINT", "jnp://172.21.49.116:JBoss:1099");
    ConnectionProps.setProperty("DSC_TRANSPORT_PROTOCOL","EJB");
    ConnectionProps.setProperty("DSC_SERVER_TYPE", "JBoss");
    ConnectionProps.setProperty("DSC_CREDENTIAL_USERNAME", "administrator");
    ConnectionProps.setProperty("DSC_CREDENTIAL_PASSWORD", "password");
    And i am confusing in setting the following paths using UrlSpec object.
    URLSpec urlspec = new URLSpec();
    urlspec.setApplicationWebRoot("http://JBOSS:8080/FormServer");
    out.println("after webroot");
    urlspec.setContentRootURI("http://localhost:8080/srvapp");
    out.println("after contentroot");
    urlspec.setTargetURL("http://localhost:8080/srvapp/HandleData");
    My .xdp file is in my localsystem where my tomcat is running.and renderToHtml method is like this:
    FormsResult formOut = Fsc.renderHTMLForm(formName, TransformTo.AUTO,oInputData,htmlRenderSpec,"",urlspec,null);
    i am passing the path of the .xdp file in my local system to formName parameter.
    with this code i am facing problem.Is there anything wrong in my code?or is there any settings to change in formserver?
    please help me with this problem,i am trying to sort out this problem.
    Any help?
    Thanks in Advance

    If you are invoking LiveCycle ES2 on JBoss compile with JDK 1.6 and run against JRE 6.
    Steve

  • Need Sample Code for Vendor creation using JAVA API

    Hi,
    I have a scenario like Vendor creation using <b>Java API</b>.
    1.I have Vendors (Main) Table.
    2.I have <b>look up</b> tables like Account Group.
    3.Also <b>Qualifier table</b>(Phone numbers) too.
    Could you please give me the sample code which helps me to create Vendor records using Java API?
    <b>I need Code samples which should cover all of the above scenario.</b>
    <b>Marks will be given for the relevent answers.</b>
    Best Regards
    PK Devaraj

    Hi Devraj,
    I hope the below code might solve all your problem:-
    //Adding Qualified field
    //Creating empty record in Qualifed table 
    //Adding No Qualifiers
    Record qualified_record = RecordFactory.createEmptyRecord(new TableId(<TableId>));
    try {
    qualified_record.setFieldValue(new FieldId(<fieldId of NoQualifier), new StringValue(<StringValue>));//Adding No Qualifier
    catch (IllegalArgumentException e2) {
    // TODO Auto-generated catch block
    e2.printStackTrace();
    catch (MdmValueTypeException e2) {
    // TODO Auto-generated catch block
    e2.printStackTrace();
    //Creating Record in Qualified table
    CreateRecordCommand create_command = new CreateRecordCommand(connections);
    create_command.setSession(sessionId);
    create_command.setRecord(qualified_record);
    try
    create_command.execute();
    catch(Exception e)
    System.out.println(e.toString());
    RecordId record_id = create_command.getRecord().getId();
    //Adding the new record to Qualifed Lookup value and setting the Yes Qualifiers
    QualifiedLookupValue lookup_value = new QualifiedLookupValue();
    int link = lookup_value.createQualifiedLink(new QualifiedLinkValue(record_id));
    //Adding Yes Qualifiers
    lookup_value.setQualifierFieldValue(0 , new FieldId(<FieldID of Yes Qualifier>) , new StringValue(<StringValue>));
    //Now adding LookUP values
    //Fetch the RecordID of the value selected by user using the following function
    public RecordId getRecordID(ConnectionPool connections , String sessionID , String value , String Fieldid , String tableid)
    ResultDefinition rsd = new ResultDefinition(new TableId(tableid));
    rsd.addSelectField(new FieldId(Fieldid));
    StringValue [] val = new StringValue[1];
    val[0] = new StringValue(value);
    RetrieveRecordsByValueCommand val_command = new RetrieveRecordsByValueCommand(connections);
    val_command.setSession(sessionID);
    val_command.setResultDefinition(rsd);
    val_command.setFieldId(new FieldId(Fieldid));
    val_command.setFieldValues(val);
    try
         val_command.execute();
    catch(Exception e)
    RecordResultSet result_set = val_command.getRecords();
    RecordId id = null;
    if(result_set.getCount()>0)
         for(int i = 0 ; i < result_set.getCount() ; i++)
         id = result_set.getRecord(i).getId();     
    return id;
    //Finally creating the record in Main table
    com.sap.mdm.data.Record empty_record = RecordFactory.createEmptyRecord(new TableId("T1"));
    try {
         empty_record.setFieldValue(new FieldId(<FieldId of text field in Main table>),new StringValue(<StringValue>));
         empty_record.setFieldValue(new FieldId(<FieldId of lookup field in Main table>), new LookupValue(<RecordID of the value retrieved using the above getRecordID function>));
    empty_record.setFieldValue(new FieldId(<FieldId of Qualified field in Main table>), new QualifiedLookupValue(<lookup_value>));//QualifiedLookUp  value Retrieved above
    } catch (IllegalArgumentException e1) {
    // TODO Auto-generated catch block
         e1.printStackTrace();
    } catch (MdmValueTypeException e1) {
         // TODO Auto-generated catch block
         e1.printStackTrace();
    //Actually creating the record in Main table
    CreateRecordCommand create_main_command = new CreateRecordCommand(connections);
    create_main_command.setSession(sessionId);
    create_main_command.setRecord(empty_record);
    try
         create_main_command.execute();
    catch(Exception e)
         System.out.println(e.toString());
    Thanks
    Namrata

  • How to build a small application using Java API

    Hai expertise,
         I want to retreive MDM repository info using JAVA API, i am following these blogs:
    /people/andreas.seifried/blog/2006/03/26/performing-free-form-searches-with-mdm-java-api
    /people/udi.katz/blog/2005/08/21/retrieving-data-from-mdm-server-using-the-mdm-java-api
    /people/udi.katz/blog/2005/07/17/mdm-connectivity-to-java-application
    <b>where to get the jar and sda files to build the application??
    In Developer Studio.. Windows -> Preferences -> Java -> Classpath variables. Is this the only place where we need to give the jar file path??
    Are there any other configurations to do(except setting container variable to MDM4J jar file) to connect my java application to MDM repository???</b>
    Regards,
    Chand.

    Hi Govada,
    (1)You need to add the MDM4j and other JAR files at:-
    right click on project -> Java Build Path -> Libraries -> Add External JARs
    (2)If the project is Web Dynpro project one
    then right click on project -> Web Dynpro Reference -> Library Reference -> and add sap.com/com.sap.mdm.tech.mdm4j
    Are you using JAVA API 1 or 2???
    Thanking you
    Namrata Dixit

  • How to create the groups in OID Using Java API.

    Hi,
    I need to create the group in OID Using Java API's only(i.e., javax.naming.* only).
    I need to achieve it without using any oracle specific jars.
    Is there any way to achieve it?.If there's a option to achieve it,do let me know.
    I also need to create the users in that group ,after creating it.
    If you share any useful link or ideas for the same would be great.
    Thanks
    Balaji

    bobws wrote:
    Hi,
    I want to find the installed JREs in windows using java. I couldn't fine any java API. So I am using the below code to fetch the JRE list from windows registries & parse the returned collection to know the installed JRE.Why? If you are running java you already have a JRE. So why not just use it?
    >
    String key = "HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment";
    Runtime.getRuntime().exec(
    "reg query " + "\"" + key + "\"");
    Is it legal to retrieve the installed JREs in this way? Legal? It is OS specific, and to a certain extent dependent on vendor and what the vendor wants to do. Could also be impacted by permissions. Other than that it is ok.
    I am feeling like its a type of hacking. So I couldn't decide whether this is legal (recommended) way of using. Does anybody can answer me. I can see the similar posts in google. Somebody suggests this way & somebody suggests to use preference API which is similar to this. Appreciate your help.Preferences won't work. It doesn't allow access to the registry in general, only a part of it. There are discussions in the JNI forum about retrieving VM versions. Prior to actually using the VM though.

  • How to connect with Oracle in java

    Hello!
    I would like to use java for my graduation project. And connect with Oracle in java.
    I used j2sdk1.4.2_04 and Oracle 9i release 9.2.0.1.0
    May I ask where could supply me information or content ?
    Thanks!!

    hi jus a sample code
    public class DbUtil {
    // Connection instance
    private static Connection conn = null;
    private Object connection;
    public DbUtil() {
         // Connect to the database
    dbConnect();
    * This method performs the clean up action and closes the application
    void exitDbUtil(){
    // If connected to database
    if (conn != null) {
    try {
    // Close the connection
    conn.close();
    conn=null;
    catch (Exception ex){      // Trap errors
    System.out.println(" Error while Closing the connection: "+ex.toString());
    * Creates a database connection object
    private void dbConnect() {
    try {
    String driverName = "oracle.jdbc.driver.OracleDriver";
    Class.forName(driverName);
    String url = "jdbc:oracle:thin:@" + ConnectionParams.s_hostName +
              ":" + ConnectionParams.s_portNumber +
              ":" + ConnectionParams.s_databaseSID;
    // Create a connection object
    conn = DriverManager.getConnection(url, ConnectionParams.s_userName,
                             ConnectionParams.s_password);
    catch(Exception e){

  • Oracle Reports Java API link Error

    The Oracle Reports Java API link on the Oracle Reports page produces an error.
    http://www.oracle.com/technology/products/reports/htdocs/getstart/docs/index.html

    1) In Oracle Reports *10g*, Reports services are exposed as a webservice. Though it does not contain all possible actions, you can use it to run report, get job info and some other operations . [ Other than this there is no exposed java API yet ]
    Please see chapter 14
    "Using the Oracle Reports Web Service"
    in http://download-west.oracle.com/docs/html/B10314_01/toc.htm
    Thanks
    The Oracle Reports Team

  • Newbie who want to use Java API for OLAP

    Hi all,
    I'm trying to learn how to use Java API for Oracle 10.2 OLAP. I went through the Java OLAP API user guide and I'm getting even more confused. Can somebody guide me to some good online materials?
    Many thanks!
    - Andrew

    Hi there,
    Did you see the examples in the Reference doc? :- http://download.oracle.com/docs/cd/B19306_01/olap.102/b14348/toc.htm
    Thanks,
    Stuart Bunby
    OLAP Blog: http://oracleOLAP.blogspot.com
    OLAP Wiki: http://wiki.oracle.com/page/Oracle+OLAP+Option
    OLAP on OTN: http://www.oracle.com/technology/products/bi/olap/index.html
    DW on OTN : http://www.oracle.com/technology/products/bi/db/11g/index.html

  • Where's the Oracle Forms Java API documentation for 11g?

    Hi,
    Can anyone point me in the direction of the Oracle Forms Java API documentation?
    The only thing I can find is this: http://www.oratransplant.nl/1012jdapiDoc/oracle/forms/jdapi/JdapiModule.html but this seems to be for 10.1.2 and it doesn’t correspond to the version I’m using (11.1.1.3).
    Help appreciated,
    Donal.

    i couldn't find the api either however if you implement the class you will simply get compiler errors explaining what you left out.

  • Create User in OID using Java API

    I read the documentation, read javadoc for Java API for OID, but still am not clear "how can I create a user in OID using Java API for OID."
    It tells us how to create a java object User, but then how do we write this object to OID ?
    I searched every where, metalink, forums, google...and am still looking for answere...
    Thanks in Advance
    Cheers
    Puneet

    I did it using the Novell LDAP java api:
    import com.novell.ldap.*;
    public class LdapAdmin {
    public static final String ldap_base = "dc=your,dc=company,dc=com";
    public static final String ldap_user_base = "cn=Users," + ldap_base;
    public static final String ldap_portal_base = "cn=PORTAL_GROUPS,cn=Groups," + ldap_base;
    public static final String ldap_extended_base = "cn=Extended Properties,cn=OracleContext," + ldap_base;
    public static final String ldap_dbdomain_base = "cn=OracleDefaultDomain,cn=OracleDBSecurity,cn=Products,cn=OracleContext," + ldap_base;
    public static final String ldap_context_base = "cn=COMMON,cn=OracleDBAppContext," + ldap_dbdomain_base;
    private static final String default_ldap_host = "infrastructure.your.company.com";
    private static final int default_ldap_port = 4032;
    private static final String default_ldap_login = "cn=orcladmin," + ldap_user_base;
    private static final String default_ldap_pwd = "welcome1";
    private static final String default_user_pwd = "secret";
    private static final String[] personclass_values = { "top", "person", "organizationalPerson", "inetOrgPerson", "orcluser", "orcluserv2" };
    public static LDAPConnection getConnection (String host, int port, String user, String pwd) {
    LDAPConnection lc = new LDAPConnection();
    try {
    lc.connect(host,port);
    lc.bind(user,pwd);
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in getConnection: "+lex.getResultCode()+"-"+lex.getLDAPErrorMessage());
         return lc;
    public static LDAPConnection getConnection (String host, int port) {
    LDAPConnection lc = new LDAPConnection();
    try {
    lc.connect(host,port);
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in getConnection: "+lex.getResultCode()+"-"+lex.getLDAPErrorMessage());
         return lc;
    public static LDAPConnection getConnection (String user, String pwd) {
    LDAPConnection lc = new LDAPConnection();
    try {
    lc.connect(default_ldap_host,default_ldap_port);
    lc.bind(user,pwd);
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in getConnection: ("+lex.getResultCode()+") - "+lex.getLDAPErrorMessage());
    lex.printStackTrace();
         return lc;
    public static LDAPConnection getConnection () {
    return getConnection(default_ldap_host,default_ldap_port);
    public static void bind (LDAPConnection conn, String user, String pwd) {
    try {
    conn.bind(user,pwd);
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in bind: ("+lex.getResultCode()+") - "+lex.getLDAPErrorMessage());
    lex.printStackTrace();
    private static void bind (LDAPConnection conn) {
    bind(conn,default_ldap_login,default_user_pwd);
    public static void modifyAttribute (LDAPConnection conn, String dn, String attr, String val, int mod) {
    LDAPAttribute attribute = new LDAPAttribute(attr,val);
    LDAPModification[] modification = new LDAPModification[] { new LDAPModification(mod,attribute) };
    try {
    conn.modify(dn,modification);
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in modifyAttribute: ("+lex.getResultCode()+") - "+lex.getLDAPErrorMessage());
    public static void modifyAttribute (LDAPConnection conn, String dn, String attr, String val) {
    modifyAttribute(conn,dn,attr,val,LDAPModification.REPLACE);
    public static void addAttribute (LDAPConnection conn, String dn, String attr, String val) {
    modifyAttribute(conn,dn,attr,val,LDAPModification.ADD);
    public static void deleteAttribute (LDAPConnection conn, String dn, String attr, String val) {
    modifyAttribute(conn,dn,attr,val,LDAPModification.DELETE);
    public static void deleteEntry (LDAPConnection conn, String dn) {
    try {
    conn.delete(dn);
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in deleteEntry: ("+lex.getResultCode()+") - "+lex.getLDAPErrorMessage());
    public static boolean isValidDn(LDAPConnection conn, String dn) {
    try {
    LDAPSearchResults res = conn.search(dn);
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in deleteEntry: ("+lex.getResultCode()+") - "+lex.getLDAPErrorMessage());
    return false;
    public static void createPerson (LDAPConnection conn, String net_id, String lname, String fname, String office, String email, String id, String fullname) {
         LDAPAttributeSet attributeSet = new LDAPAttributeSet();
    attributeSet.add(new LDAPAttribute("cn", net_id));
    attributeSet.add(new LDAPAttribute("sn", lname));
    attributeSet.add(new LDAPAttribute("objectclass", personclass_values));
    attributeSet.add(new LDAPAttribute("l", office));
    attributeSet.add(new LDAPAttribute("mail", email));
    attributeSet.add(new LDAPAttribute("employeeNumber", id));
    attributeSet.add(new LDAPAttribute("givenName", fname));
    attributeSet.add(new LDAPAttribute("uid", net_id));
    // attributeSet.add(new LDAPAttribute("fullName", fullname));
    attributeSet.add(new LDAPAttribute("orclpkcs12hint", default_user_pwd));
    attributeSet.add(new LDAPAttribute("orclpassword", VerifyPassword.getHash(net_id,default_user_pwd)));
    attributeSet.add(new LDAPAttribute("userpassword", default_user_pwd));
    attributeSet.add(new LDAPAttribute("orcldefaultprofilegroup", "cn=DEFAULT,"+ldap_portal_base));
    LDAPEntry entry = new LDAPEntry("cn="+net_id+","+ldap_user_base,attributeSet);
    try {
    conn.add(entry);
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in createPerson: ("+lex.getResultCode()+") - "+lex.getLDAPErrorMessage());
    public static void updatePerson (LDAPConnection conn, String net_id, String lname, String fname, String office, String email, String id, String fullname) {
    LDAPModification[] mod = new LDAPModification[8];
    mod[0] = new LDAPModification(LDAPModification.REPLACE,new LDAPAttribute("cn", net_id));
    mod[1] = new LDAPModification(LDAPModification.REPLACE,new LDAPAttribute("sn", lname));
    mod[2] = new LDAPModification(LDAPModification.REPLACE,new LDAPAttribute("l", office));
    mod[3] = new LDAPModification(LDAPModification.REPLACE,new LDAPAttribute("mail", email));
    mod[4] = new LDAPModification(LDAPModification.REPLACE,new LDAPAttribute("employeeNumber", id));
    mod[5] = new LDAPModification(LDAPModification.REPLACE,new LDAPAttribute("givenname", fname));
    mod[6] = new LDAPModification(LDAPModification.REPLACE,new LDAPAttribute("fullName", fullname));
    mod[7] = new LDAPModification(LDAPModification.REPLACE,new LDAPAttribute("uid", net_id));
    try {
    conn.modify("cn="+net_id+","+ldap_user_base,mod);
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in updatePerson: ("+lex.getResultCode()+") - "+lex.getLDAPErrorMessage());
    public static void main (String[] args) {
    try {
    LDAPConnection conn = getConnection(default_ldap_login,default_ldap_pwd);
    // updatePerson(conn,"ID1","Somebody","Joe","CLE","[email protected]","1","Joe Somebody 2");
    // modifyAttribute(conn,"cn=ID1,"+ldap_user_base,"fullName","Joe Somebody",LDAPModification.REPLACE);
    // modifyAttribute(conn,"cn=ID1,"+ldap_user_base,"displayName","Joe Somebody");
    createPerson(conn,"ID1","Somebody","Joe","CLE","[email protected]","1","Joe Somebody");
    // deleteEntry(conn,"cn=ID1,"+ldap_user_base);
    conn.disconnect();
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in main: ("+lex.getResultCode()+") - "+lex.getLDAPErrorMessage());
    }

  • Create group in OID using java api

    Hi all!
    I need to create group in OID using java api. Java api documentation contains examples for creating users but not for groups. I search oracle.com (and google) and didn't find any hint.
    Anybody know the way?
    thank you.

    Andrew,
    a group is created like any other entry in OID. You need to specify the dn, objectclass(es) and (mandatory) attributes.
    e.g.
    objectclass=groupOfUniqueNames
    with
    uniquemember=cn=orcladmin, cn=Users, dc=de,dc=oracle,dc=com
    as an example take a look at
    cn=iASAdmins, cn=Groups,cn=OracleContext,dc=de,dc=oracle,dc=com
    to see the schema (data) for groupofuniquenames you can either use ODM or query the directory server
    ldapsearch -p 3060 -b "cn=subschemasubentry" -s base "objectclass=*"
    regards,
    --Olaf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • Non-trival template use

    Hello My page design has all the components in the cells of a table. I am designing my menus/sub-menu in FW. The changing body of each page is in all the sections of the table below the row with the menus. I would like to lock all the sections of the

  • I need a Badi for Tx F.80

    Hi all, I need a badi for the tx " f.80 " and it will be trigger when I press the button post (save). Thank very mcuh. Moderator message: please search for available information/documentation before asking. locked by: Thomas Zloch on Oct 14, 2010 3:4

  • Spry Tabbed Panel obj Qs style

    Spry Tabbed Panel obj TAB NAMES how rather left-aligned(default) get centered? may have an image in a tab name? How tabs from left aligned extent to get all space(width) , all get bigger in width and aligned(the tabs) so tabbed area starts with: star

  • Photoshop CC didn't install properly

    The Photoshop CC folder shows the Photoshop CC appication only 30KB in size. In the Creative cloud list of downloaded APPS it shows Photoshop CC as up to date. I can't open Photoshop CC. I get a dialog box saying that Photoshop CC is only pertially i

  • Hyperion Performance Scorecard error when attempting to add Accountab'y Map

    Hi I getting the generic error message -- "Performance Scorecard is having difficulty fulfilling your request. Consult your Performance Scorecard Administrator." -- when I attempt to add a new Accountability Map. I am using the Balanced Scorecard fra