Serializing ResultSet using CachedRowSet

Hi all,
I am trying to serialize the retrieved results of a query from one machine to another machine by populating the ResultSet into a CachedRowSet object. According to my understanding CachedRowSet is Serializable an should allow for data serialization over the wire. However, when I try sending the data, I get the following error. I googled the problem online and some people suggested that it is a problem with the version of the OJDBC driver. I have tried ojdbc14 and ojdbc6 for XE 11g but the results are the same. Could anyone give me some suggestion about whether it is possible, and how so?
From my understanding, the Connection should be marked as transient and only the raw data should be transferred. I wonder if Oracle's implementation of CachedRowSet is not supporting serializability or whether I am doing something wrong.
thanks!
Here is the error:
java.lang.RuntimeException: java.io.NotSerializableException: oracle.jdbc.driver.T4CConnection
     at remoting.RemotingManager.doPost(RemotingManager.java:190)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
     at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598)
     at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486)
     at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
     at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:499)
     at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)
     at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)
     at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413)
     at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
     at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)
     at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
     at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
     at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
     at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
     at org.eclipse.jetty.server.Server.handle(Server.java:350)
     at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)
     at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:900)
     at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:954)
     at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:851)
     at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
     at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)
     at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:606)
     at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)
     at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
     at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
     at java.lang.Thread.run(Thread.java:722)
Caused by:
java.io.NotSerializableException: oracle.jdbc.driver.T4CConnection
     at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
     at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
     at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
     at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
     at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
     at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
     at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
     at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
     at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
     at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1362)
     at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1170)
     at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
     at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
     at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
     at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
     at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1362)
     at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1170)
     at java.io.ObjectOutputStream.access$300(ObjectOutputStream.java:161)
     at java.io.ObjectOutputStream$PutFieldImpl.writeFields(ObjectOutputStream.java:1687)
     at java.io.ObjectOutputStream.writeFields(ObjectOutputStream.java:478)
     at java.util.Vector.writeObject(Vector.java:1073)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.lang.reflect.Method.invoke(Method.java:601)
     at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:975)
     at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
     at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
     at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
     at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
     at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
     at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
     at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
     at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
     at remoting.RemotingManager.upCall(RemotingManager.java:179)
     at remoting.RemotingManager.upCall(RemotingManager.java:137)
     at remoting.RemotingManager.doPost(RemotingManager.java:187)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
     at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598)
     at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486)
     at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
     at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:499)
     at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)
     at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)
     at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413)
     at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
     at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)
     at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
     at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
     at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
     at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
     at org.eclipse.jetty.server.Server.handle(Server.java:350)
     at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)
     at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:900)
     at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:954)
     at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:851)
     at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
     at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)
     at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:606)
     at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)
     at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
     at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
     at java.lang.Thread.run(Thread.java:722)
Edited by: 944957 on Oct 4, 2012 12:04 AM

>
I am trying to serialize the retrieved results of a query from one machine to another machine by populating the ResultSet into a CachedRowSet object. According to my understanding CachedRowSet is Serializable an should allow for data serialization over the wire. However, when I try sending the data, I get the following error. I googled the problem online and some people suggested that it is a problem with the version of the OJDBC driver. I have tried ojdbc14 and ojdbc6 for XE 11g but the results are the same. Could anyone give me some suggestion about whether it is possible, and how so?
>
This question should have been posted to the JDBC forum
https://forums.oracle.com/forums/category.jspa?categoryID=288
If the below does not answer your question mark it ANSWERED and repost it in the JDBC forum
See CachedRowSet in chap 18 JDBC RowSets in the JDBC Developer's Guide
http://docs.oracle.com/cd/E14072_01/java.112/e10589/jcrowset.htm#i630230
That section includes extensive documentation of this and also includes example serialization code you can adapt.
>
The following code illustrates how an OracleCachedRowSet object is serialized to a file and then retrieved:

