1 2 Previous Next 19 Replies Latest reply: Nov 26, 2010 3:19 AM by 638491 RSS

    Getting Data from Serial RS232 Port  through Custom Form

    acarsel
      Hi;
      We want to design a form for our project to read the weight data from RS-232 port to display the weight data for client machines(Forms 10g). I searched all forums; there are solution ways for 6g ; but we could not figured it out for 10g. We think about using Java; to read data from RS-232 but it seemed too complicated to us.

      All we want to do is see the weight solution at form field when we push a button; but we don't want to do extra operations in client machines. We are unable to perform this functionality in Oracle.
      So i was checking if any such functionality is available for us to get value from external port.
      Please guide me to arrive that functionality with any of available Library files in Oracle or any other Work around ,if any.
        • 1. Re: Getting Data from Serial RS232 Port  through Custom Form
          Michael Ferrante-Oracle
          You will need to create a java bean. There are examples on the Internet (Google). There are also third party companies who sell such code.

          Here is some info which may help get you started:

          http://www.oracle.com/webapps/online-help/forms/10g/topics/enhancedjavabean/enjbs_enhancedjavabeansupp.html

          http://java.sun.com/products/javacomm/

          http://forms.pjc.bean.over-blog.com/

          Forms WebUtil may also offer some help. WebUtil is nothing more than a set of Java Beans so even if it does not offer a direct help, it will provide examples of how it could probably be done. The specific RS232 code you will need to engineer on your own or use Google, but Java Comm (URL above) will likely be needed.
          • 2. Re: Getting Data from Serial RS232 Port  through Custom Form
            acarsel
            Hi Michael;
            Thank you for your help. We started to configure webutil to read data from a file(First we wanted to read RS 232 data to a file) ; but we encountered some errors; so we start to work to use java code .

            Can we use java importer to do the same operation? Or we must use java beans? If we use one of these; do we have to some configuration on server machines?Or Only server machine configuration will be enough?
            • 3. Re: Getting Data from Serial RS232 Port  through Custom Form
              Michael Ferrante-Oracle
              If the connection to the serial device is on the server then you would have to use the java importer. If the serial device is connected to the client machine, you would have to use a java bean.

              Explanation:

              o Imported java is executed on the server at runtime.
              o Java bean code is executed on the client.

              As mentioned, the Forms Builder Online Help, which is available from within the Builder or on OTN (URL below), offers details about both beans and imported java.

              http://www.oracle.com/webapps/online-help/forms/10g/

              More information about Forms is available on OTN here:

              http://www.oracle.com/technology/products/forms/index.html
              • 4. Re: Getting Data from Serial RS232 Port  through Custom Form
                acarsel
                Hi again; ı investigated for a while and working on using javabean from forms. I decided yo use Fbean package; I have created a sample javabean using this code:
                *****************************************
                package oracle.forms.fd.mypackage;
                import java.io.Serializable;

                public class JavaBean implements Serializable
                {
                public JavaBean()
                {
                }

                public static char degeral() {
                     
                char x = 'a';
                     // print x to see if its value has changed
                return x;
                     
                }
                }
                ***********************************
                I generated a jar file using this code; registered formsweb.cfg and FORMS_BUILDER_CLASSPATH
                Then I created a sample form ; too
                In this form ; in the WHEN_NEW_FORM_INSTANCE trigger; I registered the javabean

                *************************
                DECLARE
                     itemid Item;
                BEGIN
                itemid := Find_Item('BLOCK3.MYBEAN');
                FBean.Register_Bean(itemid, 1, 'oracle.forms.fd.mypackage.JavaBean');
                FBEAN.SET_LOGGING_MODE(itemid,1,FBEAN.LOG_ALL);

                END;
                ***************************

                Than I created a button to see if the method works on a WHEN_BUTTON_PRESSED_TRIGGER:

                ****************************
                declare
                kantar VARCHAR2(1);
                itemid Item;
                begin
                itemid := Find_Item('BLOCK3.MYBEAN');
                -- First determine the state of the Bean
                kantar := FBEAN.INVOKE_CHAR(itemid,1,'degeral');
                -- Now branch on that state
                message('TRY');
                message ('kantar :' || FBEAN.INVOKE_CHAR(itemid,1,'degeral'));
                message('OK?');
                end;
                *****************************
                There is no error messages; but I can not see the kantar value on form, where is wrong?
                thanks.
                • 6. Re: Getting Data from Serial RS232 Port  through Custom Form
                  Michael Ferrante-Oracle
                  If you are just learning about creating java beans for use in Forms, I would recommend that you start with a working demo. All of the Oracle demos come with both java and Forms source code. There are also good examples on several third party sites as well.

                  Oracle Forms Demos on OTN:

                  http://www.oracle.com/technology/sample_code/products/forms/index.html

                  Oracle Forms demos from third party:

                  http://forms.pjc.bean.over-blog.com/
                  • 7. Re: Getting Data from Serial RS232 Port  through Custom Form
                    acarsel
                    Hi Michael ;
                    I have looked at oracle demos.

                    I have solved it; the jar file has to be signed to be used.

                    But now I want to use is on server, I have errors.
                    • 8. Re: Getting Data from Serial RS232 Port  through Custom Form
                      Michael Ferrante-Oracle
                      You will not be able to use the java bean for the server side. For Forms, a bean is used for client side execution. If you want java to execute on the server, you need to create java app which is stored on the server. included in the CLASSPATH in default.env, and called into the form using the Java Importer at design time.

                      Refer to the following chapter of the Deployment Guide and the Java Importer section of the Online Help (both URLs below):

                      Deployment Guide
                      http://download.oracle.com/docs/cd/B19375_07/doc/frs/forms/B14032_03/jvm.htm

                      Forms 10.1.2 Online Help
                      http://www.oracle.com/webapps/online-help/forms/10g/
                      • 9. Re: Getting Data from Serial RS232 Port  through Custom Form
                        acarsel
                        I mean I created a from that uses javabean on the application server and related my form to a responsibility.. I moved my jar file and configured formsweb.cfg; is not it enough to work over a javabean at the server?

                        It will work again at client side over a form through the web. Fot this; Do I have to import my class file over Java Importer; do you mean that?
                        • 10. Re: Getting Data from Serial RS232 Port  through Custom Form
                          Michael Ferrante-Oracle
                          In most cases, a java bean is not going to be coded in the same manner as a server side app would be. A bean often provides client side features like gui funtionality, making it useless on the server. You will likely need to remove the bean specific code from the app (java) and any gui functionality, then import the code into the form so that it can be executed on the server.
                          • 11. Re: Getting Data from Serial RS232 Port  through Custom Form
                            acarsel
                            I decided to use java bean depend on your first reply.

                            So you know ;weighing machine is connected to client machine; form exists in server; so the java code that exists in server will work for client over forms? Anything extra for client need to be done?

                            I spent three days to work on javabean; I wish you would explain this in your first answer :(
                            • 12. Re: Getting Data from Serial RS232 Port  through Custom Form
                              Michael Ferrante-Oracle
                              You are getting yourself confused. I have explained this quite clearly.

                              A java bean will execute on the CLIENT machine. This means that if your scale (weighing machine) is connected to the CLIENT machine, a bean is what you need in order to communicate with it.

                              Imported java will execute on the SERVER machine. This means that if your scale is connected to the SERVER machine, you will need imported java to communicate with it.

                              Regarding your comment:
                              I wish you would explain this in your first answer
                              Based on what you said when you opened this thread, I replied with the understanding that you needed java bean information, which is what I provided. You suggested that the scale was connected to the CLIENT when you said:
                              ... our project to read the weight data from RS-232 port to display the weight data for client* machines
                              Therefore, if the scale is on the client, a java bean would be the best approach.

                              You then changed your mind and suggested that you wanted to execute the code on the SERVER, which also suggests that the scale is connected to the SERVER. You said:
                              ... But now I want to use is on server, I have errors
                              This prompted me to provide information about Imported Java.

                              Please go back and review all the information previously provided.
                              • 13. Re: Getting Data from Serial RS232 Port  through Custom Form
                                acarsel
                                I think I can not tell my situation.

                                I understood all of your views, thank for your help.

                                I want to explain that: oracle forms(fmb and fmx files) and the javabean jar file has to be at SERVER to be called by the client. The form will not manually work at the client; it will be called over web ; and form will call javabean method too. So these files must be at application server. But java method will be applied to client machine port.


                                Is this possible with using javabeans?
                                • 14. Re: Getting Data from Serial RS232 Port  through Custom Form
                                  385818
                                  You only need to answer one question:

                                  Where is the machine that reads the weight data from RS-232 port connected to?

                                  It sounds they are in the client PCs, .... so your confusion is that the javabean jar files are located in the server but only for deployment purposes, they get uploaded to the client and all further processing happens in the client not in the server.
                                  1 2 Previous Next