Reading/ Writing Socket in order

Hi, I have a client / sever model which I'm finding very hard to implement, it is this way:
I've got a server which clients connect to, every client can fire events in other clients, example: a client sends a file to be re-sent to other clients, other events can be: to create/delete/modify a new user, a new group, and so on.
I need all the traffic to pass through the server in order to raise other clients, there can't be direct conexions between clients. I create 2 threads on the client side (1 for reading n 1 for writing from/to the server).
On the server side I've got a thread to listen to conexions, and 1 thread to read/write from/to every client. I also keep a list with references to every thread, that's the way I use to notify other threads that an event has happened.
That model genarates a lot of problems since there's just one socket per client, problems are like this: supposing the case the server needs to send a file (which is divided in packets) to client A, so the thread that keeps the conexion (thread A) with client A, first send a notification so the client (who gets ready to receive the file) and then starts to send the file, but it cant finish 'cause its processor time ends.
In that moment (while the client it's still waiting for the last packets of the file), another thread (thread B) starts, it needs to send info of another event (a new client created for example) to a bunch of clients, including client A who is still waiting for packets of the file, when client A receive the info of the other event, it can't know the difference so save that info as a part of the file, creating a corrupted file.
Try to synchronize that, it's difficult, cause bloking all the threads 'till 1 finish to sent, affect a lot the efficience of the system
I do appreciate any kind of help or idea

there are plenty of alternatives, but one very simple is to not allow other threads send data through a socket, but instead put what you want to send on a queue (you can use Vector for simplicity or the new Queue implementations)... the actual transfering happens on the thread that "owns" a socket.... this thread checks for objects in that queue, removing from that and sending as needed...
having another queue for incoming data (before processing) is a good idea too (i think)...
if its for learning pourposes, it will work fine... if you want a large scale system, try learning JAVA NIO packages that needs lesser threads...

Similar Messages

  • Performance issue: Tuning Reading/Writing to a Socket.

    I have use case where reading/writing to a Socket is spending over 25% of the time in NativeThread.current() (Called from within SocketChannelImpl) This is a native call and it occurred to me that there might be a Java JNI option which could improve this call in particular.
    This may be hprof giving incorrect information, but I don't know how to provide this. YourKit also shows this method as a big hit.
    I am not so worried about read0 and write0 as this is directly related to what the use case does.
    Can anyone suggest tuning options which might improve the performance of this call?
    Does anyone know a way to determine if the information regarding this call is accurate?
    TRACE 300250:
    sun.nio.ch.FileDispatcher.read0(FileDispatcher.java:Unknown line)
    sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:21)
    sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:233)
    sun.nio.ch.IOUtil.read(IOUtil.java:200)
    sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:236)
    my.AbstractSocket.readMessage(AbstractSocket.java:69)
    TRACE 300225:
    sun.nio.ch.FileDispatcher.write0(FileDispatcher.java:Unknown line)
    sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:29)
    sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:104)
    sun.nio.ch.IOUtil.write(IOUtil.java:60)
    sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:334)
    my.AbstractSocket.flush(AbstractSocket.java:47)
    my.AbstractSocket.sendMesg(AbstractSocket.java:37)
    TRACE 300259:
    sun.nio.ch.NativeThread.current(NativeThread.java:Unknown line)
    sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:331)
    my.AbstractSocket.flush(AbstractSocket.java:47)
    my.AbstractSocket.sendMesg(AbstractSocket.java:37)
    TRACE 300229:
    java.nio.Bits.copyToByteArray(Bits.java:Unknown line)
    java.nio.DirectByteBuffer.get(DirectByteBuffer.java:224)
    my.FieldFormat.readString(BoltFieldFormat.java:56)
    TRACE 300265:
    sun.nio.ch.NativeThread.current(NativeThread.java:Unknown line)
    sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:182)
    my.AbstractSocket.readMessage(AbstractSocket.java:69)
    CPU SAMPLES BEGIN (total = 11263) Tue Jul 14 16:29:15 2009
    rank self accum count trace method
    1 32.50% 32.50% 3660 300250 sun.nio.ch.FileDispatcher.read0
    2 30.68% 63.18% 3456 300225 sun.nio.ch.FileDispatcher.write0
    3 21.84% 85.02% 2460 300259 sun.nio.ch.NativeThread.current
    4 6.82% 91.84% 768 300229 java.nio.Bits.copyToByteArray
    5 5.69% 97.53% 641 300265 sun.nio.ch.NativeThread.current

    I would ignore it. All it does is:
    'Returns an opaque token representing the native thread underlying the invoking Java thread. On systems that do not require signalling, this method always returns -1.'I think the significant thing is that it is called while synchronized on 'stateLock', so if you have > 1 thread executing writes, the entire sync block will tend to be a bottleneck. I would aggregate the data for current() and read0(), or current() and write0(), and treat it all as I/O time.

  • Reading from socket inputstream returns -1

    I'm using a socket in order to connect to a chat server. The code is:
    Socket socket;
    InputStreamReader isr;
    OutputStreamWriter osw;
    try {
      socket = new Socket(sHost, iPort);
      isr = new InputStreamReader(socket.getInputStream());
      osw = new OutputStreamWriter(socket.getOutputStream());
      int iCharRead;
      char[] buffer = new char[512];
      while((iCharRead=isr.read(buffer, 0, 512))!=-1) {
          // do something
      System.err.println("Error: InputStream has returned -1.");
      System.err.println("\tsocket.isBound()=" + socket.isBound());
      System.err.println("\tsocket.isClosed()=" + socket.isClosed());
      System.err.println("\tsocket.isConnected()=" + socket.isConnected());
      System.err.println("\tsocket.isInputShutdown()=" + socket.isInputShutdown());
      System.err.println("\tsocket.isOutputShutdown()=" + socket.isOutputShutdown());
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      try {if (isr!=null) isr.close();} catch (Exception ex) {}
      try {if (osw!=null) osw.close();} catch (Exception ex) {}
      try {if (socket!=null) socket.close();} catch (Exception ex) {}
    }Ther server is supposed to be sending data continuously but sometimes, after being connected successfully for a while, the read method returns -1. As you can see in the previous code then I'm checking out some socket information and I get:
    Error: InputStream has returned -1.
         socket.isBound()=true
         socket.isClosed()=false
         socket.isConnected()=true
         socket.isInputShutdown()=false
         socket.isOutputShutdown()=falseThe socket seems to be bounded, it is not closed and isConnected also returns true. Besides, input and output streams are not closed. So, why does the read method return -1? What does it really mean? Is it a problem in the server side, that is overloaded or simply malfunctioning? What can I do in order to keep on reading data from the socket connection? Do I have to close the current socket and reconnect again to the server or is there any other way to recover from this situation?
    Thanks.

    isConnected means was ever connected.
    Check whether isr is closed. If so, the server has disconnected/closed the connection.

  • [solaris 8] Oracle 8.1.6 EE: no more data to read from socket

    Hi,
    I'm sorry for writing to this list, but it is the most related I could find.
    I installed Oracle 8.1.6 EE on a sparc 5 with solaris 8. I had to install the thread patches for solaris 8 because the emn0 process of oracle was dying every 30 minutes.
    After that, the DB seemed to work ok, but when running a heavy java process (jdbc),
    the process reports "java.sql.SQLException: No more data to read from socket".
    Have anyone experienced this kind of problem ?
    I decided to reinstall solaris 7... Could anyone help me ? comments ? suggestions ?
    Thanks in advance.
    Gabriel

    Reason: the ORACLE server process crashes (sometimes), and the result is the "empty"
    socket.

  • Stax reading /writing need help from xml guru plz

    hi, i have been told that stax reading /writing should involve no overhead and that is why i use it and i am now able to write my large data to file, but using my reader i seem to run out of memory, using netbeans profiler i ahve found that char[] seems to be the problem,
    by backtracing i ahve found that javax.xml.parser.SAXParser.parse calls the xerces packages which eventually leads to the char[ ], now my code for my reader is attatched here...
    package utilities;
    import Categorise.Collection;
    import Categorise.Comparison;
    import Categorise.TestCollection;
    import java.io.IOException;
    import javax.xml.parsers.*;
    import org.xml.sax.SAXException;
    import org.xml.sax.helpers.DefaultHandler;
    import org.xml.sax.Attributes;
    import java.io.File;
    import java.util.ArrayList;
    import java.util.List;
    import measures.Protocol;
    * @author dthomas
    public class XMLParser extends DefaultHandler
        static Collection collection = new Collection();
        List<Short> cList;
        List<Comparison> comparisonList;
        File trainFileName;
        File testFileName;
        TestCollection tc;
        List<TestCollection> testCollectionList;
        List<File> testFileNameList = new ArrayList<File>();
        List<File> trainFileNameList = new ArrayList<File>();
        boolean allTrainsAdded = false;
        Protocol protocol;
        List<File> trainingDirList;
        File testingDir;
        int counter = 0;
        File[ ] trainingDirs;
        File[ ] trainingFileNames;
        File[ ] testFileNames;
        TestCollection[ ] testCollections;
        Comparison[ ] comparisons;
        Comparison c;
        short[ ] cCounts;
        String order;
        String value;
        File trainDir;
        /** Creates a new instance of XMLParser */
        public XMLParser() {
        public static Collection read( File aFile )
            long startTime = System.currentTimeMillis();
            System.out.println( "Reading XML..." );
            SAXParserFactory spf = SAXParserFactory.newInstance();
            SAXParser sp;
            try {
                sp = spf.newSAXParser();
                sp.parse( aFile, new XMLParser() );
            } catch (IOException ex) {
                ex.printStackTrace();
            } catch (SAXException ex) {
                ex.printStackTrace();
            } catch (ParserConfigurationException ex) {
                ex.printStackTrace();
            long endTime = System.currentTimeMillis();
            long totalTime = ( endTime - startTime ) / 1000;
            System.out.println( "Done..."  + totalTime + " seconds" );
            return collection;
        public void startElement(String uri,String localName,String qName, Attributes attributes)
            if( qName.equals( "RE" ) )
                testCollectionList = new ArrayList<TestCollection>();
            else if( qName.equals( "p") )
                boolean isConcatenated = new Boolean( attributes.getValue( "c" ) );
                boolean isStatic = new Boolean( attributes.getValue( "s" ) );
                protocol = new Protocol( isConcatenated, isStatic );
            else if( qName.equals( "trdl" ) )
                trainingDirList = new ArrayList<File>();
            else if( qName.equals( "trd" ) )
                trainDir = new File( attributes.getValue( "fn" ) );
                trainingDirList.add( trainDir );
            else if( qName.equals( "td" ) )
                testingDir = new File( attributes.getValue( "fn" ) );
            else if( qName.equals( "TC" ) )
                counter++;
                System.out.println( counter );
                comparisonList = new ArrayList<Comparison>();
                testFileName = new File( attributes.getValue( "tfn" ) );
                testFileNameList.add( testFileName );
                tc = new TestCollection( );
                tc.setTestFileName( testFileName );
            else if ( qName.equals( "r" ) )
             order = attributes.getValue( "o" );
                value = attributes.getValue( "v" );
                cList.add( Short.parseShort( order ), new Short( value ) );
            else if( qName.equals( "c" ) )
                cList = new ArrayList<Short>();
                trainFileName = new File( attributes.getValue( "trfn" ) );
                if( !allTrainsAdded )
                    trainFileNameList.add( trainFileName );
        public void characters(char []ch,int start,int length)
            //String str=new String(ch,start,length);
            //System.out.print(str);
        public void endElement(String uri,String localName,String qName)
            if (qName.equals( "c") )
                allTrainsAdded = true;
                cCounts = new short[ cList.size() ];      
                for( int i = 0; i < cCounts.length; i++ )
                    cCounts[ i ] = cList.get( i );
                c = new Comparison( trainFileName, tc );
                c.setcCounts( cCounts );
                this.comparisonList.add( c );
            else if( qName.equals( "TC" ) )
                comparisons = new Comparison[ comparisonList.size() ];
                comparisonList.toArray( comparisons );           
                tc.setComparisons( comparisons );
                testCollectionList.add( tc );
            else if( qName.equals( "RE" ) )
                testCollections = new TestCollection[ testCollectionList.size() ];
                testCollectionList.toArray( testCollections );
                collection.setTestCollections( testCollections );
                testFileNames = new File[ testFileNameList.size() ];
                testFileNameList.toArray( testFileNames );
                collection.setTestingFiles( testFileNames );
                //String[ ] testCategories = new String[ testCategoryList.size() ];
                //testCategoryList.toArray( testCategories );
                //collection.setTestCategories( testCategories );
                trainingFileNames = new File[ trainFileNameList.size() ];
                trainFileNameList.toArray( trainingFileNames );
                collection.setTrainingFiles( trainingFileNames );
                //String[ ] trainingCategories = new String[ trainCategoryList.size() ];
                //trainCategoryList.toArray( trainingCategories );
                //collection.setTrainingCategories( trainingCategories );
                collection.setProtocol( protocol );
                trainingDirs = new File[ trainingDirList.size() ];
                trainingDirList.toArray( trainingDirs );           
                collection.setTrainingDirs( trainingDirs );
                collection.setTestingDir( testingDir );
         //else
             //System.out.println("End element:   {" + uri + "}" + localName);
    }i thought it may have been a recursive problme, hence having so many instance variables instead of local ones but that hasn't helped.
    all i need at the end of this is a Collection which holds an array of testCollections, which holds an array of cCounts and i was able to hold all of this in memory as all i am loading is what was in memory before it was written.
    can someone plz help
    ps when i use tail in unix to read the end of the xml file it doesnt work correctly as i cannot specify the number of lines to show, it shows all of the file as thought it is not split into lines or contains new line chars or anything, it is stored as one long stream, is this correct??
    here is a snippet of the xml file:
    <TC tfn="
    /homedir/dthomas/Desktop/4News2/output/split3/alt.atheism/53458"><c trfn="/homed
    ir/dthomas/Desktop/4News2/output/split0/alt.atheism/53586"><r o="0" v="0"></r><r
    o="1" v="724"></r><r o="2" v="640"></r><r o="3" v="413"></r><r o="4" v="245"></
    r><r o="5" v="148"></r><r o="6" v="82"></r><r o="7" v="52"></r><r o="8" v="40"><
    /r><r o="9" v="30"></r><r o="10" v="22"></r><r o="11" v="16"></r><r o="12" v="11
    "></r><r o="13" v="8"></r><r o="14" v="5"></r><r o="15" v="2"></r></c><c trfn="/
    homedir/dthomas/Desktop/4News2/output/split0/alt.atheism/53495"><r o="0" v="0"><
    /r><r o="1" v="720"></r><r o="2" v="589"></r><r o="3" v="349"></r><r o="
    please if anyone has any ideas from this code why a char[] would use 50% of the memory taken, and that the average age seems to show that the same one continues to grow..
    thanks in advance
    danny =)

    hi, i am still having lo luck with reading the xml data back into memory, as i have said before, the netbeans profiler is telling me it is a char[] that is using 50% of the memory but i cannot see how a char[] is created, my code doesn't so it must be the xml code...plz help

  • "No more data to read from socket" exception when testing connections

    Hi,
    I will appriciate your help with the following problem.
    We have the follwoing errors in the weblogic.log (We are using weblogic 8.1.0.2 and Oracle 9.2.0.3)
    ####<Dec 20, 2006 10:47:49 AM EET> <Info> <JDBC> <ep> <mfserver> <Thread-14> <<WLS Kernel>> <> <BEA-001128> <Connection for pool "oraclePool" closed.>
    ####<Dec 20, 2006 10:47:49 AM EET> <Info> <JDBC> <ep > <mfserver> <Thread-14> <<WLS Kernel>> <> <BEA-001067> <Connection for pool "oraclePool" refreshed.>
    ####<Dec 20, 2006 10:47:51 AM EET> <Error> <JDBC> <ep > <mfserver> <Thread-14> <<WLS Kernel>> <> <BEA-001112> <Test "select count(*) from DUAL" set up for pool "oraclePool" failed with exception: "java.sql.SQLException: No more data to read from socket".>
    ####<Dec 20, 2006 10:47:51 AM EET> <Error> <JDBC> <ep > <mfserver> <Thread-14> <<WLS Kernel>> <> <BEA-001131> <Received an exception when closing a cached statement for the pool "oraclePool": java.sql.SQLException: Io exception: Broken pipe.>
    These exception occures every hour after the connection pool is being closed and refreshed.
    Also there are a lot of the follwoing warnning in the log :
    <BEA-001074><A JDBC pool connection leak was detected.
    Does these two problems connected? What can we do in order to solve it?
    Thanks
    Edited by RF123 at 01/28/2007 3:41 AM

    R F wrote:
    Hi,
    I will appriciate your help with the following problem.
    We have the follwoing errors in the weblogic.log (We are using weblogic 8.1.0.2 and Oracle 9.2.0.3)
    ####<Dec 20, 2006 10:47:49 AM EET> <Info> <JDBC> <ep> <mfserver> <Thread-14> <<WLS Kernel>
    <> <BEA-001128> <Connection for pool "oraclePool" closed.>
    ####<Dec 20, 2006 10:47:49 AM EET> <Info> <JDBC> <ep > <mfserver> <Thread-14> <<WLS Kernel>
    <> <BEA-001067> <Connection for pool "oraclePool" refreshed.>
    ####<Dec 20, 2006 10:47:51 AM EET> <Error> <JDBC> <ep > <mfserver> <Thread-14> <<WLS Kernel>
    <> <BEA-001112> <Test "select count(*) from DUAL" set up for pool "oraclePool" failed with exception:
    "java.sql.SQLException: No more data to read from socket".>
    ####<Dec 20, 2006 10:47:51 AM EET> <Error> <JDBC> <ep > <mfserver> <Thread-14> <<WLS Kernel>
    <> <BEA-001131> <Received an exception when closing a cached statement for the pool "oraclePool":
    java.sql.SQLException: Io exception: Broken pipe.>
    These exception occures every hour after the connection pool is being closed and refreshed.
    Also there are a lot of the follwoing warnning in the log :
    <BEA-001074><A JDBC pool connection leak was detected.
    Does these two problems connected? What can we do in order to solve it?Hi. The problems are not directly related, but may have the same cause.
    Something is killing your DBMS connections out from under the driver.
    Do you have a firewall between WLS and the DBMS, or a flakey network?
    Contact BEA support to get the 8.1sp2 patch for getting meaningful
    connection leak traces (CR209251_81sp2.jar). When that patch is installed
    the leak messages should show a full stack trace of the application code
    where the connection was obtained. It is that application code that
    somehow failed to close the pool connection, causing a pool leak. I
    suspect that the application code got an unexpected exception, such as
    when/if the DBMS/network/firewall killed a connection. In this case I
    believe the application went through an exception-handling path that
    forgot to close the connection.
    Joe

  • Error report:No more data to read from socket  when compile package

    We are going to migrate db from oracle 10g to oracle 11g. But when compile a package which is fine on oracle 10g, an exception "Error report:No more data to read from socket" throws on sql developer and break the connection. We have researched the issue and found if modify some code on a cursor, the issue will not happen.
    code:
    PROCEDURE DELETE_MANU_INTERV_BORROWS(
    p_borrow_id IN NUMBER,
    p_asset_id IN NUMBER,
    p_nsb_coll_type IN VARCHAR2,
    p_nsb_coll_code IN VARCHAR2,
    p_branch_code IN VARCHAR2,
    p_settle_date IN NUMBER,
    p_trans_type IN VARCHAR2,
    p_status OUT VARCHAR2,
    p_shorts_cursor OUT SYS_REFCURSOR
    IS
    var_end_settle_date GEC_IM_ORDER.SETTLE_DATE%type;
    CURSOR exist_allocation IS
    SELECT out_a.ALLOCATION_ID FROM
    GEC_ALLOCATION out_a,
    GEC_BORROW b,
    GEC_IM_ORDER o,
    GEC_TRADE_COUNTRY gc,
    (SELECT f.FUND_CD, f.BRANCH_CD, tc.TRADE_COUNTRY_CD, NVL(gc.COLLATERAL_CURRENCY_CD, gbk.COLLATERAL_CURRENCY_CD) as COLLATERAL_CURRENCY_CD
    FROM GEC_FUND f
    LEFT JOIN GEC_G1_BOOKING gbk ON f.fund_cd = gbk.fund_cd AND gbk.TRANSACTION_CD = 'G1L' AND gbk.POS_TYPE = 'NSB'
    LEFT JOIN GEC_G1_COLLATERAL gc ON gc.G1_BOOKING_ID = gbk.G1_BOOKING_ID
    LEFT JOIN GEC_TRADE_COUNTRY tc ON gc.TRADE_COUNTRY_CD = tc.TRADE_COUNTRY_CD
    ) loan_info
    WHERE b.BORROW_ID = out_a.BORROW_ID AND
    out_a.IM_ORDER_ID = o.IM_ORDER_ID AND
    o.FUND_CD = loan_info.FUND_CD AND
    o.ASSET_ID = p_asset_id AND
    gc.TRADE_COUNTRY_CD = o.TRADE_COUNTRY_CD AND
    o.TRANSACTION_CD = p_trans_type AND
    loan_info.COLLATERAL_CURRENCY_CD = p_nsb_coll_code AND
    loan_info.BRANCH_CD = p_branch_code AND
    o.SETTLE_DATE >= p_settle_date AND
    o.SETTLE_DATE <= var_end_settle_date AND
    b.STATUS = GEC_CONSTANTS_PKG.C_BORROW_MANUAL
    ORDER BY out_a.ALLOCATION_ID ASC
    FOR UPDATE OF out_a.ALLOCATION_ID;
    If delete the "OF out_a.ALLOCATION_ID" of the for update clause of CURSOR exist_allocation, this prolbem will not happen, and the code is comple succesfully on sql developer for oracle 10g.
    Does anybody have any idea? I've googled the similer problems but still can't find a clue. I'll appreciate any help.

    Welcome to the forum!
    Please provide the 4 digit Oracle version (result of SELECT * FROM V$VERSION) for the source and target servers; 10g and 11g are not versions. You also mention sql developer so what is the exact version you are using?
    >
    If delete the "OF out_a.ALLOCATION_ID" of the for update clause of CURSOR exist_allocation, this prolbem will not happen, and the code is comple succesfully on sql developer for oracle 10g.
    >
    Please clarify what works and what doesn't work because your statements are both incorrect and misleading.
    You can't delete the "OF out_a.ALLOCATION_ID" of the for update clause or you would get a syntax error by leaving FOR UPDATE OF with nothing specified after it.
    Also you original statement said
    >
    But when compile a package which is fine on oracle 10g
    >
    But now you say that if you delete the "OF..." the problem doesn't happen and the code compiles on 10g.
    Does the original code compile on 10g or not? Does it compile on 11g or not? After the original code is migrated to 11g does it compile? That is, the code is there can you manually compile it?

  • BUG ? : No more data to read from socket

    I have a problem while using the CURSOR function in a xsql:query with a where clause and an order by :
    Example :
    My xsql file :
    <xsql:query connection="demo" xmlns:xsql="urn:oracle-xsql">
    select d.deptno as deptno, d.dname,
    CURSOR( select empno,ename
    from emp
    where deptno = d.deptno) as emps
    from dept d
    where deptno < 40
    order by d.deptno desc
    </xsql:query>
    And my obtained result is :
    <xsql-error code="17410" action="xsql:query" xsql-timing="2025">
    <statement>select d.deptno as deptno, d.dname, CURSOR( select empno,ename from emp where deptno = d.deptno) as emps from dept d where deptno < 40 order by d.deptno desc</statement>
    <message>No more data to read from socket</message>
    </xsql-error>

    This problem still exists in OWB 11g R2. I hit this same issue yesterday. Not sure why its claimed to be resolved

  • No more data to read from socket Exception -thin client

    my program is ..
    import java.sql.*;
    class OracleSQL
         OracleSQL()
         public static void connect2DB()
         try
              Class.forName("oracle.jdbc.driver.OracleDriver");
              Connection con=DriverManager.getConnection("jdbc:oracle:thin:@POOJAK:1521:PLSExtProc","System","pooja");
              if(con!=null)
                   Statement stmt=con.createStatement();
                   stmt.executeUpdate("insert into emp values('a',8,8)");
                   stmt.close();
                   con.close();
              else
                   System.out.println("NOT ok");
         catch(Exception e)
              e.printStackTrace();
         public static void main(String args[])
              OracleSQL osql=new OracleSQL();
              osql.connect2DB();
    following error on execution..
    java.sql.SQLException: No more data to read from socket
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
    :112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
    :146)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
    :208)
    at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1118)
    at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1070)
    at oracle.jdbc.driver.T4C8TTIpro.receive(T4C8TTIpro.java:131)
    at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:867)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:268)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:
    420)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
    at
    oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtensio
    n.java:35)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at OracleSQL.connect2DB(OracleSQL.java:15)
    at OracleSQL.main(OracleSQL.java:38)
    classpath
    C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar;C:\oraclexe\app\oracle\product\10.2.0\server\jlib\orai18n.jar ;C:\bea\weblogic81\server\lib\weblogic.jar;
    path
    C:\oraclexe\app\oracle\product\10.2.0\server\BIN;
    i m using jdk 1.5
    Plz state reason of error as i hv tried many alternatives but in vain.

    When you post code, please use[code] and [/code] tags as described in Formatting tips on the message entry page. It makes it much easier to read.
    Google:
    User StuDerby posted:
    Well, lot's of things could be causing this. Off the top of my head, in rough order of likelihood:
    1) firewall - personal, on your box, or general, around the database, is reaping long-lived connections
    2) connection wrappers on the database - ditto
    3) your pooler is configured to terminate connections that are checked out of the pool for too long and you're exceeding that time for some operations
    4) your database or it's listener is crashing out from under you (and possibly being auto-restarted by the time you look at it).

  • Error code: 17410: No more data to read from socket

    We have a strange issue.
    We have a stored procedure which we invoke using JDBC code. Calls to this stored procedure runs fine on 2 databases but fails on the 3rd one. If we run the stored procedure using SQL Plus, it works fine.
    SQLException being thrown is:
    java.sql.SQLException: No more data to read from socket
    Oracle database version is Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production in all three environments
    While debugging the issue we figure the order of Java code made a difference while invoking the stored procedure that did not initially work.
    Original Code:
    ArrayDescriptor desc = ArrayDescriptor.createDescriptor( "SCHOOLLISTTYPE", conn );
    StructDescriptor structdesc = StructDescriptor.createDescriptor( "SCHOOLCODEOBJ", conn );
    Object[] attributes1 = { new String( "00131700" ), new String( "00" ) };
    STRUCT empType1 = new STRUCT( structdesc, conn, attributes1 );
    Object[] attributes2 = { new String( "00115900" ), new String( "01" ) };
    STRUCT empType2 = new STRUCT( structdesc, conn, attributes2 );
    Object[] attributes3 = { new String( "03078200" ), new String( "00" ) };
    STRUCT empType3 = new STRUCT( structdesc, conn, attributes3 );
    Object[] arrayElements = { empType1, empType2, empType3 };
    ARRAY newArray = new ARRAY( desc, conn, arrayElements );
    CallableStatement ps = conn.prepareCall( "{call AWSchools.Names (?, ?, ?)}" );
    Throws the SQLException mentioned above.
    But if I change the code to:
    StructDescriptor structdesc = StructDescriptor.createDescriptor( "SCHOOLCODEOBJ", conn );
    Object[] attributes1 = { new String( "00131700" ), new String( "00" ) };
    STRUCT empType1 = new STRUCT( structdesc, conn, attributes1 );
    Object[] attributes2 = { new String( "00115900" ), new String( "01" ) };
    STRUCT empType2 = new STRUCT( structdesc, conn, attributes2 );
    Object[] attributes3 = { new String( "03078200" ), new String( "00" ) };
    STRUCT empType3 = new STRUCT( structdesc, conn, attributes3 );
    Object[] arrayElements = { empType1, empType2, empType3 };
    ArrayDescriptor desc = ArrayDescriptor.createDescriptor( "SCHOOLLISTTYPE", conn );
    ARRAY newArray = new ARRAY( desc, conn, arrayElements );
    CallableStatement ps = conn.prepareCall( "{call AWSchools.Names (?, ?, ?)}" );
    code works fine.
    This is strange as the ArrayDescriptor and StructDescriptor and independent objects till we invoke ARRAY newArray = new ARRAY( desc, conn, arrayElements );
    Why would creating the ArrayDescriptor after we have done with arrayElements and desc make a difference?
    And this happens only with one database server. The original code works fine in other 2 oracle database.
    We did search in many forums about the error "No more data to read from socket". Seems this is a dark error which does not have any convincing answers.
    Any help will be greatly appreciated.
    Thanks.

    enable gateway tracing by setting HS_FDS_TRCE_LEVEL=255 in your DG4MSQL configuration file. Then open a new SQL*Plus window and execute:
    select user from dual@<dg4msql db link>;
    A trace file is generated in the ORACLE_HOME/dg4msql/trace directory. Post its content.

  • Oracle SQLException: No more data to read from socket

    I am using JDBC connection pooling to read a large data set and after about an hour or so into the result set processing I get the exception stated blow on all the connections in the pool and the process dies.. What is causing this? How can I correct this?
    Oracle SQLException: No more data to read from socket
    (load.AbstractLoadDB 171 ) oracle.jdbc.driver.OracleResultSetImpl@19a37a::COMMON_2
    java.sql.SQLException: No more data to read from socket
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
    at oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:885)
    at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:994)
    at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:951)
    at oracle.jdbc.driver.T4C8TTILob.receiveReply(T4C8TTILob.java:775)
    at oracle.jdbc.driver.T4C8TTILob.getChunkSize(T4C8TTILob.java:292)
    at oracle.jdbc.driver.T4CConnection.getChunkSize(T4CConnection.java:2072)
    at oracle.sql.CLOB.getChunkSize(CLOB.java:476)
    I would really appreciate your help.
    Thanks
    M

    Well, lot's of things could be causing this. Off the top of my head, in rough order of likelihood:
    1) firewall - personal, on your box, or general, around the database, is reaping long-lived connections
    2) connection wrappers on the database - ditto
    3) your pooler is configured to terminate connections that are checked out of the pool for too long and you're exceeding that time for some operations
    4) your database or it's listener is crashing out from under you (and possibly being auto-restarted by the time you look at it).

  • Start writing socket.

    Hi.
    I want to start writing socket. Could you please help me that where should I start from?!
    And if you know a site that include video teaches, I'll thanks you if you tell me.

    Depending on the language you might try over here.
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=csharpgeneral%2Cvbgeneral%2Cvcgeneral&filter=alltypes&sort=lastpostdesc
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • Error reading/writing file "com.garageband.cs":`≤Ć». message

    Hey all! Don't know if anyone can help but I keep getting the message...
    " Error reading/writing file "com.garageband.cs":`≤Ć». " with a cancel button.
    If you click on it it does go away, but after a time playback starts skipping and stuff.
    Anyone help please?
    Thanks
    Righini

    first two things to try for “oddball” probs:
    http://www.bulletsandbones.com/GB/GBFAQ.html#oddballprobs
    (Let the page FULLY load. The link to your answer is at the top of your screen)

  • Error reading/writing file message when opening garageband and/or files

    I've been recently getting this message when I open garageband and files
    "Error reading/writing file\U201Ccom.apple.garageband.cs\U201D
    I've been in and repaired disk permissions and all that it says it is all fine, reinstall garageband and message still comes up, weird.
    not only is garageband being a nuisance, Mac OS X 10.6.2 is being a pain when shutting down telling me to restart the computer. This only happened since upgrading to 10.6. No one as yet knows this promble so I'm gonna have to ring apple and see what is going on here.
    and also my other problem is that mac doesn't seem as snappy anymore I noticed this before upgrading to 10.6 and made no difference when "cleanly" installing 10.6. I get a colour wheel popping up and i'm having to wait with simple tasks. iMac only 2 years old.

    i give up with this discussion forum no no one knows anything

  • No more data to read from socket only in 2nd and 3rd database

    Hi,
    I'm developing an application for a client with three independent login modes, each one with an independent database.
    I'm using the following products:
    Oracle 9i database (9.2.0.6.0)
    Oracle Content Management SDK 10g (9.0.4.0.0)
    Oracle Workflow (2.6.3.0.0)
    Oracle Application Server 10g (9.0.4.2.0)
    In development, I've these products installed in x86 machines with Windows 2000. I've no problems and no errors.
    In the client, I've the same products and versions but installed in a Solaris Machine and I've the following error ONLY when I use the second and the third login modes (not always, maybe only in 50% of the times I submit data in the application). In the first login mode I have no problems. The code for the different modes is essentially the same so I don't understand what is the problem. I don't have access to the client server so I can't make a debug.
    The error is:
    Caused by: java.sql.SQLException: No more data to read from socket
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:189)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:231)
         at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:985)
         at oracle.jdbc.ttc7.MAREngine.unmarshalUB1(MAREngine.java:746)
         at oracle.jdbc.ttc7.MAREngine.unmarshalSB1(MAREngine.java:705)
         at oracle.jdbc.ttc7.Oclose.receive(Oclose.java:105)
         at oracle.jdbc.ttc7.TTC7Protocol.close(TTC7Protocol.java:565)
         at oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:848)
         at oracle.jdbc.driver.OraclePreparedStatement.privateClose(OraclePreparedStatement.java:351)
         at oracle.jdbc.driver.OraclePreparedStatement.close(OraclePreparedStatement.java:285)
         at oracle.jdbc.driver.OracleCallableStatement.close(OracleCallableStatement.java:876)
         at oracle.jdbc.oracore.OracleTypeADT.initMetadata(OracleTypeADT.java:579)
         at oracle.jdbc.oracore.OracleTypeADT.init(OracleTypeADT.java:406)
         at oracle.sql.ArrayDescriptor.initPickler(ArrayDescriptor.java:1023)
         at oracle.sql.ArrayDescriptor.<init>(ArrayDescriptor.java:137)
         at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:102)
    I'm using oracle jdbc thin driver.
    As data source class I'm using jdbc.pool.OracleConnectionCacheImpl.
    Anyone have a clue what is happening?

    Have you resolved this? I am getting the same error, but after restarting my webserver and re-establishing my connection pools it works(for a while). I need to find the root.
    Thanks for any help,
    Mark

Maybe you are looking for

  • Can't sync Verizon V3 with computer

    Very frustrating. I finally found a phone I like, that takes the place of my long-lost Startac, and the iSync website specifically says it can sync addressbook and calendar with the V3. But not Verizon's, I guess. Verizon just brought out their V3. I

  • How to open a folder using Actionscript 3.0

    Hi, I have been trying for about a day to get this to work, but nothing seems to, so i'm finally going to ask. So far, code wise, i have this:      open_btn.addEventListener(MouseEvent.CLICK, OpenButtonHandler);      function OpenButtonHandler(event:

  • TC and Windows 7 RC1

    Just wondering if anyone has tried connecting to their Time Capsule (dual band) using Windows 7 RC1. I am having issues connecting. Any help would be great. Since it is only a RC neither Microsoft nor Apple has been able to help me.

  • Transfer iMovie 09 project to another Mac

    I have started a school video project on my Mac and want to transfer the project, including all of the source clips, to another person's Mac for them to complete the project. Any suggestions?

  • Infobus applet and temporary files

    Hi, I have made an infobus applet and deploy it with the OAS407. Now I have seen, that each time I load the applet from the OAS407 the applet create 15 files in my temp-folder with the prefix jar_cache (for example: jar_cache40989.tmp). There is no p