Attach Forms With Comm Port in Oracle Forms

I am trying to make connection of Oracle forms Builder with my device using comm port but i dnt know the complete procedure to attach the comm with oracle forms also i have no idea to convert asquii data to normal form.Please any one help me to attach comm port with my oracle forms and also convert asqui code which is showing on hyper terminal into normal data.Also I am using oracle forms 6i

Make a java component (PJC) and use a rxtx library (http://rxtx.qbang.org/wiki/index.php/Examples) ...
I have made a PJC to use a RS232 port from oracle forms for Hypercom POS terminal..
Here is my code (in short i will post a component on PJC site (here I can't post a complete code because of 30000 char limit ;) )..
If you look in method "public void init(IHandler handler) " I make a download of rxtxSerial.dll from my forms server and then I call System.loadLibrary("rxtxSerial");"
In other way you must put the dll in windows/system32 path.. This dll is native library for rs232 communication.
If you look at the method "public void doTransaction" you can see the initialization of comm port...
With inputStream and OutputStream you read and write datas to/from your rs232 port..
p.s: the code is not complete but you can see how I made the rs232 communication (also the code is not final ;) )
====================================================
public class PosTerminalPjc extends VBean {
     private static final long serialVersionUID = -8814623494538014849L;
     Properties res = new Properties();
     SerialPort serialPort;
     OutputStream os;
     InputStream is;
     CommPortIdentifier portId;
     Enumeration portList;
     IHandler mHandler;
  Random randomGenerator = new Random();
        char STX = 2;
     char ETX = 3;
     char EOT = 4;
     char ACK = 6;
     char NAK = 15;
     char FS = 28;
     private static final ID COMPORT         = ID.registerProperty("COMPORT"); // serial port (COM1,COM2,COM3,...)
     private static final ID AMOUNT          = ID.registerProperty("AMOUNT"); // amount of the transaction (12)
     private static final ID TRANSACTIONTYPE = ID.registerProperty("TRANSACTIONTYPE"); // SALE, REFUND
  private static final ID EXECUTE         = ID.registerProperty("EXECUTE"); // invoke doTransaction();
  //Output parameters to form
  private static final ID TRANSACTIONPROCESSED  = ID.registerProperty("TRANSACTIONPROCESSED");
  private static final ID TRANSACTIONFLAG       = ID.registerProperty("TRANSACTIONFLAG");
  private static final ID TRANSACTIONNUMBER     = ID.registerProperty("TRANSACTIONNUMBER");
  private static final ID BATCHNUMBER           = ID.registerProperty("BATCHNUMBER");
  private static final ID TRANSACTIONDATE       = ID.registerProperty("TRANSACTIONDATE");
  private static final ID TRANSACTIONTIME       = ID.registerProperty("TRANSACTIONTIME");
  private static final ID TRANSACTIONAMOUNT     = ID.registerProperty("TRANSACTIONAMOUNT");
  private static final ID CARDDATASOURCE        = ID.registerProperty("CARDDATASOURCE");
  private static final ID NUMBERCUSTOMERCARD    = ID.registerProperty("NUMBERCUSTOMERCARD");
  private static final ID EXPIRATIONDATE        = ID.registerProperty("EXPIRATIONDATE");
  private static final ID TERMINALID            = ID.registerProperty("TERMINALID");
  private static final ID MERCHANTID            = ID.registerProperty("MERCHANTID");
  private static final ID COMPANYNAME           = ID.registerProperty("COMPANYNAME");
  private static final ID SEQUENTIALNUMBER      = ID.registerProperty("SEQUENTIALNUMBER");
  private static final ID ERRORDESC             = ID.registerProperty("ERRORDESC");
     //Events
  private static final ID EVT_OK  = ID.registerProperty("EVT_OK"); //custom event if all ok
  private static final ID EVT_ERR = ID.registerProperty("EVT_ERR"); //custom event if error occured
  // state machine variables
     long l_timeout;
     long l_wait_for = 5000; // pos terminal wait for command (5 seconds)
     long l_wait_for_transaction = 62000 * 2; // pos terminal timeout
     long l_second = 1000; // one second
     byte b_retry = 0;
     String dataValue = "";
  byte[] readBuffer = new byte[2000]; //2000 bytes buffer to read rs232 stream
     String comPort = ""; // local variable to store com port name
                                   // (COM1,COM2,...)
     String transactionType = "SALE"; // type of transaction to be executed (SALE
                                                  // or REFUND) default SALE
     String amount = "0"; // default amount value is set to 0
     //output paramerers
  String transactionProcessed = "";
  String transactionFlag = "";
  String transactionNumber = "";
  String batchNumber = "";
  String transactionDate = "";
  String transactionTime = "";
  String transactionAmount = "";
  String cardDataSource = "";
  String numberCustomerCard = "";
  String expirationDate = "";
  String terminalId = "";
  String merchandId = "";
  String companyName = "";
  String sequentialNumber ="";
  String errorDescription;
    public PosTerminalPjc() {
          super();
          System.out.println("============================");
          System.out.println("== State machine POS v1.0 ==");
          System.out.println("== Peter Valencic (c)     ==");
          System.out.println("== 03.04.2012             ==");
          System.out.println("============================");
    System.out.println("java.library.path: "+System.getProperty("java.library.path"));
          try {
               res.load(this.getClass().getResourceAsStream("/res/language.properties")); // load language file
          } catch (Exception ex) {
               System.err.println("Err loading language.properties file: "
                         + ex.toString());
  public void init(IHandler handler)
    super.init(handler);
    this.mHandler = handler;
    System.out.println("init handler ok");
    System.out.println("code base: "+handler.getCodeBase());
    //load dll from codeBase URL
    try
      String mylibName = "rxtxSerial.dll";
      String URLpath = "http://dekani:7777/forms/java/";
      System.out.println("URL: "+ URLpath + mylibName);
      URL libUrl = new URL(URLpath+mylibName);
      System.out.println("libUrlgetFile: " + libUrl.getFile());
      File file = new File(mylibName);
      System.out.println(file);
      if (!file.exists())
      file.createNewFile();
      URLConnection urlc = libUrl.openConnection();
      InputStream in = urlc.getInputStream();
      FileOutputStream out = new FileOutputStream(file);
      byte[] buffer = new byte[1048];
      int read;
      while ((read = in.read(buffer)) != -1){
         out.write(buffer, 0, read); // write
        out.close();
        in.close();
        System.loadLibrary("rxtxSerial");
    catch(Exception exc)
      System.err.println("Exception SystemLoadLibrary: " + exc.toString());
      this.showError(res.getProperty("s_dlg_err_title"),res.getProperty("s_lib"));
  private void doTransaction() throws Exception {
    String sequentialNumber = ""+getRandomInteger(1000,9000,randomGenerator);
          String phase = null; // initial null value for state machine phase
          long l_ack_timeout = 0; //initial value for acknowledge timeout
          // com port check
          if (getComPort().trim().equalsIgnoreCase("")) {
               this.showError(res.getProperty("s_dlg_err_title"),
                         res.getProperty("s_com_invalid"));
          if (this.mHandler != null)
                            CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                            this.setErrorDescription(res.getProperty("s_com_invalid"));
                            dispatchCustomEvent(ce);
               return;
          // transaction type chek
          System.out.println(this.getTransactionType());
          if (!getTransactionType().equalsIgnoreCase("REFUND")
                    & !getTransactionType().equalsIgnoreCase("SALE")
        & !getTransactionType().equalsIgnoreCase("TICKET")
        & !getTransactionType().equalsIgnoreCase("VOID")
               this.showError(res.getProperty("s_dlg_err_title"),res.getProperty("s_tran_invalid_type"));
      if (this.mHandler != null)
                            CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                            this.setErrorDescription(res.getProperty("s_tran_invalid_type"));
                            dispatchCustomEvent(ce);
               return;
          portList = portId.getPortIdentifiers();
          while (portList.hasMoreElements()) {
               portId = (CommPortIdentifier) portList.nextElement();
      System.out.println(portId.getName());
               if (portId.getName().equalsIgnoreCase(this.getComPort())) {
                    System.out.println("Port is used : "
                              + portId.isCurrentlyOwned());
                    serialPort = (SerialPort) portId.open("ComDriver", 2000);
                    serialPort.setSerialPortParams(9600, SerialPort.DATABITS_7,
                              SerialPort.STOPBITS_1, SerialPort.PARITY_EVEN);
                    serialPort.notifyOnDataAvailable(true);
                    serialPort.notifyOnOutputEmpty(true);
                    os = serialPort.getOutputStream();
                    is = serialPort.getInputStream();
                    break;
          if (portId == null) {
          this.showError(res.getProperty("s_dlg_err_title"),res.getProperty("s_com_not_found"));
      if (this.mHandler != null)
                            CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                            this.setErrorDescription(res.getProperty("s_com_not_found"));
                            dispatchCustomEvent(ce);
               return;
    else if (portId.getName().equalsIgnoreCase(this.getComPort()) == false)
              this.showError(res.getProperty("s_dlg_err_title"),res.getProperty("s_com_not_found"));
      if (this.mHandler != null)
                            CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                            this.setErrorDescription(res.getProperty("s_com_not_found"));
                            dispatchCustomEvent(ce);
      return;
          // state machine infinite loop
          while (true)
               // SEND DATA TO POS TERMINAL
               if (phase == null)
                    System.out.println("start phase");
                    byte[] req = null;
                    //verify transaction type to be SALE or REFUND
                    //if REFUND then transaction number must be specified
                    if (getTransactionType().equalsIgnoreCase("SALE")) {
                         System.out.println("--> SALE send message to the pos terminal");
                         System.out.println("--> amount: " + amount);
                         req = protocolStream("000000"+sequentialNumber+"01100" + FS + amount + FS
                                   + FS + "+0" + FS + "978" + FS + FS + FS + FS + FS
                                   + FS + FS + ETX);
                    else if (getTransactionType().equalsIgnoreCase("REFUND")) {
                         System.out.println("--> REFUND send message to the pos terminal");
                         System.out.println("--> amount: " + amount);
                         System.out.println("--> transaction number: " + getTransactionNumber());
                         req = protocolStream("000000123405100" + getTransactionNumber() + FS + amount
                                   + FS + FS + "+0" + FS + "978" + FS + FS + FS + FS
                                   + FS + FS + FS + ETX);
        else if (getTransactionType().equalsIgnoreCase("VOID")) {
                         System.out.println("--> VOID transaction");
                         System.out.println("--> amount: " + amount);
                         System.out.println("--> transaction number: " + getTransactionNumber());
                         req = protocolStream("000000123410100" + getTransactionNumber() + FS      + FS + FS + "+0" + FS + "978" + FS + FS + FS + FS
                                   + FS + FS + FS + ETX);
        else if (getTransactionType().equalsIgnoreCase("TICKET")) {
                         System.out.println("--> TICKET duplicate");
                           req = protocolStream("000000123413100" + getTransactionNumber() + FS      + FS + FS + "+0" + FS + "978" + FS + FS + FS + FS
                                   + FS + FS + FS + ETX);
        else {
                         //nothing ;)
                    os.write(req);
                    os.flush();
                    l_ack_timeout = System.currentTimeMillis() + 1500;
                    //wait for half second
                    Thread.sleep(500);
                    l_timeout = System.currentTimeMillis() + l_wait_for; //add some time for timeout
                    phase = "TO_POS_ACK";
                    System.out.println("phase: " + phase);
               }//phase null
               //CHECK IF THE TIMEOUT OCCURED
            if (phase.equalsIgnoreCase("TO_POS_ACK") & (l_timeout < System.currentTimeMillis()) & (b_retry < 4))
                b_retry += 1;
                System.out.println("TIMEOUT: " + b_retry);
                l_timeout = System.currentTimeMillis() + l_wait_for;
                if (b_retry >= 4) {
                    System.out.println("Timeout occured");
                    closePort();
                    this.showError(res.getProperty("s_dlg_err_title"),res.getProperty("s_timeout"));
                    break;
          //CHECK FOR THE ACKNOWLEDGE (FIRST RESPONSE FROM POS TERMINAL)
            if (phase.equalsIgnoreCase("TO_POS_ACK") &
                    (l_ack_timeout < System.currentTimeMillis())) {
                try {
                    int numBytes = 0;
                    dataValue = "";
                    while ((numBytes = is.read(readBuffer)) > 0) {
                        dataValue += new String(readBuffer, 0, numBytes, "ASCII");
                    if (dataValue.getBytes().length > 0) {
                        System.out.println("->first byte: " +
                            dataValue.getBytes()[0]);
                        System.out.println("total length: " +
                            dataValue.getBytes().length);
                        //check for ack byte
                        if (dataValue.getBytes()[0] == 6) {
                            System.out.println(
                                "<--ACKNOWLEDGE received from pos terminal");
                            phase = "WAIT_FOR_TRANSACTION";
                            l_timeout = System.currentTimeMillis() + l_wait_for_transaction;
                            System.out.println("-> wait for transaction response");
                } catch (IOException ev) {
          //WAIT FOR TIMEOUT ON MESSAGE (watch dog timer)
            if (phase.equalsIgnoreCase("WAIT_FOR_TRANSACTION") &
                    (l_timeout < System.currentTimeMillis())) {
                System.out.println(
                    "Error receiving response from pos terminal!!!");
                closePort();
                this.showError(res.getProperty("s_dlg_err_title"),
                             res.getProperty("s_response_error"));
              if (this.mHandler != null)
                CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                this.setErrorDescription(res.getProperty("s_response_error"));
                dispatchCustomEvent(ce);
                break;
          //WAIT FOR SOME DATA TO COME FROM POS TERMINAL OVER RS232
            if (phase.equalsIgnoreCase("WAIT_FOR_TRANSACTION")) {
                try {
                    int numBytes = 0;
                    dataValue = "";
                    Thread.sleep(500);
                    while ((numBytes = is.read(readBuffer)) > 0) {
                        dataValue += new String(readBuffer, 0, numBytes, "ASCII");
                    if (dataValue.getBytes().length > 0) {
                        System.out.println("->first byte: " +
                            dataValue.getBytes()[0] + "|" +
                            dataValue.getBytes()[1]);
                        System.out.println("->ascii: " + dataValue);
                        System.out.println("total length: " +
                            dataValue.getBytes().length);
                        if (dataValue.indexOf("PREKINIL UPORABNIK") != -1) {
                            System.out.println(
                                "Uporabnik je prekinil povezavo!");
                              closePort();
                            //transaction cancelled by user s_user_cancel
                            this.showError(res.getProperty("s_dlg_err_title"),
                                         res.getProperty("s_user_cancel"));
                          if (this.mHandler != null)
                            CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                            this.setErrorDescription(res.getProperty("s_user_cancel"));
                            dispatchCustomEvent(ce);
                            break;
                        if (dataValue.indexOf("NAPACEN VNOS") != -1) {
                            System.out.println("Napačen vnos");
                            closePort();
                            //invalid user entry
                            this.showError(res.getProperty("s_dlg_err_title"),
                                         res.getProperty("s_user_invalid_entry"));
                           if (this.mHandler != null)
                            CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                            this.setErrorDescription(res.getProperty("s_user_invalid_entry"));
                            dispatchCustomEvent(ce);
                            break;
                        if (dataValue.indexOf("PROSIM POCAKAJ") != -1) {
                            System.out.println("<-- PROSIM POCAKAJ");
                            continue;
                        //preberemo podatke iz stringe terminala
                        if (dataValue.indexOf("SPREJETO") != -1) {
                            closePort();
                            System.out.println("<-- TRANSAKCIJA SPREJETA");
                            System.out.println(dataValue);
                            StringTokenizer st = new StringTokenizer(dataValue, "\034" );
                            String dv = st.nextToken();
                            sequentialNumber = dv.substring(6,10);
                            transactionProcessed = dv.substring(1, 3);
                            transactionFlag = dv.substring(13,15);
                            transactionNumber = dv.substring(15,21);
                            batchNumber = dv.substring(21,25);
                            transactionDate = dv.substring(25,31);
                            transactionTime = dv.substring(31,37);
                            transactionAmount = st.nextToken();
                            st.nextToken(); //Amount exponent
                            st.nextToken(); //Amount currency
                            cardDataSource = st.nextToken();
                            numberCustomerCard = st.nextToken();
                            expirationDate = st.nextToken();
                            st.nextToken(); // authorization code
                            terminalId = st.nextToken();
                            merchandId = st.nextToken();
                            companyName = st.nextToken();
                            System.out.println("================");
                            System.out.println(transactionProcessed);
                            System.out.println(transactionFlag);
                            System.out.println(transactionNumber);
                            System.out.println(batchNumber);
                            System.out.println(transactionDate);
                            System.out.println(transactionTime);
                            System.out.println(transactionAmount);
                            System.out.println(cardDataSource);
                            System.out.println(numberCustomerCard);
                            System.out.println(expirationDate);
                            System.out.println(terminalId);
                            System.out.println(merchandId);
                            System.out.println(companyName);
                            if (this.mHandler != null)
                              System.out.println("dispatch custom event");
                              CustomEvent ce = new CustomEvent(this.mHandler, EVT_OK);
                              dispatchCustomEvent(ce);
                            return;
                } catch (IOException ev) {
                  System.err.println("Exception sm: " + ev.toString());
            System.out.print('*');
            Thread.sleep(200);
          }//end state machine loop
      * protocolStream prepare the stream to be send over RS232 to POS terminal
      * with LRC cheksum control
      * @param data
      * @return byte[]
     private byte[] protocolStream(String data) {
          char STX = (char) 0x02;
          String tmp = "" + STX + STX + data + "" + getLRC(data);
          System.out.println("PStream: " + tmp);
          for (int i = 0; i < tmp.getBytes().length; i++) {
               System.out.print(tmp.getBytes() + ":");
          return tmp.getBytes();
* close port and stream
private void closePort()
try {
serialPort.close();
is.close();
os.close();
} catch (Exception ee) {
     * Longitudinal Redundancy Check (LRC)
     * @param packet
     * @return String
     private String getLRC(String packet) {
          char[] splitPacket = packet.toCharArray();
          char lrc = 0x00;
          for (int x = 0; x < splitPacket.length; x++) {
               lrc = (char) (lrc ^ splitPacket[x]);
          return "" + (char) lrc;
     private String paddingString(String s, int n, char c, boolean paddingLeft) {
          if (s == null) {
               return s;
          int add = n - s.length(); // may overflow int size... should not be a
          if (add <= 0) {
               return s;
          StringBuffer str = new StringBuffer(s);
          char[] ch = new char[add];
          Arrays.fill(ch, c);
          if (paddingLeft) {
               str.insert(0, ch);
          } else {
               str.append(ch);
          return str.toString();
public boolean setProperty(ID id, Object value)
if (id.toString().equalsIgnoreCase("COMPORT")) {
setComPort((String)value);
System.out.println("RS232 com port: " + getComPort());
return false;
if (id.toString().equalsIgnoreCase("AMOUNT")) {
this.setAmount((String)value);
System.out.println("Amount value: " + getAmount());
return false;
if (id.toString().equalsIgnoreCase("TRANSACTIONTYPE")) {
this.setTransactionType((String)value);
System.out.println("Transaction Type value: " + this.getTransactionType());
return false;
if (id.toString().equalsIgnoreCase("EXECUTE")) {
System.out.println("Invoke pos terminal");
try
doTransaction();
catch(Exception ex)
System.err.println("Execute Exception>> " + ex.toString());
this.showError(res.getProperty("s_dlg_err_title"),res.getProperty("s_gen_exception"));
return false;
return false;
     * Display error message inside oracle form
     * @param title
     * @param exceptionString
     private void showError(String title, String exceptionString) {
          JOptionPane.showMessageDialog(this, exceptionString, title, 0);
Edited by: peterv6i.blogspot.com on May 8, 2012 10:18 AM
Edited by: peterv6i.blogspot.com on May 8, 2012 10:20 AM
Edited by: peterv6i.blogspot.com on May 8, 2012 10:21 AM

Similar Messages

  • Reading Data from serial (Comm) Port in developer200 forms 6i

    Dears,
    I have developed an application using Dev2k forms 6i.
    I need to read data from a device (weigh bridge) that is attached to PC on comm port.
    scenario: when a vehicle comes on the Weigh bridge it calculates its weight and send it to the PC on serial port.
    on when-button-pressed event I want to get data into a text field on form.
    If any one has developed such form please help me.
    Thanks and regards

    you can:
    create java class -> wrap plsql -> invoke plsql-code from button trigger
    googling java class instead of creating =)

  • How do I get a PDF document put into an attachment form that I can drag to an e-mail.  Usually I get an icon showing an spiral note book which then becomes an attachment when I drag it to the e-mail, but occasionally it stays in PDF and prints out on the

    How do I get a PDF document put into an attachment form that I can drag to an e-mail.  Usually I get an icon showing an spiral note book which then becomes an attachment when I drag it to the e-mail, but occasionally it stays in PDF and prints out on the e-mail.  What have I done differently?

    Thanks again for the detailed instructions Srini!
    And I really hate to be a pest . . . but . . .
    Using your example and not modifying it, I get the e-mail form filled out correctly and the pdf attached, however, I'm not prompted to sign it.
    Any more clues?

  • Want attach the XML data file with layout template in Oracle 10g

    Hi All,
    I need a help from you genius guys.
    I am genrating reports in BI with xml the procedure which I am following is as below.
    1. generating XML from the RDF
    2. creating a template in .rtf format
    3.after that loading the xml to the template then getting the required report.
    This all is doing through the given buttons
    But now my requirement is to create the gui from user can select the report and get the desire output file so how we would be able to attach the XML data file with layout template in Oracle 10g.
    If you require more detail please let me knnow.
    Thanks,
    Harry

    I am not using Oracle apps.
    I am using oracle 10g reports and I get something in it like one patch I downloded and one java code is having which creates the batch file ...still I am working on it ..
    If you will get some please share so that it will be helpful.
    Thanks,
    Harry

  • Associating a comm port with a TS test socket

    Hello,
    In order to run several test platforms on one machine (parallel model), I must be able to associate each test socket with a unique serial port. Each hardware platform has it's own serial connection which is built in Labview. So my question is, "how can I use a single test sequence calling LV VIs where each test socket must use a different comm port?"
    Thank you for helping,
    Adam

    How dynamic is the com port configurations? Will some testers only differ in the number of ports? If that's the case, then you'll also need to dynamically change how many sockets you're testing. This could be done, probably in a sequence file load callback and with the LabVIEW function VISA Find Resource. Searching for all ASRL resources will return a count and their names. You could populate a station global string array with the names. Right now, I have a fixed count of resources so I just populate a main sequence local variable with all of the possible names. I assign the resource name for the VI as Locals.VISAResource and in a pre-expression for the VI, Locals.VISAResource = Locals.AllVISAResources[RunState.TestSockets.MyIndex]

  • How to attach Form to Transaction Code F-92

    Dear All,
    I have a reuirement from my client, where in they need Printout for Transaction Code f-92, I want to know how to attach Form to the Transaction Code or is there any standard Form availabale in the system.
    Thanks in advance
    Dnyanesh Shenwai

    Hi
    The user menu is the set of menu of all roles of user, so you should check the roles of the user and update one of menu of user roles.
    You can do it by transactions PFGC, but if you change a role you'll change the menu of all users have that role.
    This operation usually is made by the administrators of system.
    Max
    Message was edited by: max bianchi

  • Trouble attaching form in Workbench

    Hello-
    I have a process which creates form A dynamically and emails it. After emailing the for I need to generate Form B and attach Form A. I can generate Form B fine, it's the attaching that is giving me rouble.
    Is this possible?
    Thanks.

    Try Assembler service to attached documents to a PDF file.
    Nith

  • 500 InternalServerError when calling app with same url than oracle app

    Hello
    i wonder if some one could help us.
    we are running an application on oas developed with forms 10g on a specific IP say
    ip 10.10.10:9999 and this application is calling other application (a jsp) on another server
    and to call it i use:
    Web.show_document (http://10.10.10:9080 ,'_blank');
    but that other application is on the same ip than the oracle application
    when this hapens the listener try to connect itself 5 time then it just
    give the 500 InternalServerError .
    any idea why this is happening
    i will realy apreciated your help
    many thanks in advance
    Ana
    ps:
    i forgot to say that when i use the following command :
         webutil_Host.host('cmd /C START iexplore "'||v_url||'"');
    it works
    i think that is because is a new sesion???
    Edited by: ana.gutierrez on 19-feb-2009 4:27

    Hola Roberto
    many thank for your answer.
    the oracle aplication is developed in Forms [32 bits] Versión 10.1.2.3.0 (Producción)
    the server is
    10g Release 2 (10.1.2) Patch Set 3 (10.1.2.3.0) for Solaris Operating System
    the jsp is in a was server it is version 6 the java aplication is developes using jdk 1.4 but is running on a jre 1.6.0_11
    bouth applications have the same ip differt ports
    when oracle app calls the java app use the
    http://999.999.999.9/dir/dir.do?parameters.....
    the port is not especified but is different
    when the java application calls the oracle aplication the url is something like
    http://999.999.999.9:8888/forms/frmservlet?config=oracle_aplication&otherparams=
    if the urls are call directily from a browser they work fine.
    has it got something to do with the configuration of the single sing on ??
    any help or idea will be very apreciated
    many many thanks
    ANa

  • Adding a parameter with comma separated having different values

    i want to add a parameter with comma separated having different values of a column. e.g i have column having values from 10000 to 99999. i want to create report for the selected values of 11111,12111,131111 etc. This selection can be one or more values as desired. Second problem is restricting the records as per parameter.

    Reports doesn't allow multi-selection of a parameter in its parameter form. You need to use Oracle*Forms or an HTML Form to front end more advanced parameter form options.
    However, you could have multiple parameters and combine their selections into a single parameter in the after parameter form trigger. This would at least allow you to give the user the option for selecting up to 'n' parameters. The single parameter would have to be of type "character" and you probably want to add appropriate quotes around the values in the after parameter form trigger.
    Second problem is restricting the records as per parameter. Once you've got the comma seperated values into a single parameter (say p_myValues with a default value of '') then you can just use a lexical parameter to restrict the values as in:
    select * from emp
    where to_char(empno) in (&p_myValues)

  • How to protect password with pdf file in oracle database

    hiiii,,,,i have a form in 6i where i am sending pdf file(by running report) to the other clients in the network,,now my requirement is that i want to protect a password with this pdf file whenevr i run new report ,,wat should i do..
    plz help
    lovely sethi

    [email protected] wrote:
    hiiii,,,,i have a form in 6i where i am sending pdf file(by running report) to the
    other clients in the network,,now my requirement is that i want to protect a
    password with this pdf file whenevr i run new report ,,wat should i do..Why not just rely on OS security withing the server? If you email it to a
    particular individual, then it's protected as far as you trust that individual
    anyway!
    Those who are in the dba group on the server can get at the data
    in any case.
    I just don't see the point in trying to do what you're asking - unless
    I've missed something?
    BTW, you haven't mentioned OS or db version (see .sig).
    Paul...
    lovely sethi--
    When asking database related questions, please give other posters
    some clues, like OS (with version), version of Oracle being used and DDL.
    Other trivia such as CPU, RAM + Disk configuration might also be useful.
    The exact text and/or number of error messages is useful (!= "it didn't work!"). Thanks.
    Furthermore, as a courtesy to those who spend time analysing and attempting to help,
    please do not top post and do try to trim your replies!

  • Separating number in inputext with comma

    hi all
    I need to separate numbers with comma without using Enter .
    I have an input text and used an clientListner on it : code is bellow
      <f:view>
        <af:document id="d1">  
         <af:resource type="javascript" source="/js/accounting.js"/>
         <af:resource type="javascript" source="/js/functions.js"/>
         <!--<af:resource type="javascript" source="/js/accounting.min.js"/>-->
          <af:form id="f1">
    <af:panelGroupLayout id="pgl1">
    <af:inputText label="Label 1" id="it1">
    <af:clientListener method="formatNum" type="keyUp"/>
    </af:inputText>
            </af:panelGroupLayout>
          </af:form>
        </af:document>
      </f:view>
    I run this JavaScript on HTML page that is OK and my input text show separated number during entering ,
    but I run my above jspx page ,it does not show until press the Enter key ...
    please guide me .... I have an emergency condition please answer me soon
    and then use this function for handling...
    function.js :
    function formatNum(evt) {
        var inputfield = evt.getSource();
        var num = accounting.unformat(inputfield.getValue());
        var formatNum = accounting.formatNumber(num);
        inputfield.setValue(formatNum);
        return true;
    accounting.js
    * accounting.js v0.3.2
    * Copyright 2011, Joss Crowcroft
    * Freely distributable under the MIT license.
    * Portions of accounting.js are inspired or borrowed from underscore.js
    * Full details and documentation:
    * http://josscrowcroft.github.com/accounting.js/
    (function(root, undefined) {
    /* --- Setup --- */
    // Create the local library object, to be exported or referenced globally later
    var lib = {};
    // Current version
    lib.version = '0.3.2';
    /* --- Exposed settings --- */
    // The library's settings configuration object. Contains default parameters for
    // currency and number formatting
    lib.settings = {
    currency: {
    symbol : "$", // default currency symbol is '$'
    format : "%s%v", // controls output: %s = symbol, %v = value (can be object, see docs)
    decimal : ".", // decimal point separator
    thousand : ",", // thousands separator
    precision : 2, // decimal places
    grouping : 3 // digit grouping (not implemented yet)
    number: {
    precision : 0, // default precision on numbers is 0
    grouping : 3, // digit grouping (not implemented yet)
    thousand : ",",
    decimal : "."
    /* --- Internal Helper Methods --- */
    // Store reference to possibly-available ECMAScript 5 methods for later
    var nativeMap = Array.prototype.map,
    nativeIsArray = Array.isArray,
    toString = Object.prototype.toString;
    * Tests whether supplied parameter is a string
    * from underscore.js
    function isString(obj) {
    return !!(obj === '' || (obj && obj.charCodeAt && obj.substr));
    * Tests whether supplied parameter is a string
    * from underscore.js, delegates to ECMA5's native Array.isArray
    function isArray(obj) {
    return nativeIsArray ? nativeIsArray(obj) : toString.call(obj) === '[object Array]';
    * Tests whether supplied parameter is a true object
    function isObject(obj) {
    return obj && toString.call(obj) === '[object Object]';
    * Extends an object with a defaults object, similar to underscore's _.defaults
    * Used for abstracting parameter handling from API methods
    function defaults(object, defs) {
    var key;
    object = object || {};
    defs = defs || {};
    // Iterate over object non-prototype properties:
    for (key in defs) {
    if (defs.hasOwnProperty(key)) {
    // Replace values with defaults only if undefined (allow empty/zero values):
    if (object[key] == null) object[key] = defs[key];
    return object;
    * Implementation of `Array.map()` for iteration loops
    * Returns a new Array as a result of calling `iterator` on each array value.
    * Defers to native Array.map if available
    function map(obj, iterator, context) {
    var results = [], i, j;
    if (!obj) return results;
    // Use native .map method if it exists:
    if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
    // Fallback for native .map:
    for (i = 0, j = obj.length; i < j; i++ ) {
    results[i] = iterator.call(context, obj[i], i, obj);
    return results;
    * Check and normalise the value of precision (must be positive integer)
    function checkPrecision(val, base) {
    val = Math.round(Math.abs(val));
    return isNaN(val)? base : val;
    * Parses a format string or object and returns format obj for use in rendering
    * `format` is either a string with the default (positive) format, or object
    * containing `pos` (required), `neg` and `zero` values (or a function returning
    * either a string or object)
    * Either string or format.pos must contain "%v" (value) to be valid
    function checkCurrencyFormat(format) {
    var defaults = lib.settings.currency.format;
    // Allow function as format parameter (should return string or object):
    if ( typeof format === "function" ) format = format();
    // Format can be a string, in which case `value` ("%v") must be present:
    if ( isString( format ) && format.match("%v") ) {
    // Create and return positive, negative and zero formats:
    return {
    pos : format,
    neg : format.replace("-", "").replace("%v", "-%v"),
    zero : format
    // If no format, or object is missing valid positive value, use defaults:
    } else if ( !format || !format.pos || !format.pos.match("%v") ) {
    // If defaults is a string, casts it to an object for faster checking next time:
    return ( !isString( defaults ) ) ? defaults : lib.settings.currency.format = {
    pos : defaults,
    neg : defaults.replace("%v", "-%v"),
    zero : defaults
    // Otherwise, assume format was fine:
    return format;
    /* --- API Methods --- */
    * Takes a string/array of strings, removes all formatting/cruft and returns the raw float value
    * alias: accounting.`parse(string)`
    * Decimal must be included in the regular expression to match floats (defaults to
    * accounting.settings.number.decimal), so if the number uses a non-standard decimal
    * separator, provide it as the second argument.
    * Also matches bracketed negatives (eg. "$ (1.99)" => -1.99)
    * Doesn't throw any errors (`NaN`s become 0) but this may change in future
    var unformat = lib.unformat = lib.parse = function(value, decimal) {
    // Recursively unformat arrays:
    if (isArray(value)) {
    return map(value, function(val) {
    return unformat(val, decimal);
    // Fails silently (need decent errors):
    value = value || 0;
    // Return the value as-is if it's already a number:
    if (typeof value === "number") return value;
    // Default decimal point comes from settings, but could be set to eg. "," in opts:
    decimal = decimal || lib.settings.number.decimal;
    // Build regex to strip out everything except digits, decimal point and minus sign:
    var regex = new RegExp("[^0-9-" + decimal + "]", ["g"]),
    unformatted = parseFloat(
    ("" + value)
    .replace(/\((.*)\)/, "-$1") // replace bracketed values with negatives
    .replace(regex, '')         // strip out any cruft
    .replace(decimal, '.')      // make sure decimal point is standard
    // This will fail silently which may cause trouble, let's wait and see:
    return !isNaN(unformatted) ? unformatted : 0;
    * Implementation of toFixed() that treats floats more like decimals
    * Fixes binary rounding issues (eg. (0.615).toFixed(2) === "0.61") that present
    * problems for accounting- and finance-related software.
    var toFixed = lib.toFixed = function(value, precision) {
    precision = checkPrecision(precision, lib.settings.number.precision);
    var power = Math.pow(10, precision);
    // Multiply up by precision, round accurately, then divide and use native toFixed():
    return (Math.round(lib.unformat(value) * power) / power).toFixed(precision);
    * Format a number, with comma-separated thousands and custom precision/decimal places
    * Localise by overriding the precision and thousand / decimal separators
    * 2nd parameter `precision` can be an object matching `settings.number`
    var formatNumber = lib.formatNumber = function(number, precision, thousand, decimal) {
      // Resursively format arrays:
    if (isArray(number)) {
    return map(number, function(val) {
    return formatNumber(val, precision, thousand, decimal);
    // Clean up number:
    number = unformat(number);
    // Build options object from second param (if object) or all params, extending defaults:
    var opts = defaults(
    (isObject(precision) ? precision : {
    precision : precision,
    thousand : thousand,
    decimal : decimal
    lib.settings.number
    // Clean up precision
    usePrecision = checkPrecision(opts.precision),
    // Do some calc:
    negative = number < 0 ? "-" : "",
    base = parseInt(toFixed(Math.abs(number || 0), usePrecision), 10) + "",
    mod = base.length > 3 ? base.length % 3 : 0;
    // Format the number:
    return negative + (mod ? base.substr(0, mod) + opts.thousand : "") + base.substr(mod).replace(/(\d{3})(?=\d)/g, "$1" + opts.thousand) + (usePrecision ? opts.decimal + toFixed(Math.abs(number), usePrecision).split('.')[1] : "");
    * Format a number into currency
    * Usage: accounting.formatMoney(number, symbol, precision, thousandsSep, decimalSep, format)
    * defaults: (0, "$", 2, ",", ".", "%s%v")
    * Localise by overriding the symbol, precision, thousand / decimal separators and format
    * Second param can be an object matching `settings.currency` which is the easiest way.
    * To do: tidy up the parameters
    var formatMoney = lib.formatMoney = function(number, symbol, precision, thousand, decimal, format) {
    // Resursively format arrays:
    if (isArray(number)) {
    return map(number, function(val){
    return formatMoney(val, symbol, precision, thousand, decimal, format);
    // Clean up number:
    number = unformat(number);
    // Build options object from second param (if object) or all params, extending defaults:
    var opts = defaults(
    (isObject(symbol) ? symbol : {
    symbol : symbol,
    precision : precision,
    thousand : thousand,
    decimal : decimal,
    format : format
    lib.settings.currency
    // Check format (returns object with pos, neg and zero):
    formats = checkCurrencyFormat(opts.format),
    // Choose which format to use for this value:
    useFormat = number > 0 ? formats.pos : number < 0 ? formats.neg : formats.zero;
    // Return with currency symbol added:
    return useFormat.replace('%s', opts.symbol).replace('%v', formatNumber(Math.abs(number), checkPrecision(opts.precision), opts.thousand, opts.decimal));
    * Format a list of numbers into an accounting column, padding with whitespace
    * to line up currency symbols, thousand separators and decimals places
    * List should be an array of numbers
    * Second parameter can be an object containing keys that match the params
    * Returns array of accouting-formatted number strings of same length
    * NB: `white-space:pre` CSS rule is required on the list container to prevent
    * browsers from collapsing the whitespace in the output strings.
    lib.formatColumn = function(list, symbol, precision, thousand, decimal, format) {
    if (!list) return [];
    // Build options object from second param (if object) or all params, extending defaults:
    var opts = defaults(
    (isObject(symbol) ? symbol : {
    symbol : symbol,
    precision : precision,
    thousand : thousand,
    decimal : decimal,
    format : format
    lib.settings.currency
    // Check format (returns object with pos, neg and zero), only need pos for now:
    formats = checkCurrencyFormat(opts.format),
    // Whether to pad at start of string or after currency symbol:
    padAfterSymbol = formats.pos.indexOf("%s") < formats.pos.indexOf("%v") ? true : false,
    // Store value for the length of the longest string in the column:
    maxLength = 0,
    // Format the list according to options, store the length of the longest string:
    formatted = map(list, function(val, i) {
    if (isArray(val)) {
    // Recursively format columns if list is a multi-dimensional array:
    return lib.formatColumn(val, opts);
    } else {
    // Clean up the value
    val = unformat(val);
    // Choose which format to use for this value (pos, neg or zero):
    var useFormat = val > 0 ? formats.pos : val < 0 ? formats.neg : formats.zero,
    // Format this value, push into formatted list and save the length:
    fVal = useFormat.replace('%s', opts.symbol).replace('%v', formatNumber(Math.abs(val), checkPrecision(opts.precision), opts.thousand, opts.decimal));
    if (fVal.length > maxLength) maxLength = fVal.length;
    return fVal;
    // Pad each number in the list and send back the column of numbers:
    return map(formatted, function(val, i) {
    // Only if this is a string (not a nested array, which would have already been padded):
    if (isString(val) && val.length < maxLength) {
    // Depending on symbol position, pad after symbol or at index 0:
    return padAfterSymbol ? val.replace(opts.symbol, opts.symbol+(new Array(maxLength - val.length + 1).join(" "))) : (new Array(maxLength - val.length + 1).join(" ")) + val;
    return val;
    /* --- Module Definition --- */
    // Export accounting for CommonJS. If being loaded as an AMD module, define it as such.
    // Otherwise, just add `accounting` to the global object
    if (typeof exports !== 'undefined') {
    if (typeof module !== 'undefined' && module.exports) {
    exports = module.exports = lib;
    exports.accounting = lib;
    } else if (typeof define === 'function' && define.amd) {
    // Return the library as an AMD module:
    define([], function() {
    return lib;
    } else {
    // Use accounting.noConflict to restore `accounting` back to its original value.
    // Returns a reference to the library's `accounting` object;
    // e.g. `var numbers = accounting.noConflict();`
    lib.noConflict = (function(oldAccounting) {
    return function() {
    // Reset the value of the root's `accounting` variable:
    root.accounting = oldAccounting;
    // Delete the noConflict method:
    lib.noConflict = undefined;
    // Return reference to the library to re-assign it:
    return lib;
    })(root.accounting);
    // Declare `fx` on the root (global/window) object:
    root['accounting'] = lib;
    // Root will be `window` in browser or `global` on the server:
    }(this));

    hi all
    I have an input text that I want to separate it's value with comma
    this is my input text :
    <af:inputText value="#{bindings.LacreditAmt.inputValue}"
    label="#{bindings.LacreditAmt.hints.label}"
    required="#{bindings.LacreditAmt.hints.mandatory}"
    columns="#{bindings.LacreditAmt.hints.displayWidth}"
    shortDesc="#{bindings.LacreditAmt.hints.tooltip}"
    id="it8"
    maximumLength="#{bindings.LacreditAmt.hints.precision}"
    converter="converter.BIGDECIMALMONEYCONVERTER"
    clientComponent="true">
    <f:validator binding="#{bindings.LacreditAmt.validator}"/>
    <!--<af:convertNumber groupingUsed="false"
    pattern="#{bindings.LacreditAmt.format}"/>-->
    <af:clientListener method="handleNumberFormatConversion" type="keyUp"/>
    </af:inputText>
    and use this  java Script for comma separated value :
    problem is : when I used firebug for testing this java Script ,everything is OK and 'result' variable shown
    the correct value (comma separated value) but in fact the correct value did not show
    in input text  !!!!!
    please guide me soon.
    I appreciated in advance
    function handleNumberFormatConversion(evt){
            var inputField = evt.getCurrentTarget();
            var keyPressed = evt.getKeyCode();
            var oldValue = inputField.getSubmittedValue();
            var validKeys = new Array(48,49,50,51,52,53,54,55, 56,57,96,97,98,99,100, 101,102,103,104,105,AdfKeyStroke.ARROWRIGHT_KEY, AdfKeyStroke.ARROWLEFT_KEY, AdfKeyStroke.BACKSPACE_KEY, AdfKeyStroke.DELETE_KEY, AdfKeyStroke.END_KEY, AdfKeyStroke.ESC_KEY, AdfKeyStroke.TAB_KEY);
            var numberKeys = new Array(48,49,50,51,52,53,54,55, 56,57,96,97,98,99,100, 101,102,103,104,105, AdfKeyStroke.BACKSPACE_KEY, AdfKeyStroke.DELETE_KEY);
            var isValidKey = false;
            for (var i=0; i < validKeys.length; ++i){
                if (validKeys[i] == keyPressed) {
                    isValidKey = true;
                    break;
            if(isValidKey){
                    var isNumberKey = false;
                for (var n=0; n < numberKeys.length; ++n){
                    if(numberKeys[n] == keyPressed){
                        isNumberKey = true;
                        break;
                if(isNumberKey){
                    var formatLength = 25;
                    if(formatLength == oldValue.length){
                        inputField.setValue(oldValue);
                        evt.cancel();
                    else {
                        var firstNeg = false;
                        var lastNeg = false;
                        if (oldValue.charAt(0) == '(')
                            firstNeg = true;
                        if(oldValue.contains(')')){
                          lastNeg = true;                              
                        oldValue = oldValue.replace('(', "");
                        oldValue = oldValue.replace(')', "");
                        var result = "";
                        while (oldValue.contains(",")) {
                            oldValue = oldValue.replace(",", "");
                        for (i = oldValue.length - 3;i > 0;i -= 3) {
                            result = ",".concat(oldValue.substring(i, i + 3), result);
                        result = oldValue.substring(0, (oldValue.length % 3 == 0) ? 3 : oldValue.length % 3).concat(result);
                        if (firstNeg)
                            result = '(' + result;
                        if (lastNeg) {
                            result = result + ')';
                        inputField.setValue(result);
                        evt.cancel();
                        return true;                   
            else {
                inputField.setValue(oldValue);
                evt.cancel();

  • Unable to Load CSV file with comma inside the column(Sql Server 2008)

    Hi,
    I am not able load an CSV file with Comma inside a column. 
    Here is sample File:(First row contain the column names)
    _id,qp,c
    "1","[ ""0"", ""0"", ""0"" ]","helloworld"
    "1","[ ""0"", ""0"", ""0"" ]","helloworld"
    When i specify the Text Qualifier as "(Double quotes) it work in SQL Server 2012, where as fail in the SQL Server 2008, complaining with error:
    TITLE: Microsoft Visual Studio
    The preview sample contains embedded text qualifiers ("). The flat file parser does not support embedding text qualifiers in data. Parsing columns that contain data with text qualifiers will fail at run time.
    BUTTONS:
    OK
    I need to do this in sql server 2008 R2 with Service pack 2, my build version is 10.50.1600.1.
    Can someone let me know it is possible in do the same way it is handle in SQL Server 2012?
    Or
    It got resolved in any successive Cumulative update after 10.50.1600.1?
    Regards Harsh

    Hello,
    If you have CSV with double quotes inside double quotes and with SSIS 2008, I suggest:
    in your data flow you use a script transformation component as Source, then define the ouput columns id signed int, Gp unicode string and C unicode string. e.g. Ouput 0 output colmuns
    Id - four-byte signed
    gp - unicode string
    cc - unicode string
    Do not use a flat file connection, but use a user variable in which you store the name of the flat file (this could be inside a for each file loop).
    The user variable is supplied as a a readonly variable argument to the script component in your dataflow.
    In the script component inMain.CreateNewOutputRows use a System.IO.Streamreader with the user variable name to read the file and use the outputbuffer addrow method to add each line to the output of the script component.
    Between the ReadLine instraction and the addrow instruction you have to add your code to extract the 3 column values.
    public override void CreateNewOutputRows()
    Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".
    For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".
    string line;
    System.IO.StreamReader file = new System.IO.StreamReader( Variables.CsvFilename);
    while ((line = file.ReadLine()) != null)
    System.Windows.Forms.MessageBox.Show(line);
    if (line.StartsWith("_id,qp,c") != true) //skip header line
    Output0Buffer.AddRow();
    string[] mydata = Yourlineconversionher(line);
    Output0Buffer.Id = Convert.ToInt32(mydata[0]);
    Output0Buffer.gp = mydata[1];
    Output0Buffer.cc = mydata[2];
    file.Close();
    Jan D'Hondt - SQL server BI development

  • Identifying a comm port using java communication API

    HI ALL,
    i'm using the communication API to detect the comm port to which my modem is attached.
    i say CommPortIdentifier c = CommPortIdentifier.getPortIdentifier("COM3");
    then i SOP(c.getName())
    i get an exception saying noSuchPortException
    i've put the javax.comm.properties file in jdk/lib but to no avail.
    i also have a win32com.dll file that is there inside lib.
    but this hasn't helped. Now the properties file has a driver mentioned. do i have 2 download that driver or does it come with the OS (i've no idea)
    i would be helpful if anybody could help me out with this problem.

    Try putting tha javax.comm.properties file in you <java>/jre/lib folder as well... It worked for me !

  • Accessing RS232 Port (Comm Port) from Applet

    I have an interesting "problem". I would like to create an applet that allows me to read the Comm port of the client machine but obviously I get a security exception when I try to do this. Firstly is this possible (I know it can be done from an application)? If so, how would I go about doing it?
    Thanks,
    Rishi

    you need to install the jre, and place the win32.dll at JavaSoft\JRE\1.3.1_06\bin, that properties file place at JavaSoft\JRE\1.3.1_06\lib, comm.jar at JavaSoft\JRE\1.3.1_06\lib\ext\
    and in ur code try to use it to open ur com port
    public String test() {
              String drivername = "com.sun.comm.Win32Driver";
              try
                   CommDriver driver = (CommDriver) Class.forName(drivername).newInstance(); driver.initialize();
              catch (Throwable th)
                   {* Discard it */}
              drivername = "javax.comm.*";
              try
                   CommDriver driver = (CommDriver) Class.forName(drivername).newInstance(); driver.initialize();
              catch (Throwable th)
                   {* Discard it */}
    portList = CommPortIdentifier.getPortIdentifiers();
    while (portList.hasMoreElements()) {
    portId = (CommPortIdentifier) portList.nextElement();
    if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
    if (portId.getName().equals("COM2")) {
    //if (portId.getName().equals("/dev/term/a")) {
    try {
    serialPort = (SerialPort)
    portId.open("SimpleWriteApp", 2000);
    } catch (PortInUseException e) {}
    try {
    outputStream = serialPort.getOutputStream();
    } catch (IOException e) {}
    try {
    serialPort.setSerialPortParams(9600,
    SerialPort.DATABITS_8,
    SerialPort.STOPBITS_1,
    SerialPort.PARITY_NONE);
    } catch (UnsupportedCommOperationException e) {}
                             int i=0;
                             while(true)
         try {
                                       messageString="hi";
                                       System.out.println(i++);
         outputStream.write(messageString.getBytes());
         } catch (IOException e)
                                       System.out.println(e);
                                       messageString=String.valueOf(e);
              return messageString;
    and yet u need to signed the applet
    1.     Compile the applet
    2.     Create a JAR file
    3.     Generate Keys
    4.     Sign the JAR file
    5.     Export the Public Key Certificate
    6.     Import the Certificate as a Trusted Certificate
    7.     Create the policy file
    8.     Run the applet
    Susan
    Susan bundles the applet executable in a JAR file, signs the JAR file, and exports the public key certificate.
    1.     Compile the Applet
    In her working directory, Susan uses the javac command to compile the SignedAppletDemo.java class. The output from the javac command is the SignedAppletDemo.class.
    javac SignedAppletDemo.java
    2.     Make a JAR File
    Susan then makes the compiled SignedAppletDemo.class file into a JAR file. The -cvf option to the jar command creates a new archive (c), using verbose mode (v), and specifies the archive file name (f). The archive file name is SignedApplet.jar.
    jar cvf SignedApplet.jar SignedAppletDemo.class
    3.     Generate Keys
    Susan creates a keystore database named susanstore that has an entry for a newly generated public and private key pair with the public key in a certificate. A JAR file is signed with the private key of the creator of the JAR file and the signature is verified by the recipient of the JAR file with the public key in the pair. The certificate is a statement from the owner of the private key that the public key in the pair has a particular value so the person using the public key can be assured the public key is authentic. Public and private keys must already exist in the keystore database before jarsigner can be used to sign or verify the signature on a JAR file.
    In her working directory, Susan creates a keystore database and generates the keys:
    keytool -genkey -alias signFiles -keystore susanstore -keypass kpi135 -dname "cn=jones" -storepass ab987c
    This keytool -genkey command invocation generates a key pair that is identified by the alias signFiles. Subsequent keytool command invocations use this alias and the key password (-keypass kpi135) to access the private key in the generated pair.
    The generated key pair is stored in a keystore database called susanstore (-keystore susanstore) in the current directory, and accessed with the susanstore password (-storepass ab987c).
    The -dname "cn=jones" option specifies an X.500 Distinguished Name with a commonName (cn) value. X.500 Distinguished Names identify entities for X.509 certificates.
    You can view all keytool options and parameters by typing:
    keytool -help
    4.     Sign the JAR File
    JAR Signer is a command line tool for signing and verifying the signature on JAR files. In her working directory, Susan uses jarsigner to make a signed copy of the SignedApplet.jar file.
    jarsigner -keystore susanstore -storepass ab987c -keypass kpi135 -signedjar SSignedApplet.jar SignedApplet.jar signFiles
    The -storepass ab987c and -keystore susanstore options specify the keystore database and password where the private key for signing the JAR file is stored. The -keypass kpi135 option is the password to the private key, SSignedApplet.jar is the name of the signed JAR file, and signFiles is the alias to the private key. jarsigner extracts the certificate from the keystore whose entry is signFiles and attaches it to the generated signature of the signed JAR file.
    5.     Export the Public Key Certificate
    The public key certificate is sent with the JAR file to the whoever is going to use the applet. That person uses the certificate to authenticate the signature on the JAR file. To send a certificate, you have to first export it.
    The -storepass ab987c and -keystore susanstore options specify the keystore database and password where the private key for signing the JAR file is stored. The -keypass kpi135 option is the password to the private key, SSignedApplet.jar is the name of the signed JAR file, and signFiles is the alias to the private key. jarsigner extracts the certificate from the keystore whose entry is signFiles and attaches it to the generated signature of the signed JAR file.
    5: Export the Public Key Certificate
    The public key certificate is sent with the JAR file to the whoever is going to use the applet. That person uses the certificate to authenticate the signature on the JAR file. To send a certificate, you have to first export it.
    In her working directory, Susan uses keytool to copy the certificate from susanstore to a file named SusanJones.cer as follows:
    keytool -export -keystore susanstore -storepass ab987c -alias signFiles -file SusanJones.cer
    Ray
    Ray receives the JAR file from Susan, imports the certificate, creates a policy file granting the applet access, and runs the applet.
    6.     Import Certificate as a Trusted Certificate
    Ray has received SSignedApplet.jar and SusanJones.cer from Susan. He puts them in his home directory. Ray must now create a keystore database (raystore) and import the certificate into it. Ray uses keytool in his home directory /home/ray to import the certificate:
    keytool -import -alias susan -file SusanJones.cer -keystore raystore -storepass abcdefgh
    7.     Create the Policy File
    The policy file grants the SSignedApplet.jar file signed by the alias susan permission to create newfile (and no other file) in the user's home directory.
    Ray creates the policy file in his home directory using either policytool or an ASCII editor.
    keystore "/home/ray/raystore";
    // A sample policy file that lets a JavaTM program
    // create newfile in user's home directory
    // Satya N Dodda
    grant SignedBy "susan"
         permission java.security.AllPermission;
    8.     Run the Applet in Applet Viewer
    Applet Viewer connects to the HTML documents and resources specified in the call to appletviewer, and displays the applet in its own window. To run the example, Ray copies the signed JAR file and HTML file to /home/aURL/public_html and invokes Applet viewer from his home directory as follows:
    Html code :
    </body>
    </html>
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    width="600" height="400" align="middle"
    codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,1,2">
    <PARAM NAME="code" VALUE="SignedAppletDemo.class">
    <PARAM NAME="archive" VALUE="SSignedApplet.jar">
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
    </OBJECT>
    </body>
    </html>
    appletviewer -J-Djava.security.policy=Write.jp
    http://aURL.com/SignedApplet.html
    Note: Type everything on one line and put a space after Write.jp
    The -J-Djava.security.policy=Write.jp option tells Applet Viewer to run the applet referenced in the SignedApplet.html file with the Write.jp policy file.
    Note: The Policy file can be stored on a server and specified in the appletviewer invocation as a URL.
    9.     Run the Applet in Browser
    Download JRE 1.3 from Javasoft
    good luck! [email protected]
    i already give u many tips, i use 2 weeks to try this to success, hopw that u understand that, a result of success is not important, the process of how to get things done is most usefull!

  • CF10 is evaluating strings with comma's as complex types (Array), formerly they were just Strings

    Coldfusion 10's behaviour appears to have changed in the evaluation of strings with commas.
    Example:
    FORM.IDS = 123456, 654321, 789101  (Form Submission)
    <cfset fieldname="IDS" />
    <cfset test1 = FORM[fieldname] />
    <cfset test2 = evalute("FORM.#fieldname#") />
    In Coldfusion 9 the value of test1 and test2 is reported as "123456, 654321, 789101".
    In Coldfusion 10 the value of test1 and test2 is reported as an array. "Array (3)".
    Is this expected behaviour?  This is jacking up an application we are trying to upgrade and did not expect this one.  Any help will be much appreciated.
    Cheers
    Lee 

    ldavis101 wrote:
    Coldfusion 10's behaviour appears to have changed in the evaluation of strings with commas.
    Example:
    FORM.IDS = 123456, 654321, 789101  (Form Submission)
    <cfset fieldname="IDS" />
    <cfset test1 = FORM[fieldname] />
    <cfset test2 = evaluate("FORM.#fieldname#") /> [BKBK: typo corrected]
    In Coldfusion 9 the value of test1 and test2 is reported as "123456, 654321, 789101".
    In Coldfusion 10 the value of test1 and test2 is reported as an array. "Array (3)".
    Is this expected behaviour? 
    No, that is unexpected. Please report it as a bug.

Maybe you are looking for

  • CG output - 720p or 1080i

    I am working in computer graphics, so I am rendering a sequence of images to be edited in FCE HD. 30fps, going to digital tape for projection on theatre screens. I've determined that hd video will be fine. Now I need to determine which type, 720p or

  • Add extra field to RFUMSV00

    Hi, I'm struggling with programming RFUMSV00.I have to extend this program with one extra field (BSEG-EGBLD).So I made a Z-copy of the original.But this program is working with a logical database.Program is using two field-groups : header and daten.F

  • Sidecar.xml first generation

    Johannes granted us with the excellent : http://projects.nordsueddesign.de/sidecarxml/ so that we can organize and easily manipulate elements of a large publication. The thing is it requires a "first time generation" which seems to have to be done ma

  • Refreshing a jtree(jdeveloper)

    if the tree is expanded then how can it be collapsed on a button's click event and if we have a value equivalent to a particular node of jtree then how we can expand the tree upto that level i m using jdeveloper and i have to display the in expanded

  • Overprint stroke not working right.

    We are in a production environment and have to trap files all the time.  Normally it's not an issue but I've noticed my staff are having problems with overprinting colors.  I don't know if this is a document setting or preferences problem, or somethi