How to read OVD using java

Hi all,
how to access OVD using Java?
Thanks,
Kumar.P

Hi,
You can just normal LDAP API codes to connect to OVD the same way you connect to other LDAP servers.
PFB sample code for connecting to OVD.
Properties props = new Properties();
try {
props.load(new FileInputStream("LdapCredentials.Properties"));
} catch (IOException e) {
// TODO
ldapurl = "ldap://hostname:390";
ldapUser = "cn=orcladmin,ou=Org12,dc=ovid,dc=com";
userPassword = "welcome1"; //"Killtheking123456";
userContext = "ou=Join1,dc=ovid,dc=com";
Now, you have to get Directory Context as shown below.
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, ldapurl);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, username);
env.put(Context.SECURITY_CREDENTIALS, password);
//Initialize the Directory context
DirContext dCtx = new InitialDirContext(env);
Then you can perform search operations or new user creation etc., as you wish.
Does this help?
-Mahendra.

Similar Messages

  • How to open/read file using Java in Unix?

    Hi Friends,
    Can you please help me out how to open/read file using java in unix os? I have create one text file in "/home/test.txt" in unix environment. How to open the same file & read using java code?
    - Hiren Modi

    http://java.sun.com/docs/books/tutorial/essential/io/index.html

  • How can we make the ms-word data as read-only using java code?

    How can we make the ms-word data as read-only using java code?

    MVSK wrote:
    By using java code i opened a file in ms-word. But the data i want to display as read-only. that means should not change it.I don't think you can do that. Display pdf documents instead.

  • How to send attachments using java application and outlook

    Hi ,
    I created an application in java which is as
    on the Conference Tab i can schedule a conference and with the send command on page it map all the scheduled data to outlook(with all conference details) and using outlook send option the mails are send to appropriate user.
    but now i want to modify this application such as when i use the send command from my jsp page it should attach the file that is in .vcs or .ics format for auto updation of user calender.
    can any one know how to send attachment using java application .

    Last time I checked, SMS was a service between carriers and doing SMS yourself was really tricky. Some services existed to let you do it but as I recall they wanted non-trivial money.
    However, most phone carriers provide an email-to-SMS bridge of some kind.
    So the easiest thing is just to send an email.
    That's sending from a non-phone to a phone. There's a J2ME library to send/receive SMS from/to a phone.
    However, this is from memory, and a little out of date, so I could be entirely wrong. Hope it helps anyway.

  • How to resize image using java imageio

    Hello ,
    I want to know how to resize image using java imageio.
    I dont want to use java awt because i am writing a web application.
    help is very much needed
    thank you.

    Just use an AffineTransform !
    Its much easier

  • Hey need help reading images using java bean

    Hey everyone,
    I will like to read some images from a directory using Java and display it on a JSP page, how do I accomplish this,
    thanks
    KT

    What happen is, I have to display 52 card depending on string concatenation, I have a java file that takes two elements from an array, depending on the two strings concatenation I want to display an image on a jsp page, any ideas on how to accomplish this?

  • Read IDOC using java language

    Hi,
       I am a new to sap java develop.
      now i am doing some research about IDOC/ALE using java language. I  receive an IDOC file from the sap system ,now i want to read the data in the IDOC file and tranform it to an XML file. Is there anyway to do it? whether java have provided some Kits to finish it.
       thanks in advance.
        qiuguo

    Hi
    Please refer to
    1. idoc
    3. how to create a simple idoc in practice? can you provide an example?
    Regards
    Abhijith YS

  • How to send fax using java programming

    i need to send files in my hard disk through fax using java programming.
    i have found on the internet that it is possible to be implemented by using java.comm API and JTAPI. however, i don't know how...does anyone can tell me the details? also, as i know it will be a big project to send fax using such API. is that any other simple way to implement the fax function in java? thx a lot!

    To cse.mahbub:
    Are you aware that you replied to a 5 1/2 year old question?
    Please don't do that. Reply only to current questions.

  • How to create database connection and how to call it using Java

    Hi,
    Good day! I'd like to know how I can create a db connection in JDev, then use this connection to retrieve data using a Java Class? I've seen using New Gallery > Database Connection. But I'm not sure how I can access this connection using Java and display some output from the retrieved records.
    Any steps/tutorial link is appreciated.
    Thanks in advance,
    Rian

    Hi,
    If you need to access the connection in the entity object then refer http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcadvgen.htm#BABEIFAI i.e in MODEL.
    But if you want to access connection in ViewController part of application then you need to do it manually.For this i am giving you my code for reference.------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import javax.faces.context.FacesContext;
    import oracle.jdbc.pool.OracleDataSource;
    public class DataHandler {
    String jdbcUrl = null;
    String userid = null;
    String password = null;
    Connection conn;
    public static final String CONNECTION_STRING =
    FacesContext.getCurrentInstance().getExternalContext().getInitParameter("connectionString");
    public static final String USER_NAME =
    FacesContext.getCurrentInstance().getExternalContext().getInitParameter("userName");
    public static final String PASSWORD =
    FacesContext.getCurrentInstance().getExternalContext().getInitParameter("password");
    public DataHandler(String jdbcUrl, String userid, String password,
    boolean shouldConnect) throws SQLException {
    this.jdbcUrl = jdbcUrl;
    this.userid = userid;
    this.password = password;
    if (shouldConnect) {
    connect();
    public void connect() throws SQLException {
    OracleDataSource ds;
    ds = new OracleDataSource();
    ds.setURL(jdbcUrl);
    conn = ds.getConnection(userid, password);
    public Connection getConnection() {
    return conn;
    public ResultSet executeQuery(String sql) throws SQLException {
    Statement s = conn.createStatement();
    return s.executeQuery(sql);
    public void closeConnection() throws SQLException {
    if (!conn.isClosed()) {
    conn.close();
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

  • Read mail using java, and set the mail

    How can I read mail and set message "SEEN" with java? (javax.mail)
    IMAP supports flags; so there are no problems, just using
    msg.setFlag(Flags.Flag.SEEN, true);
    but,
    POP3 does not support flags; how can I solve this in POP3? I have searched for this problem, found that I can just check for the header "Status", but this header does not exsist. Then I tried to add this header, but again, then I got IllegalWriteException cause pop3-msg is writeprotected (yes: I opened the folder READ_WRITE); so; does anyone know how I can solve this problem?

    Hi !
    Could u plz send me the code u r having for reading mails using IMAP...actually v r trying to read mails from outlook but due to some security reasons our team has decided not to use pop3 ...
    Thanks in Advance
    sha

  • HOW to read file using ftp???

    Hi to all,
    I have problem with reading file using ftp connection, i want to read only 1024 bytes for one time, and i have
    next code wich read this:
    byte buffer[] = new byte[1024];
    while( (readCount = input.read(buffer)) > 0) {
    bos.write(buffer, 0, readCount);
    but I dont know how to put all read data in one byte[] if i dont know length of file.
    I can't do some like: byte file[] = new file[1000000];
    Thanks for all sugestions!

          * Download a file from a FTP server. A FTP URL is generated with the following syntax:
         * <code>ftp://user:password@host:port/filePath;type=i</code>.
          * @param ftpServer FTP server address (incl. optional port ':portNumber').
          * @param user Optional user name to login.
          * @param pwd Optional password for <i>user</i>.
          * @param fileName Name of file to download (with optional preceeding relative path, e.g. one/two/three.txt).
          * @param destination Destination file to save.
         * @throws MalformedURLException, IOException on error.
         public void download(String ftpServer, String user, String pwd, String fileName, File destination) throws MalformedURLException, IOException {
            if (ftpServer != null && fileName != null && destination != null) {
                StringBuffer sb = new StringBuffer("ftp://");
                if (user != null && pwd != null) { //need authentication?
                    sb.append(user);
                    sb.append(':');
                    sb.append(pwd);
                    sb.append('@');
                }//else: anonymous access
                sb.append(ftpServer);
                sb.append('/');
                sb.append(fileName);
                sb.append(";type=i"); //a=ASCII mode, i=image (binary) mode, d= file directory listing
                BufferedInputStream bis = null;
                BufferedOutputStream bos = null;
                try {
                    URL url = new URL(sb.toString());
                    URLConnection urlc = url.openConnection();
                    bis = new BufferedInputStream(urlc.getInputStream());
                    bos = new BufferedOutputStream(new FileOutputStream(destination.getName()));
                    int i;
                    while ((i = bis.read()) != -1) { //read next byte until end of stream
                        bos.write(i);
                    }//next byte
                } finally {
                    if (bis != null) try { bis.close(); } catch (IOException ioe) { /* ignore*/ }
                    if (bos != null) try { bos.close(); } catch (IOException ioe) { /* ignore*/ }
            }//else: input unavailable
        }//download()If you don't want to strore the data into a file, use ByteArrayOutputStream instead of a FileOutputStream.

  • How to read blank in java

    hi guys, im totally confused about how to read blank ( no character, or space ) in order to proceed my line counter program.
    thanks

    i'm trying to make the program read from a textfile, and trying to do like if there is a blank then assume we can go to the next line and that blank is count as 1 line.
    this is my code so far.
    import java.io.*;
    import java.util.*;
    public class Test
         public static void main(String[] args)
                                  throws FileNotFoundException
              FileReader inFile = new FileReader ("test.txt");
              PrintWriter outFile = new PrintWriter("testResult.txt");
                   int numLines = 0;
                   int numWords = 0;
                   int numChars = 0;
                   String line;
                   do {
                        line = inFile.nextLine();
                        if (line != " ")
                             numLines++;
                             numChars += line.length();
                             numWords += countWords(line);
                   while (line != " ");
                   System.out.println("The following text has: " + "\n" + numLines + " Lines" + "\n" +
                   numWords + " Words " + "\n" + numChars + " Characters");
         private static long countWords(String line)
                   int numWords = 0;
                   int index = 0;
                   boolean prevWhitespace = true;
                   while (index < line.length())
                        char c = line.charAt(index++);
                        boolean currWhitespace = Character.isWhitespace(c);
                        if (prevWhitespace && !currWhitespace)
                             numWords++;
                        prevWhitespace = currWhitespace;
                   return numWords;
    }and sorry for offtopic here, but i also getting an error here.
    C:\Documents and Settings\Test.java:18: cannot find symbol
    symbol : method nextLine()
    location: class java.io.FileReader
                        line = inFile.nextLine();

  • How to create Webservice using java

    Hi Experts,
          I am very new to Visual composer, can any one of you suggest how to create a webservice using java so that i can use that webservice in Visual Composer application.If it is possible please give me detailed description about it.
    Regards,
    Prasanna.

    Hi Prasanna,
    See if my article is of any use to you:
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/b00917dc-ead4-2910-3ebb-b0a63e49ef10">How to Create a Web Service using an Enterprise JavaBean</a>
    For creating Web Services, you won't need to do the MS SQL Part explained in my doc. You can just concentrate on the part where i explain how to create a Web Service using an EJB.
    Bye
    Ankur

  • How can zip file using java ?

    I would like to ask is that any package or example code allowing zipping serveral file using java ?

    Here's a test program I wrote, which may help. As far as I know the jip/zar classes are interchangeable.
    import java.io.*;
    import java.util.jar.*;
    public class ZipTest
        public static void main(String[] args) throws Exception
            /* create a file stream for the new zip file */
            FileOutputStream fileOutputStream=new FileOutputStream("test.zip");
            JarOutputStream zipOutputStream=new JarOutputStream(fileOutputStream);
            /* open file to add to zip file */
            File file=new File("test.dat");
            FileInputStream fileInputStream=new FileInputStream(file);
            /* create a buffer and read file into buffer */
            int length=(int)file.length();
            byte[] buffer=new byte[length];
            fileInputStream.read(buffer,0,length);
            /* create entry in zip file */
            JarEntry jarEntry=new JarEntry("test.dat");
            /* add it */
            zipOutputStream.putNextEntry(jarEntry);
            zipOutputStream.write(buffer,0,length);
            /* clean up and exit */
            fileInputStream.close();
            zipOutputStream.close();
    }

  • Reading msword using java

    I want to read msword file using java any one help me to do this
    thanks in advancce
    Message was edited by:
    [email protected]

    the msword section of poi is incomplete and has been inactive for several years.
    might be worth looking at word 2003 as this supports an published xml format for documents which you could access using any of the xml apis for java

Maybe you are looking for