How to use CreateNamedPipe in Java

Hi am integrate my java application with a c++ application & i don't have control over the c++ application, already the c++ application integrated with other c++ application using pipes, Now i want to integrate with Java. But i found that java doesn't support CreateNamedPipe().
Can anyone tell me how to get this done? But am able open,read,write pipes in java but createNamedPipe() causes the problem.
Thanks in Advance
Sahe

Hi, I created a JNI Wrapper for WinAPI CreateNamedPipe() am able to establish connection between VC++ and Java, But am struck when am trying to sending/receiving data. When am using BufferedWriter to Send data to VC++ application by that time VC++ application says Pipe Instance is buzy cannot open!! Am enclosing my code here, if anybody come across this please help me..
import java.io.*;
import java.util.*;
class Win32 {
    public static native int CreateNamedPipe(
        String  pipeName,      
        int dwOpenMode,       
        int dwPipeMode,           
        int nMaxInstances,          
        int nOutBufferSize,
        int nInBufferSize,  
          int nDefaultTimeOut,  
        int[] secAttrs);       
class OneToOne extends Thread {
     public OneToOne() {
          start();
     public void run() {
            try{
               int size=0;
               BufferedWriter pipeWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("\\\\.\\PIPE\\\\\\.\\pipe\\MCHPPipe_OUT")));
              while(true) {
                    Thread.currentThread().sleep(500);
                    pipeWriter.write("CONNECT");
          catch (IOException e){
                e.printStackTrace();
          catch (InterruptedException e){
                 e.printStackTrace();
    public static void main(String[] args) throws IOException {
          System.out.println("Creating a Named Pipe...");
          Win32.CreateNamedPipe("\\\\.\\PIPE\\\\\\.\\pipe\\MCHPPipe_IN", //"\\\\.\\pipe\\SamplePipe",
                     0x00000003, //ACCESSMODE
                     0x00000000, //PIPEMODE
                     1,       // no instance
                     1024,    // out buff size
                     1024,    // in buff size
                     0x1D4C0,//Time out
                     null);   // secuirty
            Win32.CreateNamedPipe("\\\\.\\PIPE\\\\\\.\\pipe\\MCHPPipe_OUT",
                     0x00000003, //ACCESSMODE
                     0x00000000, //PIPEMODE
                     1,       // no instance
                     1024,    // out buff size
                     1024,    // in buff size
                     0x1D4C0,//Time out
                     null);   // secuirty
          System.out.println("PIPE IS CREATED");
          new OneToOne();
    static {
          System.loadLibrary("OneToOne");
}

Similar Messages

  • How to use the Public Java API

    Is it possible to use the Public Java API to write a custom transformation in Java and use this in OWB. i.e. Say I have a Dateofbirth field in my source database and an Agegroup field in the target database, and I write a transformation in Java to take the Dateofbirth as an input parameter to the method and calculate the Agegroup e.g. 25-30, and return it from this method which then populates the Agegroup field in the target database. If so, how do I go about this?

    Martin,
    In general, yes you could... but you do not need to. You could use the UI to implement this requirement. The public Java API is there for you to manipulate metadata. How you implement your system, is independent of that.
    The way you would go about the case you just mentioned... you would write the Java code, deploy it into the database, wrap it in a PL/SQL procedure or function, and call it from OWB.
    Would this be a good idea...? I think no. Unless you have very complicated calculations that can only be performed in Java, I strongly encourage you use the PL/SQL language. Reason being: transformation will be much faster, because there is no need to translate PL/SQL into Java and back again.
    Hope this helps,
    Mark.

  • I need to learn how to use all about java & mysql...help me!

    I have a situation here, I need to learn how to use java with mysql
    . Can I connect to a MYSQL DB with servlets?
    how can I build an e-mail server with java (no matter how difficult)
    please, I need help, and I really apreciate your help.
    thank you very much!!

    I have a situation here, I need to learn how to use
    java with mysql
    . Can I connect to a MYSQL DB with servlets?Yes... documentation to help you connect to any database can be found at http://java.sun.com/products/jdbc. To connect to MySQL, you'll need drivers (sourceforge.net), and the specific connection URL for those drivers will be included in the documentation.
    how can I build an e-mail server with java (no matter
    how difficult)If you're fairly new to JSP/Servlets, you may be in over your head here, since an email server is no easy application to code. Here's a link to the source code for the JAMES project... Apache's Java email server... maybe you can find some useful information there...
    http://www.ibiblio.org/pub/packages/infosystems/WWW/servers/apache/jakarta/james/source/

  • How to use connec with java 6.0 ?

    I often use the function below to connect Database:
         public Connection getConnection(){
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    conn=DriverManager.getConnection("jdbc:odbc:EmployeeManagerDB","sa","sa");
    System.out.println("Get connection successfully!");
    catch(Exception e){
                   System.out.println("Error: " +e);
    return conn;
    but now, with Java 6.0 . don't use "class.forName....for method"
    can you tell me how to use it??
    thanks !

    but now, with Java 6.0 . don't use
    "class.forName....for method" Where did you get this idea?He's perfectly correct. JDBC 4.0 takes advantage of the Java SE Service Provide mechanism in Java 6 to do away with the requirement. So, if you have Java 6 and a JDBC 4 driver (it's a mandatory feature) you simply omit the forName() call.
    The only problem is that there aren't that many complete JDBC 4 drivers out there yet.

  • HELP: do u know how to use forms pluggable java component...

    Hi all,
    I'm looking for a sample for using java component within Forms: how to installl them? how to use them? ...
    Cyryl from france

    Did you already check the demos on OTN at:
    http://otn.oracle.com/sample_code/products/forms/content.html
    Check the viewlets to see how to develop and deploy them and you can even get code to use them.

  • How to use Barcode for Java

    First of all, If this is the wrong forum to post this, please tell...
    Now to the bussines:
    Surfing through the web I found something called Barcode For Java, and my question is how to implement in java, how to use it in a program, what's the purpose of it.Also if this is compatible with EasyEclipse for Java 1.3.1
    Any help would be appreciated, thanks

    Now let me get this straight.
    -- You don't know what this is
    -- You don't know what it's for
    -- You don't know how it's used
    So WTF do you know that makes you want to use it?
    db

  • How to use xdk for java

    Hi,
    I have downloaded the xdk for java and i have unzipped them into my c:\xdk-java folder.
    I have oracle 8.1.7 database and i want to use this xdk for java to generate xml files.
    How to start with this and how to use this tool to generate xml files from my database.
    Anyone can give me the steps for using this and generating xml files.
    Any help will be appreciated..

    Hi,
    You can start from reading the XSU document and try the demos come with the package. The document is at:
    http://otn.oracle.com/docs/tech/xml/xdk_java/doc_library/Production9i/doc/java/xsu/xsu_userguide.html

  • How to use Threads in Java?

    Hi all,
    I want to run many programs in the same time. So i want to know if anybody can help me using threads in java. Any help or code will be very appreciated!
    Thanks in advance,
    A. Santos

    All you have to do is create classes that extend Thread, implement their run() methods and then instantiate and call their start() methods:
    public class Class1 extends Thread {
      public void run() {
        // do what you need to do
    public class Class2 extends Thread {
      public void run() {
        // do what you need to do
    public class Class3 extends Thread {
      public void run() {
        // do what you need to do
    public class Main {
      public static void main (String [] args) {
        Class1 c1 = new Class1();
        Class2 c2 = new Class2();
        Class3 c3 = new Class3();
        c1.start();
        c2.start();
        c3.start();
    }

  • How to use xml in java

    hi,
    can anybody tell me in what scenarios we can use xml in java,jsp and servlets.
    give some information and help on this..
    regards,
    javafan

    define scenarios. You can use XML in java at any time you want.
    - check out SAX http://java.sun.com/xml/tutorial_intro.html
    - check out Xerces 2 http://xml.apache.org/xerces2-j/

  • How to use VPD in Java/Struts JSP portlet with SSO

    DB = 10.1.0 (Standard Edition)
    Portal = 9.0.4.1
    10gAS = 9.4.0.1 (EE)
    I am in the beginning stages of developing some portlets that will be Java/Struts JSP based. We use SSO and have implemented some VPD security in our DB by creating some views that use SYS_CONTEXT('USERENV','CURRENT_USERID').
    These Java portlets connect to the DB using a defined JDBC connection for the OC4J container they are deployed in. The problem I'm having is that the call to SYS_CONTEXT is returning the user of the JDBC connection and not the SSO user. So far I have been unable to find any documentation that will point me in the right direction to get this configured properly.
    Deployment and configuration are as follows. Deploy war file to custom container on app server. In the configuration of the OC4J contain the app used the containers default JDBC connection using the oracle.jdbc.pool.OracleDataSource class. Max and Min open connections are blank.
    In the portal configuration under Navigator - Providers tab we defined a new Registered Provider. In the Connections tab for the provider we Specify the URL Http://hpsrv02.simsol.com:7777/discovery-portlets/providers. Under "Specify how the user's identity will be set by the Portal..." the "The user has the same identity in the Web providers application as in the Single Sign-On identity" is selected. Under "User/Session Information" User is selected and Login Frequency is set to "Once per user session". Then we created a new portal page and created a new portlet with the new provider.
    Just an FYI I do have Discoverer working with VPD and any report portlet, dynamic page portlet and any other type of portlet I created all work correctly with VPD it is just the java/struts one that is not working.
    So does any one have any insight into what configuration steps I have missed?
    Any help is much appreciated,
    Ed Klinger

    Ed,
    Your java code must get the SSO username (it's just a HTTP header variable) :
    ie: code sample...
    Enumeration e = request.getHeaderNames();
    while (e.hasMoreElements()) {
    String name = (String)e.nextElement();
    String value = request.getHeader(name);
    out.println("<br> "+name + " = " + value);
    if (name.toUpperCase().trim().equals("OSSO-USER-DN")){
    dn_user=value;
    out.println("<br>******** USER DN = "+dn_user);
    Then, the SSO username can be used in the VPD policy.
    Note that there is a difference between the sso username and the database username . SSO username is not known by database (CURRENT_USERID will return a database username)
    Discoverer worked OK in your case with the SYS_CONTEXT (.. CURRENT_USERID) because authentication is made by database user, probably.

  • How to Use IDOC in Java Mapping?

    Hello -
    1. How can i use an IDOC to map to an xml file using Java mapping in an IDOC -> XI -> XML file scenario?
    2. How can i test this scenario outside XI, i mean using Eclipse?
    3. How can i create a test data for IDOC for the above scenario in XML format to test it using Java program?
    Thanks,
    Tirumal

    Hi,
    <i>***1. How can i use an IDOC to map to an xml file using Java mapping in an IDOC -> XI -> XML file scenario?</i>
    It will be a direct xml to xml mapping. Is your requirement requires Java Mapping? Otherwise you can easily do without that - check this-
    Is there simply way to map an idoc to an flatfile?
    <i>***2. How can i test this scenario outside XI, i mean using Eclipse?</i>
    You need to have XML input for this. Just try to get the IDoc XML or create xml input based on the Idoc Structure. You can make use of  WE60 to get  IDOC xsd .
    <i>***3. How can i create a test data for IDOC for the above scenario in XML format to test it using Java program?</i>
    Go to Tcode WE19 in the R/3 and generate the outbound Idoc . And then use that xml ( for question no 2). as a test data to test independently.
    Hope this helps..
    Regards,
    Moorthy

  • How to use Entrust with java application on unix platform

    Hi all,
    i have question regarding the use of Entrust with java application on unix
    1)I want to use Entrust for encryption/decryption of the file in my core java application on unix platform.
    What should be requiremnet for the same and how it is implemented?.
    2) I want to Use Entrust for Authentication purpose in my java based web application on unix platform.
    What are requirements for Entrust Authentication and how it is implemented ?

    any one has solution?

  • How to use OCX in Java

    Hi,
    I have a third party OCX file that I would like to incorporate to my java application.
    May i know how can I go about doing it?
    Please advise. Thanks.
    Damien

    There are some commertial solutions.
    I remember the product j-integra, but now they changed a name...
    The best solution for me - using SWT from "eclipse.org"
    This is LGPL package like a SWING. It does support ActiveX (OCX).
    The problem could be - integrate it with SWING... :-(
    I had done it for 1.3.1, but since 1.4 Sun made changes... So you will need to it by yourself. OR make all your GUI in SWT.
    Cheers,
    Ratu

  • How to use beans in java application server 8.1?

    i created a bean to use in a jsp page. then i copied the jsp page to "domains/domain1/docroot " directory and the class file to the "domains/domain1/lib/classes" folder. But now i can only access the jsp page the bean is not included in it. how can i do this without using deploying tool?

    Can you repost this question in the AppServer forum?
    http://swforum.sun.com/jive/category.jspa?categoryID=35

  • How to use Web Dynpro Java isChanged and isChangedByClient

    Hello,
    I have read thorugh a lot of documentation, threads, ... --> but the picture is not geting clearer fro me.
    We have Web Dynpro Java Application (on Netweaver 7.0 SP12) running in Enterprise Portal. We need to tell the portal work protect mode, that we have unsaved changes (how to do this is clear).
    I am struggling with figuring out, that my Web Dynpro Context has unsaved changes. I found the two change-indicators isChanged() and isChangedByClient(), which already confuses me a little bit.
    Anyway, this is what I have figured out so far:
    I am calling wdContext.currentContextElement().isChangedByClient() to figure out changes and when a Save operation has been completed sucessfully, I call wdContext.currentContextElement().node().getContext().resetChangedByClient(). This works for some of the changes made by the user.
    I then tried calling wdContext.nodeABC().getElementAt(i).isChanged() for all nodes of my Web Dynpro Context, but this results in detecting changes before the user ha done any interaction.
    Implementing an own change tracking (i.e. by adding a changed-Attribute to each context node) does not seem a viable option for me.
    So these are my questions:
    - Does anyone now a working pattern relying on those chnage indicators ?
    - Does anyone now how to reset the isChanged indicator (or when it is resetted by the framework) ?
    Any help appreciated.
    Thank you,
    Stefan

    Hi
    Check this link
    Re: How to keep isChangedbyClient flag set between roundtrips?
    http://help.sap.com/javadocs/NW04/current/wd/com/sap/tc/webdynpro/progmodel/api/IWDNodeElement.html
    Thanks

Maybe you are looking for

  • ATG 10.1.1 - MySQL foriegn key issues

    Hi All, Am trying to setup ATG 10.1.1 in a distributed environment for development purpose. I have 2 boxes. Windows box: contains MySQL installation and will be treated as DB Server Linux box: contains ATG/Weblogic installation and will be treated as

  • How can I watch a movie I rented on the iTunes store

    How can I watch a movie I rented on iTunes Store on my iPad mini?

  • Intercompany sales/billing - trading partner functionality

    Hi Guys, I understand the theory of trading partner. But if anyone can give me an example (accounting entries) of trading partner in intercompany sales/billing..that would be very helpful. Thanks and Regards, MS

  • Apple Mac mini g4 with Apple Pro Keyboard shift key stuck on

    Hey guys, My mac mini g4 with Apple Pro keyboard has it's shift key stuck on and will not disable, this happened after I cleaned the keys with a "magic eraser" and is probably water damage, but when it is plugged into a PC the shift key is off and ca

  • SAPGui 7.20 Patch 6 - sapbarc.ocx - Error

    APO users report an activex error when using /SAPAPO/CDPSO Error is:  Illegal objecttype in BarifEstimateChartforObject I noted that the file in the Front End SAPGUI folder: sapbarc.ocx is changed with Patch 6 Previously we were at Patch 3. Anyone el