HTTP Server read available socket data?

I am trying to read data from my http client, and it appears that nothing is available at the time i call input.available() UNLESS I sleep for 100ms before I grab the data. This is a really bad hack, is there a better way to do this??
        // create a byte array to hold input
        thePanelThread.sleep(100);
        byte[] data = new byte [ input.available() ];
        socket.getInputStream().read( data );

You know how many bytes are read, there is no need to guess it:
public int read(byte[] b)
         throws IOException
    Reads some number of bytes from the input stream and stores them into the buffer array b.
The number of bytes actually read is returned as an integer.
This method blocks until input data is available, end of file is detected, or an exception is thrown.
*/

Similar Messages

  • HTTP Server High Availability

    Hello All.
    I have a question regarding OC4J and HTTP server High Availability.
    I want to do something like the Figure 3-1 of the Oracle Application Server High Availability Guide 10.1.2. See this link
    http://download-east.oracle.com/docs/cd/B14099_11/core.1012/b14003/midtierdesc.htm#CIHCEDFC
    What I have now is the following:
    Three hosts
    Two of them are an OAS 10.1.2 which we already configured the Cluster and deployed our applications (used this tutorial: http://www.oracle.com/technology/obe/obe_as_1012/j2ee/deploy/j2eecluster/farmcluster.htm)
    Let's say this nodes are:
    - host1
    - host2
    The other one is the Oracle WebCache stand alone (will act as Load Balancer). We will call this
    - hostwc3
    We already configured the WebCache as Load Balancer and is working just fine. We also configured the session replication successful and work great with our applications.
    What we have not clear is the following:
    When a client try to visit http://hostwc3/application/ the LOAD BALANCER routes him to, let's say http://host1/application/ and in the browser's URL will not show the Virtual Server anymore (the webcache server) and will show the actual real Apache address (host1 )that is attending him. IF we "kill" on ENTIRE host1 (apache, oc4j, etc..) the clients WILL perceive the down and if they try to press F5, the will try to access to an Apache that doesn't is up and running.... The behavior expected is that the browser NEVER shows the actual Apache URL, so, when some apache goes down, the client do not disconnect (as it happens with and OC4J downfall ) and always works with the "virtual web server".
    I came up with some ideas but I want you Guys to give me an advice:
    - In Web Cache, do not route for load balancing to Apache, and route the Oc4J directly (Is this possible?)
    - Configure a HTTP Server Cluster, this means that we have to have a "Virtual Name"to the Apaches (two of them). Is this possible? how?
    - Use the rewrite mode of the Apache. Is this a good idea?
    - Any other idea how to fix the Apache "Single Point Of Failure" ?
    According with the figure 3-1 ( Link above ) we do can have HTTP Server in a cluster. But I have no idea how to manage it or configure it.
    Thanks in advance any help!

    You cannot point Outlook Anywhere to your DAG cluster IP address. It must be pointed to the actual IP address of either server.
    For no extra cost DNS round robin is the best you will get, but it does have some drawbacks as it may give the IP address of a server you have taken down for maintenance or the server has an issue.
    You could look to implement a load balancer but again if you are doing this for high availability then you want more than one load balancer in the cluster - otherwise you've just moved your single point of failure.
    Having your existing NAT and just remembering to update it to point to the other server during maintenance may suit your needs for now.
    If you can go into more detail about what the high availability your business is looking to achieve and the budget we can suggest the best method to meet those needs for the price point.
    Have a great day
    Oliver
    Oliver Moazzezi | Exchange MVP, MCSA:M, MCITP:Exchange 2010,Exchange 2013, BA (Hons) Anim | http://www.exchange2010.com | http://www.cobweb.com | http://twitter.com/OliverMoazzezi

  • Choosing an HTTP Server

    I have been reading the Oracle Database Installation Guide 11g Release 1 (11.1) for Linux. On pg 4-13 it has the heading "Choosing an HTTP Server". Within that section it talks about the Embedded PL/SQL Gateway and Oracle HTTP Server. I'm not seeing anything that helps me to choose an HTTP Server.
    What criteria should I consider? Any suggestions?
    Thanks,
    Gregory

    OK, I have decided to try the Oracle HTTP Server. Now, where can I find it? I have downloaded the Installation file linux.x64_11gR1_database.zip rather than getting the CDs from Oracle. However, according to the installation guide "Starting with Oracle Database 11g, Oracle HTTP Server is available on a separate media shipped with Oracle database. In the previous releases, this product was available as a Companion CD component."
    From the Oracle Download site I have selected linux.x64_11gR1_examples.zip, which is listed as "Oracle Database 11g Examples (formerly Companion)" since I couldn't see anything that clearly indicated which download might have the HTTP Server on it. When I ran the installer that came with that download, there is no mention of the HTTP Server.
    Is the HTTP Server available in a download? Where should I get the HTTP Server from?
    Thanks,
    Gregory

  • Problme in http server configuration with different database version

    I have two instances of oracle databases on two different machines.
    1. Oracle 9i R 2 with default http server
    2. Oracle 10 g with http server of Oracle 10 g AS.
    Now the problem is that when i want to cross configure the http servers that is to configure http server of 9i R 2 data base with the 10g data base or vice versa. It give the following error.
    Can not run. Capacity probem.................
    Plz tell me that is there any pronle in these configuration. Is it possible to configure 9i http server with 10 g data base and vice versa If yes then why I am getting errors???

    The entries of the log file are as under:
    Tue Aug 07 05:00:29 2007] [error] [client 10.8.7.33] [ecid: 1186444829:10.8.7.33:1968:7060:109,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p
    [Tue Aug 07 05:05:29 2007] [error] [client 10.8.7.33] [ecid: 1186445129:10.8.7.33:1968:7016:114,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p
    [Tue Aug 07 05:10:29 2007] [error] [client 10.8.7.33] [ecid: 1186445429:10.8.7.33:1968:7528:90,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p
    [Tue Aug 07 05:15:29 2007] [error] [client 10.8.7.33] [ecid: 1186445729:10.8.7.33:1968:5872:128,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p
    [Tue Aug 07 05:20:29 2007] [error] [client 10.8.7.33] [ecid: 1186446029:10.8.7.33:1968:2468:95,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p
    [Tue Aug 07 05:25:29 2007] [error] [client 10.8.7.33] [ecid: 1186446329:10.8.7.33:1968:7236:136,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p
    [Tue Aug 07 05:30:29 2007] [error] [client 10.8.7.33] [ecid: 1186446629:10.8.7.33:1968:536:116,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p
    [Tue Aug 07 05:35:29 2007] [error] [client 10.8.7.33] [ecid: 1186446929:10.8.7.33:1968:3556:108,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p
    [Tue Aug 07 05:40:29 2007] [error] [client 10.8.7.33] [ecid: 1186447229:10.8.7.33:1968:6920:132,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p
    [Tue Aug 07 05:45:29 2007] [error] [client 10.8.7.33] [ecid: 1186447529:10.8.7.33:1968:7536:119,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p
    [Tue Aug 07 05:50:29 2007] [error] [client 10.8.7.33] [ecid: 1186447829:10.8.7.33:1968:5108:76,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p
    [Tue Aug 07 05:55:29 2007] [error] [client 10.8.7.33] [ecid: 1186448129:10.8.7.33:1968:668:121,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p
    [Tue Aug 07 06:00:29 2007] [error] [client 10.8.7.33] [ecid: 1186448429:10.8.7.33:1968:6640:129,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p
    [Tue Aug 07 06:05:29 2007] [error] [client 10.8.7.33] [ecid: 1186448729:10.8.7.33:1968:7324:123,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p
    [Tue Aug 07 06:10:29 2007] [error] [client 10.8.7.33] [ecid: 1186449029:10.8.7.33:1968:2168:81,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p
    [Tue Aug 07 06:15:29 2007] [error] [client 10.8.7.33] [ecid: 1186449329:10.8.7.33:1968:2320:166,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p
    [Tue Aug 07 06:20:29 2007] [error] [client 10.8.7.33] [ecid: 1186449629:10.8.7.33:1968:7320:114,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p
    [Tue Aug 07 06:25:29 2007] [error] [client 10.8.7.33] [ecid: 1186449929:10.8.7.33:1968:7528:96,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p
    [Tue Aug 07 06:30:29 2007] [error] [client 10.8.7.33] [ecid: 1186450229:10.8.7.33:1968:7580:124,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p
    [Tue Aug 07 06:35:29 2007] [error] [client 10.8.7.33] [ecid: 1186450529:10.8.7.33:1968:668:124,0] File does not exist: c:/oraas/apache/apache/htdocs/pls/orasso/htp.p

  • HTTP Server is red

    installed TREX 7... & connected to EP7... but now the http server in trex monitor is red...
    iis is working...

    https://www.sdn.sap.com/irj/sdn/thread?threadID=71527&tstart=0
    Here i will refer trex system installation dir as D:\usr\sap\trex_<instance no>.
    1. Create Web Service extensions
    Add a new extension name – TrexHttpServer
    Required files  -
    add - D:\usr\sap\trex_<instance no>\WebServer\TREXISAPIExt.dll
    Set extension status to allowed
    2. Create Application Pool - appPool_TREX_<trex instance number>
    3. create website - SAP_TREX_<trex instance no>
             path - D:\usr\sap\trex_<instance no>
             application name - none
             application pool - DefaultAppPool
    4. Create a virtual Directory - "TREXHttpServer"
            path - D:\usr\sap\trex_<instance no>\webserver
            application name - TREXHttpServer
            Execute permissions - Scripts and Executables
            Application Pool - ApplPool_TREX_<instance no>   
    5. Right click on D:\usr\sap\trex_<instance no> and Choose Properties --> Security.
    Add TREX user with full control and IUSR_hostname with read and execute permissions.
    6. Open the TREX configuration file TREXWebServer.ini in D:\usr\sap\trex_<instance no> and change
    the URL to <http://><trexserver>:<port>/TrexHttpServer/TREXISAPIExt.dll>
    7. Open Dos prompt and execute command “iisreset”. THIS IS THE LINE
    8.Stop and start the Trex Server.
    9.Execute the url "http://<trexserver>:<port>/TrexHttpServer/TREXISAPIExt.dll?CMD=PING"
    in browser and you should see "OK Server Connection".
    10. Open Trex administration and you should see green light besides https server.

  • Separate Media -vs- Companion CD - Oracle HTTP Server for 11g

    I am finally upgrading to Oracle 11g. We have been using HTML-DB for a couple of years. In the Oracle Database Installation Guide 11g it says "Starting with Oracle Database 11g, Oracle HTTP Server is available on a separate media shipped with Oracle Database. In previous releases, this product was available as a Companion CD component."
    What's the difference between "separate media shipped with Oracle Database" and a "Companion CD"? Wouldn't something that is shipped with something else be a companion?
    Cheers,
    Gregory

    What's the difference between "separate media shipped with Oracle Database" and a "Companion CD"?
    The Companion CD was used for material that wouldn't fit on the base CD and which might be optional or unnecessary for many customers. The packaging was labeled with the term "Companion CD" using the English language proper-noun-as-adjective capitalization convention.
    Wouldn't something that is shipped with something else be a companion?
    Sure, but the suggested semantic relationship between the ad hoc notation "Companion" and companionship neither excludes accompanying or adjunct materials that do not have this designation from the "companion" category nor does it situate all "companion" material as members of the "Companion" category. If Oracle had labeled the CD as the "Overflow CD" the difference in connotation would have been slight but would not lead me to conflate such supplemental offerings with certain household plumbing mishaps.
    Scott

  • ISQL*Plus - Oracle HTTP Server

    Hi!
    I have downloaded iSQL*Plus. I want to know whether Oracle HTTP Server is available with Oracle8.1.6
    Thank you!
    Suki

    No, ORACLE HTTP Server not a part of 8.1.6
    you need to install 8.1.7 to be able to run iSQL*Plus
    Thanks,
    Andrei

  • Reading the binary data from a http request received via socket connection.

    1. I require to extract the binary data out of a http multipart request,
    2. I have a server socket opened up, which can receive connections over tcp( and therefore http.)
    3. I will require to read the stream, find out the "request boundary identifier", and then extract the different "request body parts".
    4. From there i need to read all of the binary content and put it in a file.
    5. I did some implementation to his effect. but i see that the file that i had uploaded initially if its not a text file, gets corrupted.
    can you please let me know why is that happening, and a probable solution approach.
    please find below the class (with a main method) I have been using to expose a server socket.
    package self.services;
    import java.io.BufferedReader;
    import java.io.ByteArrayOutputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.io.PrintWriter;
    import java.net.ServerSocket;
    import java.net.Socket;
    public class FileServer {
         public static void main(String[] args) throws Exception {
              ServerSocket serverSocket = new ServerSocket(9999);
              String FOLDER_NAME = "uploaded_files";
              while(true) {     
                   try{
                        Socket socket = serverSocket.accept();
                        InputStream is = socket.getInputStream();
                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
                        BufferedReader reader = new BufferedReader(new InputStreamReader(is));
                        String currentLine;
                        int cnt = 0;
                        boolean postRequest = false;
                        String dataBoundary = null;
                        String fileName = null;
                        String yourName = null;
                        while((currentLine = reader.readLine()) != null) {
                             if(currentLine.contains("POST")) {
                                  postRequest = true;
                                  System.out.println("POST REQ AS EXPECTED VERY NICE");
                                  continue;
                             if(!postRequest) {
                                  System.out.println("NO POST REQ THIS BREAKING FLOW");
                                  break;
                             } else {
                                  if(currentLine.contains("Content-Type: multipart/form-data; boundary=")) {
                                       System.out.println("found a boundary value header");
                                       dataBoundary = currentLine.substring((currentLine.indexOf("boundary=") + "boundary=".length()), (currentLine.length() -1));
                                       System.out.println("boundary value = ".concat(dataBoundary));
                                       continue;
                                  if(dataBoundary != null && currentLine.contains(dataBoundary)) {
                                       cnt++;
                                  if(cnt == 1) {
                                       //move 3 lines
                                       if(currentLine.contains("Content-Disposition: form-data; name=\"yourName\"")){
                                            reader.readLine();//skip a line
                                       System.out.println("Your name = ".concat(yourName = reader.readLine()));
                                       continue;
                                  } else if(cnt == 2) {
                                       if(currentLine.contains("Content-Disposition: form-data; name=\"sentFile\"; filename=\"")){
                                            fileName = currentLine.substring(currentLine.indexOf("filename=") + "filename=".length() + 1, currentLine.length() - 1);
                                            System.out.println("File Name = ".concat(fileName));
                                            reader.readLine();//skip a line , this would depict a content type header
                                            reader.readLine();//skip a line, this would indicate a blank line to mark the start of data.
                                            continue;
                                       } else {
                                            // write the content to os
                                            if(currentLine != null && !currentLine.contains(dataBoundary)) {
                                                 baos.write(currentLine.concat("\r").getBytes());
                                  } else if( cnt == 3) {
                                       System.out.println(("cnt [" + cnt).concat( "], current line [").concat(currentLine).concat("]"));
                                       break;
                        if(fileName == null ||yourName == null) {
                             System.out.println("FileServer.main() dont bother about this" );
                        } else {
                             //send a response back
                             PrintWriter pw = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()));
                             pw.write(responseMessage(yourName, fileName));
                             pw.flush();
                             //close output stream
                             pw.close();
                             //handle the request bytearray.
                             FileOutputStream fos = new FileOutputStream(FOLDER_NAME + "/" + fileName);
                             fos.write(baos.toByteArray(), 0, baos.toByteArray().length - 1);
                             fos.close();
                        //close input stream
                        reader.close();
                        socket.close();
                        baos.close();
                   } catch(Exception ex) {
                        ex.printStackTrace();
         public static String responseMessage(String yourName, String fileName) {
              String response =
                   "<HTML>" .concat(
                   "<BODY>") .concat(
                   "<P>" ).concat(
                   "Mr. <FONT color=\"red\">") .concat( yourName).concat("</FONT>. Your file named <B>").concat( fileName).concat( "</B> successfully reached us." ).concat(
                   "</P>") .concat(
                   "</BODY>").concat(
                   "</HTML>");
              return response;
    }{code}
    Here is a sample html file which can be used to send multipart requests to the java service.
    <html>
         <body>
              <form action="http://localhost:9999" enctype="multipart/form-data" method="POST">
                   Enter name :<br/>
                   <input type="text" name="yourName"/>
                   Enter file :<br/>
                   <input type="file" name="sentFile"/>
                   <br/>
                   <input type="submit" value="Submit"/>
              </form>
         </body>
    </html>
    *Both the form elements are mandatory*
    *I hope my requirement is clear. Any help regarding this will be highly appreciated.*
    Regards.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    MishraC wrote:
    1. I require to extract the binary data out of a http multipart request,
    2. I have a server socket opened up, which can receive connections over tcp( and therefore http.)
    3. I will require to read the stream, find out the "request boundary identifier", and then extract the different "request body parts".
    4. From there i need to read all of the binary content and put it in a file.
    5. I did some implementation to his effect. but
    i see that the file that i had uploaded initially if its not a text file, gets corrupted.
    can you please let me know why is that happening,Because you are using a Reader (which translates bytes to chars according to the charset encoding specified).
    and a probable solution approach. Use a BufferedInputStream.

  • Oracle 8i on NT: No more data to read from socket

    I'm using the thin JDBC to connect to Oracle 8i on NT. when i
    try to connect i get this exception:
    java.sql.SQLException: No more data to read from socket
    at oracle.jdbc.dbaccess.DBError.check_error
    (DBError.java:659)
    at oracle.jdbc.ttc7.MAREngine.unmarshalUB1(Compiled Code)
    at oracle.jdbc.ttc7.MAREngine.unmarshalSB1
    (MAREngine.java:687)
    at oracle.jdbc.ttc7.TTIpro.receive(TTIpro.java:134)
    at oracle.jdbc.ttc7.v8TTIpro.receive(v8TTIpro.java:93)
    at oracle.jdbc.ttc7.TTC7Protocol.connect
    (TTC7Protocol.java:1100)
    at oracle.jdbc.ttc7.TTC7Protocol.logon
    (TTC7Protocol.java:179)
    at oracle.jdbc.driver.OracleConnection.<init>
    (OracleConnection.java:142)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance
    (OracleDriver.java:214)
    at oracle.jdbc.driver.OracleDriver.connect
    (OracleDriver.java:193)
    at java.sql.DriverManager.getConnection(Compiled Code)
    at java.sql.DriverManager.getConnection
    (DriverManager.java:137)
    at org.apache.turbine.util.db.DBOracle.getConnection
    (DBOracle.java:82)
    at
    org.apache.turbine.util.db.ConnectionPool.getNewConnection
    (ConnectionPool.java:161)
    at
    org.apache.turbine.util.db.ConnectionPool.getConnection
    (ConnectionPool.java:139)
    at org.apache.turbine.util.db.DBBroker.getConnection
    (DBBroker.java:162)
    at org.apache.turbine.util.db.DBBroker.getConnection
    (DBBroker.java:119)
    at org.apache.turbine.util.db.BasePeer.initTableSchema
    (BasePeer.java:179)
    at org.apache.turbine.util.TurbineUserPeer.<clinit>
    (TurbineUserPeer.java:140)
    at
    org.apache.turbine.util.TurbineUser.retrieveFromStorage
    (TurbineUser.java:310)
    at org.apache.turbine.actions.LoginUser.build
    (LoginUser.java:103)
    at org.apache.turbine.modules.ActionLoader.exec
    (ActionLoader.java:115)
    at Turbine.doGet(Compiled Code)
    at Turbine.doPost(Turbine.java:356)
    at javax.servlet.http.HttpServlet.service
    (HttpServlet.java:521)
    at javax.servlet.http.HttpServlet.service
    (HttpServlet.java:588)
    at org.apache.jserv.JServConnection.processRequest
    (JServConnection.java)
    at org.apache.jserv.JServConnection.run
    (JServConnection.java)
    at java.lang.Thread.run(Thread.java:479)
    any one know how to fix this problem???
    -ScottTavares-
    null

    Scott C. Tavares (guest) wrote:
    : I'm using the thin JDBC to connect to Oracle 8i on NT. when i
    : try to connect i get this exception:
    : java.sql.SQLException: No more data to read from socket
    : at oracle.jdbc.dbaccess.DBError.check_error
    : (DBError.java:659)
    : at oracle.jdbc.ttc7.MAREngine.unmarshalUB1(Compiled Code)
    : at oracle.jdbc.ttc7.MAREngine.unmarshalSB1
    : (MAREngine.java:687)
    : at oracle.jdbc.ttc7.TTIpro.receive(TTIpro.java:134)
    : at oracle.jdbc.ttc7.v8TTIpro.receive(v8TTIpro.java:93)
    : at oracle.jdbc.ttc7.TTC7Protocol.connect
    : (TTC7Protocol.java:1100)
    : at oracle.jdbc.ttc7.TTC7Protocol.logon
    : (TTC7Protocol.java:179)
    : at oracle.jdbc.driver.OracleConnection.<init>
    : (OracleConnection.java:142)
    : at oracle.jdbc.driver.OracleDriver.getConnectionInstance
    : (OracleDriver.java:214)
    : at oracle.jdbc.driver.OracleDriver.connect
    : (OracleDriver.java:193)
    : at java.sql.DriverManager.getConnection(Compiled Code)
    : at java.sql.DriverManager.getConnection
    : (DriverManager.java:137)
    : at org.apache.turbine.util.db.DBOracle.getConnection
    : (DBOracle.java:82)
    : at
    : org.apache.turbine.util.db.ConnectionPool.getNewConnection
    : (ConnectionPool.java:161)
    : at
    : org.apache.turbine.util.db.ConnectionPool.getConnection
    : (ConnectionPool.java:139)
    : at org.apache.turbine.util.db.DBBroker.getConnection
    : (DBBroker.java:162)
    : at org.apache.turbine.util.db.DBBroker.getConnection
    : (DBBroker.java:119)
    : at org.apache.turbine.util.db.BasePeer.initTableSchema
    : (BasePeer.java:179)
    : at org.apache.turbine.util.TurbineUserPeer.<clinit>
    : (TurbineUserPeer.java:140)
    : at
    : org.apache.turbine.util.TurbineUser.retrieveFromStorage
    : (TurbineUser.java:310)
    : at org.apache.turbine.actions.LoginUser.build
    : (LoginUser.java:103)
    : at org.apache.turbine.modules.ActionLoader.exec
    : (ActionLoader.java:115)
    : at Turbine.doGet(Compiled Code)
    : at Turbine.doPost(Turbine.java:356)
    : at javax.servlet.http.HttpServlet.service
    : (HttpServlet.java:521)
    : at javax.servlet.http.HttpServlet.service
    : (HttpServlet.java:588)
    : at org.apache.jserv.JServConnection.processRequest
    : (JServConnection.java)
    : at org.apache.jserv.JServConnection.run
    : (JServConnection.java)
    : at java.lang.Thread.run(Thread.java:479)
    : any one know how to fix this problem???
    : -ScottTavares-
    scott --
    which jdbc versionare you using ??
    if not the 816sdk -- try it ...
    make sure you match up with the jdk version ...
    note: jdk 1.2 functionality is not in any of the orcl drivers
    yet.
    check out for this faq (3rd question -- i think) for more details
    on jdk 1.2 support :
    http://technet.oracle.com/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm
    in general -- this occurs due to several different conditions :
    verify that the connections string is correct :
    for thin -- the hostid:port:sid must match the listener you're
    trying to connect with -- and a tcp/ip connection on the server
    ust exist.
    for oci driver make sure the "tnsname" entry being specified
    exists and has the same information in its "entry" correct (i.e.
    matches the listener values)
    also make sure the listener and the orcl instance are started.
    also make sure you're using jdk 1.1.x with 8.1.5 or lower
    drivers.
    816sdk can be used with jdk 1.1 or 1.2 if you are using the
    correct jdbc driver version from otn to match the jdk version.
    only jdk 1.1.x functionality is available in the jdk 1.2 driver
    at this time.
    also make sure you're using a thin driver if in an applet.
    thin or oci in a servlet is ok if properly set up.
    without more info --
    i can't tell which of these "setup or condition" issues applies
    to your situation ...
    always provide :
    jdk details,
    applet vs. application vs. servlet,
    jdbc driver version number and type(thin/oci)
    also server version in all cases and if oci driver is being
    used -- the oracle client version,
    it's always better to provide too much detail with java
    issues than just an error message ...
    i hope this helps ...
    null

  • Socket communication with HTTP server : how to send a form variable ?

    Hi everyone,
    I'm trying to program a Socket application that calls a CGI programmed in ASP and sends a variable with some content via the POST HTTP method.
    My problem is that I'm unable to retrieve my variable content in the CGI. I don't know what I'm doing wrong when sending my variable. Here are the main steps of my application
    [Client side]
    - Create an URL
    - Open a connection
    - Send header info with variable name and content via POST method
    - Read server response
    [Server side]
    - Request the variable
    - Store its content in a file
    Here's the code of my class :
    import java.net.*;
    import java.io.*;
    public class SocketTest{
         public static void main(String args[]){
                 //create the URL
              URL url = null;
              String strURL = "http://192.168.1.11/htmleditor/cgi.asp";
              try{
                   url = new URL(strURL);
              catch(MalformedURLException exc){
                   System.out.println("Invalid URL : " + strURL);
                    //create a socket
              Socket socket = null;
              try{
                   int port = url.getPort();
                   if (port < 0){
                        port = 80;
                   socket = new Socket(url.getHost(), port);
              catch(Exception exc){
                   exc.printStackTrace();
              OutputStream out = null;
              InputStream in = null;
              try{
                   //configure request
                   String data = "htm_content=toto";
                   String request =      "POST "+ url + " HTTP/1.0\r\n" +
                                         "Accept: */*\r\n" +
                                         "Content-length: " + String.valueOf(data.length()) + "\r\n" +
                                         "Host: JAVA_HOST\r\n" +
                                         "User-Agent: Generic\r\n\r\n" +
                                         "htm_content=toto";
                   //send request
                   out = socket.getOutputStream();
                   out.write(request.getBytes());
                   out.flush();
                   //read server response
                   in = socket.getInputStream();
                   int bufferSize = 1024;
                   byte responseBytes[] = new byte[bufferSize];
                   while ((bufferSize = in.read(responseBytes)) > 0){
                        System.out.print(new String(responseBytes, 0,bufferSize));
              catch(IOException exc){
                   System.out.println(exc);
              //Close streams and sockets
              try{
                   in.close();
              catch(IOException exc){
                   exc.printStackTrace();
              try{
                   out.close();
              catch(IOException exc){
                   exc.printStackTrace();
              try{
                   socket.close();
              catch(IOException exc){
                   exc.printStackTrace();
    }Here's the code of my ASP CGI page (called cgi.asp) :
    //CGI.ASP - Begin
    <%
         Option Explicit
         Dim objFso, objFile, strHtmContent, strFileName
         On Error Resume Next
         Set objFso  = Nothing
         Set objFile = Nothing
         Set objFso  = Server.CreateObject("Scripting.FileSystemObject")
         strFileName = Server.MapPath("htm_content.htm")
         Set objFile = objFso.CreateTextFile(strFileName, True)
         strHtmContent = Request("htm_content")
            If len(strHtmContent) > 0 Then
           objFile.Write strHTMContent
            Else
              objFile.Write "NO CONTENT RECEIVED"
            End If
    %>
    <html>
    <head>
    <script language="javascript">
      function closeAll()
        window.close();
        return 0;
    </script>
    <body onLoad="javascript:closeAll();">
    </body>
    </html>
    //CGI.ASP - ENDWhen I execute my SocketTest app I get this output:
    F:\JavaDev\htmleditor\docs>java SocketTest
    HTTP/1.1 200 OK
    Server: Microsoft-IIS/5.0
    Date: Fri, 12 Jul 2002 15:31:56 GMT
    Connection: Keep-Alive
    Content-Length: 192
    Content-Type: text/html
    Set-Cookie: ASPSESSIONIDQQGGGKMU=MMPPMLEDGDEMCCJDBGOKMNDC; path=/
    Cache-control: private
    <html>
    <head>
    <script language="javascript">
    function fermerTout()
    window.close();
    return 0;
    </script>
    <body onLoad="javascript:fermerTout();">
    </body>
    </html>
    The file "htm_content.htm" is created but it has this content :
    NO CONTENT RECEIVED
    This means the server was unable to retrieve the content of the variable called "htm_content"
    REM : the variable is called like this 'cause I intend to use it to send HTML content
    Any idea of what I'm doing wrong ?
    Thanxs in advance for any help,
    Diego TERCERO

    For the POST request you'll only need (with HTTP 1.0)
         String request =      "POST "+ url + " HTTP/1.0\n" +
              "Content-type: application/x-www-form-urlencoded\n" +
              "Content-Length: " + String.valueOf(data.length()) + "\n" +
              "\n" +
              data;
    Note the Content-type header.
    Fred (Donne les duke�)

  • Sequence error: No more data to read from socket

    We are getting the following error when inserting data into the center table. What does this error mean? We noticed if we take sequencing off the second table we do not get the error. ARe triggers for sequence are as follows.
    begin
    select db.insequence.nextval into :new.id from dual;
    end;
    begin
    select db.centerseq.nextval into :new.id from dual;
    end;
    Thanks in advance.

    Narsimha (guest) wrote:
    : I am getting the following error:
    : "No more data to read from Socket"
    : I am using Oracle 8.0.3 + Jdk 1.1.5 + JDBC Driver 7.3.3.1.3
    : Follwing is my simple program. I got struck here.
    : <<< Please provide me the solution. >>>
    : import java.sql.*;
    : class JDBCTest{
    : public static void main (String args []) throws SQLException,
    : ClassNotFoundException{
    : Class.forName ("oracle.jdbc.driver.OracleDriver");
    : Connection conn =DriverManager.getConnection
    : ("jdbc:oracle:thin:@myHost:1521:orcl","scott", "tiger");
    : Statement stmt = conn.createStatement ();
    : ResultSet rset = stmt.executeQuery ("select * from
    FDMainList");
    : while (rset.next ())
    : System.out.println (rset.getString (1));
    I have the same problem with thin jdbc driver against 8.0.3
    server.
    Try to use oci8 driver - You have to install sql*net8 client
    first. It works for me.
    Looking at:
    http://technet.oracle.com/tech/java/access/info/jdbc_faq.htm#_1_
    I think no thin driver supports 8.0.3 unfortunately.
    null

  • Cursed "No more data to read from socket"

    I too received the "No more data to read from socket" when connecting to Oracle8iE v8.1.5 via JDBC. The Oracle server was running on RedHat 6.1, and I've attempted to access it with an NT client using JDBC version 8.1.6. After receiving that error, I tried using version 8.1.5 of the jdbc driver but got the same results. So, I tried using the old 8.0.5 drivers and they worked! The problem is, that 8.0.5 does not seem to support large objects (CLOBS)properly.
    I ended up installing the Oracle server on NT. The most recent JDBC drivers worked fine with this configuration, and things seemed to work ok. So it doesn't seem that the Linux flavor of Oracle has all the support of the NT/Solaris as far as JDBC goes.

    This is usually a problem with the SQL*Net listener on the server. You might want to check and see if there are any patches available for the linux version of the RDBMS...

  • No more data to read from socket UTF instance problem

    I'm using oracle jdbc thin driver and SunOne Application Server 7 environment.
    I'm trying to call the stored procedure which has one IN parameter that is of type CLOB.
    My code looks like this:
    conn = DriverManager.getConnection (url, username, password);
    conn.setAutoCommit(false);
    clob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION);
    Writer wr = clob.getCharacterOutputStream();
    wr.write(m_data);
    wr.flush();
    wr.close();
         PreparedStatement pstmt = conn.prepareCall(procedureCall);
    pstmt.setClob(1, clob);
         pstmt.execute();
    but when I run it, it throws this (at wr.write(m_data) statement):
    [29/Jan/2003:15:07:25] WARNING ( 9340): CORE3283: stderr: java.io.IOException: No more data to read from socket
    [29/Jan/2003:15:07:25] WARNING ( 9340): CORE3283: stderr: at oracle.jdbc.dbaccess.DBError.SQLToIOException(DBError.java:716)
    [29/Jan/2003:15:07:25] WARNING ( 9340): CORE3283: stderr: at oracle.jdbc.driver.OracleClobWriter.flushBuffer(OracleClobWriter.java:270)
    [29/Jan/2003:15:07:25] WARNING ( 9340): CORE3283: stderr: at oracle.jdbc.driver.OracleClobWriter.write(OracleClobWriter.java:172)
    [29/Jan/2003:15:07:25] WARNING ( 9340): CORE3283: stderr: at java.io.Writer.write(Writer.java:150)
    [29/Jan/2003:15:07:25] WARNING ( 9340): CORE3283: stderr: at java.io.Writer.write(Writer.java:126)
    I tried using this instead of Writer:
    clob.putString(1, m_data);
    but the same error occurs.
    I then tried to do both of these:
    InputStream reader = new StringBufferInputStream(m_data);
    PreparedStatement pstmt = conn.prepareCall(procedureCall);
    pstmt.setUnicodeStream(1, reader, reader.available());
    Reader reader = new StringReader(m_data);
         PreparedStatement pstmt = conn.prepareCall(procedureCall);
    pstmt.setCharacterStream(1, reader, m_data.length());
    but in both cases I got this (at pstmt.setCharacterStream() or pstmt.setUnicodeStream()):
    [29/Jan/2003:16:06:00] WARNING ( 9340): CORE3283: stderr: java.sql.SQLException: Data size bigger than max size for this type: 76716
    [29/Jan/2003:16:06:00] WARNING ( 9340): CORE3283: stderr: at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    [29/Jan/2003:16:06:00] WARNING ( 9340): CORE3283: stderr: at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
    [29/Jan/2003:16:06:00] WARNING ( 9340): CORE3283: stderr: at oracle.jdbc.ttc7.TTCItem.setArrayData(TTCItem.java:95)
    [29/Jan/2003:16:06:00] WARNING ( 9340): CORE3283: stderr: at oracle.jdbc.dbaccess.DBDataSetImpl.setBytesBindItem(DBDataSetImpl.java:2414)
    [29/Jan/2003:16:06:00] WARNING ( 9340): CORE3283: stderr: at oracle.jdbc.driver.OraclePreparedStatement.setItem(OraclePreparedStatement.java:1134)
    [29/Jan/2003:16:06:00] WARNING ( 9340): CORE3283: stderr: at oracle.jdbc.driver.OraclePreparedStatement.setUnicodeStream(OraclePreparedStatement.java:2633)
    But, the greatest mistery of all is that code with temporary CLOB works fine when I create instance and use default settings. Problem occurs when I create instance with UTF coding scheme. But we are forced to use Unicode coding scheme, because of local special characters.
    We are using Oracle 9i on Solaris UNIX platform and jdbc drivers supplied with it.
    The CLOB I am trying to pass is a XML file and it is possible to be up to 400 KB in size.
    Please help. I'm at my wit's end!

    Hi,
    I have a similar problem . This is the code that I used. Can u please help me
    oracle.sql.CLOB newClob = oracle.sql.CLOB.createTemporary(((org.apache.commons.dbcp.PoolableConnection) con).getDelegate() , true, oracle.sql.CLOB.DURATION_SESSION);
              newClob.open(oracle.sql.CLOB.MODE_READWRITE);
              Writer wr = newClob.getCharacterOutputStream();
              wr.write(valuesXml);
              wr.flush();
              wr.close();
              //newClob.putString(1,valuesXml);
              pst.setClob(1,newClob);
    These are the versions that I use
    java version is 1.4.2_06
    and it is a Liunx OS - gij (GNU libgcj) version 3.2.3 20030502 (Red Hat Linux 3.2.3-49)
    the Oracle version is 9.2.0.4.0
    The exception I see is
    java.io.IOException: No more data to read from socket
         at oracle.jdbc.dbaccess.DBError.SQLToIOException(DBError.java:716)
         at oracle.jdbc.driver.OracleClobWriter.flushBuffer(OracleClobWriter.java:270)
         at oracle.jdbc.driver.OracleClobWriter.flush(OracleClobWriter.java:204)

  • Test failed no more data to read from socket

    hi,
    When tried to connect the database via SQL developer getting
    test failed no more data to read from socket
    i have created the database via script and i added manually entries in listener.ora file and in tnsnames.ora with the SID
    followed the steps
    lsnrctl stop
    lsnrctl start
    lsnrctl reload
    lsnrctl status
    where as i am able to connect via command prompt
    Os Version:Win 2003
    DB Version :11G 11.0.2.0
    Followed DB creation from below link
    http://www.orafaq.com/node/2015
    Thanks!

    listener.ora
    SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (SID_NAME = orcl)
          (ORACLE_HOME = E:\app\username\product\11.2.0\dbhome_1)
          (PROGRAM = extproc)
          (ENVS = "EXTPROC_DLLS=ONLY:E:\app\username\product\11.2.0\dbhome_1\bin\oraclr11.dll")
        (SID_DESC =
          (SID_NAME = ORA11g)
          (ORACLE_HOME = E:\app\username\product\11.2.0\dbhome_1)
          (PROGRAM = extproc)
          (ENVS = "EXTPROC_DLLS=ONLY:E:\app\username\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
          (ADDRESS = (PROTOCOL = TCP)(HOST =localhost)(PORT = 1522))
      )tnsnames.ora
    # tnsnames.ora Network Configuration File: C:\oracle\tnsnames.ora
    # Generated by Oracle configuration tools.
    ORA11G =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST =localhost)(PORT = 1522))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = ORA11G)
    ORCL =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = orcl)
      )

  • 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