Similar Messages

  • How to transfer file from PC to PC via serial port using labview

    I need to transfer files(.txt, .doc, .xls) from PC to PC via serial port using LabVIEW. Is it possible to transfer files, if so how to transfer?
    Solved!
    Go to Solution.

    Yes, it is possible to transfer files with the serial port using LabVIEW.  Files are just collections of bytes and the serial port is pretty good at shipping bytes from one PC to another.  You need to connect the serial ports together with a null modem cable.
    First, take a look at the example for serial communication.   In LabVIEW, go to the Help menu and select "Find Examples...".  From there you can search for "serial" or navigate to Hardware Input and Output >> Serial.  Select the "Basic Serial Write and Read.vi".  Experiment with that example to gain confidence on the serial communication methods.
    Next, it's time to learn about how to read and write files.  For that, the examples could be somewhat confusing since they all deal with files that are presumed to have data of a specific type in them.  I would recommend just getting familiar with the functions on the File I/O palette.  Specifically, get to know the following functions.
    Open/Create/Replace File - On your destination side, you'll need to create the copy of the file that you are trying to transfer
    Close File - When you are finished reading from or writing to a file, you should close it.  It cleans up the memory being used and finalizes any write operations that are still floating in the write buffer.
    Read From Binary File - The best way to read from a file when you do not really care what type of file it is.  In your case, you just want to get those bytes read and sent out so they can be written down at the destination.
    Write to Binary File - At the destination side, this is what will store those bytes to the file you created with number 1.
    Get File Size (under the Advanced File Functions sub-palette) - You need to know how big the file is so you know when you are finished.
    OK, so once you are able to create files, write bytes to them, and read bytes from existing files you can move on to transferring.
    The basic method I would suggest is to have the user specify a source file on the source PC and a destination folder on the destination PC.  Then, find out the size of the source file using number 5.  Divide that size number by the number of bytes you feel like transferring at once.  The serial buffers are usually around 32k (if I remember correctly) so do not exceed that.  Now begin sending data by reading some number of bytes and wiring that string output to the VISA Write function.  On the destination side, you'll want to be monitoring the serial port for bytes and reading them when they arrive.  Wire that string to the Write to Binary File function to add them to your destination file.
    That is the basic outline of how to do it.  You have to be careful not to overload the write and read buffers on the serial ports.  Initially you can use delays on the sending side to make sure the reading side has enough time to digest.  To get things moving faster, you can bring in some flow control.
    If all that sounds a bit intimidating, there are Alliance Member companies out there (such as PrimeTest Automation) who can write such code for you and even provide a turnkey solution for you.
    Happy wiring,
    Dan Press
    Certified LabVIEW Architect
    PrimeTest Automation

  • Report to know serial number used in mvt of materials during posting period

    Dear All,
    We are using serial number management, can anybody help me, which transaction code can give the report for all serial numbers used during movement of an materials in the specific period.
    Thanks in advance.
    Madhukar Mittal

    Hello Madhukar ,
    Unfortunately , this information is not available in the SAP system. Only the current stock information of a serial number is stored in thet EQBS table. Although there is a serial number history , (where you can see the assignment of a serial number to a material document and thus implicitly gather stock information) , no report exists for this matter.
    I am sorry that I do not have a better aswer for you at this time but this fucntionality does not exist on the standard SAP system. Please let me know if you have any further questions or if I have misunderstood your issue. Thank you.
    Best Regards,
    Frank Farinella

  • Getting Serial Number using BlackBerry PIn

    Hi guys
    does anyone know how to generate the device serial number using the PIN? My precious limited edition just got stolen at an accident a few minutes ago.
    BlackBerry Protect on location it's shaded out, likely won't be able to see it's location once wiped. Though I do hope to recover it.
    Please help. The box is more than 1000 miles away and can only access it probably once my mum is back there from her holiday this side in about a month.
    Twitter: @IAmBenGiey | Click " Like " if you want to Thank someone.
    If Problem Resolves mark the post(s) as " Solution ", so that other can make use of it.
    Try my apps:
    The Ultimate Currency Converter and T2G - BloGFeed

    Your carrier should have that on file so giving them a call would be an idea.
    It's a good idea to call them anyway to cancel the SIM card ASAP.
    Cheers.
    - If my response has helped you, please click "Options" beside my post and mark it as solved. Clicking the "thumbs up" icon near the bottom of my response would also be appreciated.

  • Problem in querying synonym using cachedRowSet & cachedDataProvider

    Hi....
    I have some trouble using cachedRowSet and cachedDataProvider combination. The problem was occured when I refreshed chachedDataProvider, my table component in pages show "No items found.", whereas... i'm sure there is nothing wrong with my query.
    here the detail
    i have cachedRowSet in my SessionBeans1 named globalRowSet
    globalRowSet.setDataSourceName("java:comp/env/jdbc/MIMSOE_Oracle");
    globalRowSet.setCommand("SELECT EQUIP_NO, ORIGINATOR_ID FROM ELLIPSE.MSF620 WHERE EQUIP_NO LIKE ?");
    globalRowSet.setFetchSize(100);
    globalRowSet.setMaxRows(100);
    globalRowSet.setPageSize(100);and then i have data provider in my pages (TestPage.jsp), linked to globalRowSet, named cachedRowSetDataProvider1
    cachedRowSetDataProvider1.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.globalRowSet}"));Note that in globalRowSet SQL command, there is a parameter (marked by '?'), so i put this code in init() method.
    getSessionBean1().getGlobalRowSet().setObject(1, "%MUA21%");that code replace '?' in my query with '%MUA21%'. so in the first time i open the page, my table in TestPage.jsp dont display empty data. this code was worked.
    then i put a button and a textfield in TestPage.jsp. I put them for dynamically changes my query parameter.
    public String button1_action() {
    try {
    getSessionBean1().getGlobalRowSet().setObject(1, this.textField1.getText().toString());
    this.cachedRowSetDataProvider1.refresh();
    } catch (SQLException ex) {
    Logger.getLogger(TestPage.class.getName()).log(Level.SEVERE, null, ex);
    return null;
    }I ran my webpages, i hit the button, and i saw anomalies.
    before i hit the button, my table shows a lot of records. but after i hit, my table shows nothing but "No items found." displayed in table body.
    I debugged my code, and found nothing wrong with my query. I executed my query in separated sql editor and it works flawlessly,
    I truncated my code line by line for debugging, and found this line of code was the main reason for that problem
    this.cachedRowSetDataProvider1.refresh();I'm not sure why this line of code didnt work in my project. maybe this is because of my globalRowSet querying data from ORACLE synonym. please note that 'MSF620' in my query (SELECT EQUIP_NO, ORIGINATOR_ID FROM ELLIPSE.MSF620) is not a table, but synonym. I made same version but use oracle table (not synonym) and work fine...
    can anyone help give me a solution for this issue? ...
    please help..
    i have no progression for last 2 weeks because of this issue.......

    Hi Tushar,
    In your SELECT you select only record for record and you put the result into the header line of the table.
    Try:
    SELECT posnr
          FROM RESB
          INTO TABLE IRESB
         WHERE VORNR = '0010'
           AND AUFNR = '720000100'.
    Then you can loop over your internal table!.
    Regards,
    John.

  • Query SQL database using JSF problem!! Using CachedRowSet

    I'm using JSF and want to query data from SQL by using CachedRowSet like this,
    rowset.setCommand("SELECT * FROM dbo.SomeTable WHERE SomeField='"+ xyz +"'");
    then check if the record does exist by using
    *if(rowset.next()) {/ do something with the retrieved data}*
    but i get SQLException telling that execute() never called.
    Anyone can tell me what i'm missing? or is there any better way to check the existence of a record ?
    Thanks in advance :-)

    Hi grzegorz,
    1. If your sap application server is unix/aix
      (and not a microsoft OS),
    2. then this kind of secondary databse connection,
       to MS SQL (which is microsoft system),
       is at present not possible.
      (BCOS the required system files, for such
       cross - platform connection is not delivery by sap)
    regards,
    amit m.

  • How to create updateable resultset using sql with "order by"

    Dear all,
    I'm using the Derby database to hold a table of stock prices. After the table is populated, I want to do some calculations and store the result in a column.
    I get the resultset using the following code
    Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = stmt.executeQuery(select history_id, value, days from history where ticker = '" + ticker + "' order by value_date"); {code} When I then try to update the "days" field, I get an SQLException telling me that the resultset is not updatable. However, if I remove the "order by" clause, I am able to update the data, but then my algorithm does not work as I need to traverse the data in a specific order. The quesion is: how do I create an updatable resultset using a sql-statement with an order by clause? Kind regards Karl Martin Lund                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    jschell wrote:
    Seems rather obvious to me that the exception specifically tells you that you can't do that.OP: I would guess it's because ORDER BY forces the database to read all the result rows into a temporary area, sort them, and then return them from this temporary area, as opposed to streaming the results. The extra step probably makes updateable result sets more difficult (or maybe not possible), so they opted not to do it.

  • Can I use WinXP Home serial number using WinXP Pro install disc

    Hello everyone,
    I am going to downgrade from Vista to XP (my DELL machine was originally XP Home) but I don't have my old XP install files anymore.  I did do have a Windows XP Professional SP3 install disc.  My question is:  Would I be able to use my serial number using the WinXP Pro install disc for a clean install?  (I am going to format my C drive.)
    Thanks!

    Hey there! You would not be able to use the Home Key with a Professional disc.
    Adam
    Best Buy Community - Retail, Americas
    Forum Guidelines | Terms & Conditions | Community Guidelines | Blogging Guidelines
    *Remember to mark your questions solved and click the star under the user's name to show your thanks!

  • How to create a Sales order with ref. with serial number using BAPI

    Hi Gurus...
    I have a requirement where,  i need to create an order with reference to serial number using a BAPI.
    The inputs will be the Order type..Sales area..Sales office..Sales group..Sold-To-party..Material number...Serial number...
    When i create the order using VA01 the configuration data will be automatically copied from the BUMP order which will have all the required information.
    But to create using a BAPI, i am struck ed..Please help
    Thanks in advance..
    Srinu

    You can use this BAPI.
    You can pass ITM_NUMBER to the ORDER_ITEMS_IN parameter. I think this will act as serial number.
    Regards,
    Murali

  • How to read HardDisk Serial number using java

    In my project the requirement is how to read the hard dish serial number using java library. Please do let me now if u get any help or any information regarding this issue. This is urgent for me

    In my project the requirement is how to read the hard
    dish serial number using java library. Please do let
    me now if u get any help or any information regarding
    this issue. This is urgent for meThat's a pretty goofy 'requirement' for a Java application, which is supposedly meant to do platform-independent things, to do something very platform-specific that it has no business doing in the first place.

  • Can i find out my ipad serial number using my icloud ?

    can i find out my ipad serial number using my icloud ?

    Nope.
    This Apple doc provides the ways you can find the serial numbers -> How to find the serial number of your Apple hardware product

  • SQL Error using cachedrowSet.populate.

    Hi,
    I am trying to use cachedrowset to pass my result set into my jsp.
    I use request.setAttribute and pass my cachedrowset and in my jsp I use <jsp:usebean> tag to retrieve it.
    This usually works for me. However, I have one query which when I am trying to populate the cachedrowset with its result set (that is cr2 in code below )
    rs2 = stmt.executeQuery(semSql);
    rs3 = stmt.executeQuery(countSql);
    crs2 = new CachedRowSet();
    crs3 = new CachedRowSet();
    crs2.populate(rs2);
    crs3.populate(rs3);
    is throwing an sql error.
    I ran the query in my query analyzer tool and it runs fine. But when I try to populate it in cachedrowset it throws sql error.
    I have more queries in the same java which I am passing to the jsp as cachedrowset (for example cr3 in the above code) And they all are working fine. Only this particular one is causing the issue.
    I was also looking at some other posts with the same issue. One post said if the data is a negative number then it can cause issue while trying to populate a CRS. However, in my case there is no negative data.
    I am clueless. Please help !!

    Apparently noone replied to this.
    Well, this one is odd so cant blame you guys.
    I finally found the answer after losing lots of my hair.
    It looked like somewhere my connection was getting closed. I dont know why it was getting close at the first place because i didnt have any rs.close() or so statement in there.
    One of the reasons that I have in mind is that after getting the results of my first query in a cachedrowset (CRS) , I moved the cursur of CRS and that may have caused some problem. But then also my second query was totally independant of my first query. And my third query which apparently was working fine and didnt thru an error on crs.populate was dependant on the first one,.
    Finally, I rearraged the code, so that the operations i was doing on the first CRS was after I populate my second CRS. And that solved the problem.
    Hope this solution helps somebody like me out there.

  • RE:Serial communication using java

    Hello,
    First of all, I want to make clear thatI did not double post it as previously I posted it in Networking section..But I was told that I have not posted it at appropirate place....thats wht I am posting here.
    I am a newbie in Java.I have started with Netbeans.I have designed a interface using Netbeans.It has 5 texboxes and two buttons named "Start" and "Stop".
    I want to receive data from the serial port and display the data in text boxes.I want when I press Start button, then it should start listening to the serial port .If adat is present on serial port, then it must receive it and displayin the text boxes.when I press Stop button, then it should stop receiving data as well close connection.
    can please anyone help me on this?
    I would be highly thankful for this.
    Regards,
    Jass

    Hello All,
    I am using the javax.comm for serial communication using serial to usb converter at port COM4(I check using device manager.).Beside that I have also added the option in the programming to look into other COMs also.I have placed "comm.jar " and "javax.properties" into jdk\lib\ext and "win32.dll" into jdk\bin.
    But I am getting the following output:
    Wed Dec 24 02:23:43 EST 2008: COM4 null
    Serial port List is  javax.comm.CommPortEnumerator@1a46e30
    Serial port ID  is null
    BUILD SUCCESSFUL (total time: 0 seconds)
    The code Is as follows:
    import java.io.*;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.comm.*;
    import java.util.*;
    public class serialport implements Runnable, SerialPortEventListener
        static CommPortIdentifier portId, portId1;
        public SerialPort serialPort;
        public OutputStream outputStream;
        public InputStream inputStream;
        Thread readThread;
        static Enumeration portList;
         static String TimeStamp;
        public static void main(String args[])     
        {try {
              portId1 = CommPortIdentifier.getPortIdentifier("COM4");
              }catch(Exception e) {
          TimeStamp = new java.util.Date().toString();
          System.out.println(TimeStamp + ": COM4 " + portId1);}
               portList = CommPortIdentifier.getPortIdentifiers();
               System.out.println("Serial port List is  "+portList+"\n");
               portId = (CommPortIdentifier) portList.nextElement();
              System.out.println("Serial port ID  is "+portId+"\n");
           while (portList.hasMoreElements()) {
              portId = (CommPortIdentifier) portList.nextElement();
              if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
                if (portId.getName().equals("COM3")) {
                     System.out.println("Serial port COM3 is found\n");
                serialport Port = new serialport();
                else if (portId.getName().equals("COM4")) {
                     System.out.println("Serial port COM4 is found\n");
                serialport Port = new serialport();
                else if (portId.getName().equals("COM6")) {
                     System.out.println("Serial port COM6 is found\n");
                serialport Port = new serialport();
                else if (portId.getName().equals("COM7")) {
                     System.out.println("Serial port COM7 is found\n");
                serialport Port = new serialport();
                else if (portId.getName().equals("COM5")) {
                     System.out.println("Serial port COM8 is found\n");
                serialport Port = new serialport();
      public serialport()
        try {
          serialPort = (SerialPort) portId.open("MainClassApp", 2000);
        } catch (PortInUseException e) {
                  System.out.println("Port is owned by another application \nor port cannot be opened\n");
        try {
          inputStream = serialPort.getInputStream();
        } catch (IOException e) {
             System.out.println("IOstream for port is not available\n");}
        try {
          serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
        } catch (UnsupportedCommOperationException e) {
             System.out.println("Serial port is not properly configured\n");}
        try {
          serialPort.addEventListener(this);
        } catch (TooManyListenersException e) {
             e.printStackTrace();}
        serialPort.notifyOnDataAvailable(true);
        readThread = new Thread(this);
        readThread.start();
        public void run() {
           try {
             Thread.sleep(2000);
               } catch (InterruptedException e) {      e.printStackTrace();}
        public void serialEvent(SerialPortEvent event) {
             Runtime rt = Runtime.getRuntime() ;
             Process p;
        switch (event.getEventType()) {
        case SerialPortEvent.BI:
        case SerialPortEvent.OE:
        case SerialPortEvent.FE:
        case SerialPortEvent.PE:
        case SerialPortEvent.CD:
        case SerialPortEvent.CTS:
        case SerialPortEvent.DSR:
        case SerialPortEvent.RI:
        case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
          break;
        case SerialPortEvent.DATA_AVAILABLE:
          byte[] readBuffer = new byte[1];
          try {
            while (inputStream.available() > 0)
                   int numBytes = inputStream.read(readBuffer);
                   System.out.print(new String(readBuffer));
                    break;
            System.out.print(new String(readBuffer));
                } catch (Exception e) {
               e.printStackTrace();}
          break;}  }  }Kindly help........I really wanna to know where is the error???
    Thanks
    Edited by: jass11 on Dec 23, 2008 11:39 PM
    Edited by: jass11 on Dec 23, 2008 11:51 PM

  • RMA with reference to Serial Numbers using oe_order_pub.process_order

    Hi,
    Can any one pls let me know how to create RMA with reference to Serial Numbers using oe_order_pub.process_order API.
    Thanks,
    Praveen
    Edited by: user11186474 on Feb 19, 2010 6:00 AM

    We need to pass the following parameters when doing RMA with reference to Serial numbers.
    l_line_tbl (1).return_reason_code := 'WRONG PRODUCT';--RETURN REASON CODE
    l_line_tbl (1).reference_line_id :=390744;--Sales order Line ID
    l_line_tbl (1).reference_header_id :=193001;--Sales Order Header ID
    l_line_tbl(1).return_context := 'SERIAL';--REFERENCE TYPE
    l_line_tbl(1).return_attribute1 := '215990';--ITEMID FOR RMA
    l_line_tbl(1).return_attribute2 := 'RMA_TEST-9';--SERIALNUMBER
    Thanks,
    Praveen

  • Unable to communicat​e with serial device using hex

    Hi... I have two instruments, both manufactured by the same company (Inficon), both that provide the same basic function which is rate control of vapor deposition...  Both instruments use RS-232 serial communication (baud rate of 19,200, 8 data bits, 1 stop bit, no parity, no flow control).  The only fundamental difference between the two instruments is that the instrument I will call #1 communicates serially using simple ASCII text while the second instrument (#2) communicates using HEX numbers...  Using VISA serial write and read, I have for a long time been successfully communicating with instrument #1...  I send it (serial write) a certain ASCII text command and the instrument responds with a message I successfully read back (serial read)...  That works fine...  Now I have a need to do the same "write a command and read a response" with instrument #2... I'm working with an engineer at the instrument company who has supplied me with the precise HEX messages I need to send, messages he has tested on an identical instrument #2 at his factory but so far, what works for him does not work for me...  I write the HEX string.  I get no errors but also I get NO BYTES available to read at the serial port...  Note, he is NOT using LabVIEW at the factory but is instead using a proprietary serial communication executable the factory uses internally...  He and I have resorted to having me try the simplest HELLO command in HEX that is, in fact, exactly the following
    0200480149  <--- in HEX (first two bytes are Length of command with LSB first, MSB second, the next two bytes are the command itself, in this case H1 (HEX for ASCII "H" is 0x48 and this company then uses 0x01 for 1 rather than the actual HEX for ASCII "1" which would be 0x31. Then the last byte is a checksum which is simply the HEX add of the two command bytes, 0x48 + 0x01 = 0x49...
    The bottom line I am confident the above 0200480149 (HEX) would work if I was sending it correctly but somehow I am not...  
    It's the weekend right now and I've been reading NI support posts here and I already have a couple of ideas that I intend to try on Monday...  One is I will try HyperTerminal to see I can communicate that way...  Second, the code I am using is ALMOST identical to the very basic Serial Write/Read code that can be found at (this is being done in LabViEW 7.1)
    C:\Program Files\National Instruments\LabVIEW 7.1\examples\instr\smplserl.llb\Basic Serial Write and Read.vi 
    But the ALMOST might be important...  I just noticed that I "Enable Termination Character" set to TRUE (default).  That may be causing my problem so the first thing next week I will set that to FALSE and see if my problem goes away...  But I'm trying to get a jump start on this problem (I am under time pressure to get this working) so I thought I would ask for your help...
    I also am not sure how to set up the string control that is inputting this HEX input message...  I have set it as "Normal" and also as "HEX display"...  But either way I set it, I still get "0 bytes at port" when I get to the READ portion of the code so neither "Normal" nor "HEX display" is working for me... 
    So other than trying HyperTerminal and also trying to set the "Enable Termination Character" to FALSE, can anyone suggest what I might be doing wrong???  I am pretty sure it is a formatting issue (such as sending that termination character) and I need to get it figured out soon... Any other ideas???  Any help would be much appreciated...  thanks.... bob...

    Hi...  Thanks for the response...  Find the very simple code I am using attached...  Do note that the string indicator out of the VISA read does open up with default values of 0D0A (CR LF)...  I didn't put those in and I've left them there to show what the defaults were when this code was first saved, just in case you think those values being there matter...  ??  Anyway, again, the code is attached...  Note also I have left the code with its "Enable Termination Char" set to ON (default) in the Configure VISA serial subvi.  I am not at work yet and will set that to FALSE later but you've more or less convinced me that is not going to solve my problem as that is tied to terminating the READ and does not impact the Serial WRITE...  And I appreciated the input on Portmon...  I downloaded it and will give it a try when I get to work which will be soon...  But I wanted to attach the code as you requested...  Holler back if you see anything that might help me with my issue...
    Oh, one last thing...  The manual for the instrument explicitly says that it uses "one start bit, 8 data bits, one stop bit, no parity, no flow control"...  What got my attention there is the explicit mention of "one start bit"...  Nothing in Windows or LabVIEW allows me to alter how many start bits there might be so I am assuming ALL serial comm uses one start bit and they just chose to mention it here???  Or might the start bit settings be an issue????  I am just searching... 
    Last, this code is in LabVIEW 7.1 and I really do use COM4 as I use a Keyspan serial port expander on the PC because we needed more serial ports...  That part has been tested and In fact, the other day, while in the middle of this problem we took the serial cable and hooked to what I above called the #1 instrument and talked to it just fine over COM4, same cable and everything so I think that part is good...
    thanks... bob... 
    Attachments:
    Talk with Cygnus.llb ‏35 KB

Maybe you are looking for

  • Change of Net Price in Sales Order

    Hello Experts! I wanted to know how the "Net Price" of a sales order can be "changed" by the system or "indirectly" by the user.  I have an issue with the net price that changed in the sales order, and wanted to know how this could have happened; <b>

  • My iPhone 3GS is not being recognized by iTunes

    I've downloaded all the latest software and restarted the machines and I'm having problems getting my iphone to be recognized by iTunes. My iphone and connected to wi-fi. What's the problem?

  • Can Compressor 4 remove duplicate frames?

    I have some videos which were converted to 30fps from a lower frame count. It was obviously a simple conversion that duplicated frames as needed. The problem is, when I use these videos for slow motion, the duplicated frames cause the slow motion to

  • Make a "best of" DVD from other iDVD projects

    I'm archiving old family-movie VHS tapes into iMovie, and then burning them with iDVD. No fancy menus, chapters, or effects. Once I am finished and have all the iDVD's, can I get video clips from them back into iMovie to make a single movie with the

  • Multiple Column Sub queries

    Hi, I am facing some problems in teaching Multiple column subqueries and also ig u'll could with some example show me how to use sub-query using from clause??