Helo:

I work with a Sun Muchine, Solaris 7. I have a tomcat-Apache configuration. The 
problem is that when reboot the computer, Apache starts automatically, but I have to 
run Tomcat manually.

Anyone knows a way to fix this?

Thanks,

Julia
-----Mensaje original-----
De: Vikramjit Singh [mailto:[EMAIL PROTECTED]]
Enviado el: lunes, 10 de junio de 2002 12:47
Para: [EMAIL PROTECTED]
Asunto: Re: Inserting and Reading byte array with BLOB field in Oracle


hi,

you have set your byte array to length of 10. instead assign the byte array
the length of the blob, like this

// Create a byte array for storing.
byte[] buf = new byte[(int)myblob.length()];

This wont leave the values which cannot fit into your byte array.

you can try fetching your blob field like this


if (rs.next()) {
       try {
          System.out.println("Retrieving Data");
          OutputStream out = new BufferedOutputStream(
            new FileOutputStream("Data.1"));
          InputStream in = new BufferedInputStream(
            rs.getBinaryStream(1));
          byte[] buf = new byte[65536];
          int i;
          while((i = in.read(buf, 0, buf.length)) != -1) {
            out.write(buf, 0, i);
            count += i;
          }
          out.close();
        } catch(IOException ex) { ex.printStackTrace(); }
      }


If does not work, ask again.

Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031


-----Original Message-----
From: Support, Cockpit (CAP, Contractor)
[mailto:[EMAIL PROTECTED]]
Sent: Monday, June 10, 2002 2:50 AM
To: [EMAIL PROTECTED]
Subject: Inserting and Reading byte array with BLOB field in Oracle


Hi All,
This is a page I coded to put a byte stream and read byte stream using blob
field.
Though it did not give any error it is not function.
While reading it does not read the blob field properly.
I do also know whether it has been inserted into the table.
Can somebody help me !!!

============================================================================
======
<%@ page import="java.sql.*,DBConnect.*,oracle.sql.*" %>
<jsp:useBean id="dbConnBean" class="DBConnect.DBConnectBean" scope="page"/>

<%
Connection jdbcConn;
Statement stmt;
ResultSet rs;
oracle.sql.BLOB myblob;
try {
 jdbcConn = dbConnBean.makeConnection();
 stmt = jdbcConn.createStatement();

 //Writing data into a blob field
 byte[] data = {0,1,2,3,4,5,6,7};
 rs = stmt.executeQuery("select blob_col from lob_table");
 if(rs.next()) {
  myblob = (BLOB)rs.getObject("blob_col");
  java.io.OutputStream outstream = ((BLOB)myblob).getBinaryOutputStream();
  outstream.write(data);
  out.println("Data written successfully<br>");
  for(int i = 0;i < data.length;i++) {
   out.println(data[i]+"<br>");
  }
 }
 rs.close();

 //Reading data from a blob field
 byte[] mydata = new byte[10];
 rs = stmt.executeQuery("select blob_col from lob_table");
 if(rs.next()) {
  myblob = (BLOB)rs.getObject("blob_col");
  java.io.InputStream instream = myblob.getBinaryStream();
  int bytes_read = instream.read(mydata);
  out.println(bytes_read+"Data read successfully<br>");
  for(int i = 0;i < mydata.length;i++) {
   out.println(mydata[i]+"<br>");
  }
 }
 rs.close();

 stmt.close();
 jdbcConn.close();
}
catch(Exception e) {
 out.println(e);
}
%>
============================================================================
======

Thanks,
Srinivasan



"THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE
ADDRESSEE and may contain confidential and privileged information.
If the reader of this message is not the intended recipient,
you are notified that any dissemination, distribution or copy of this
communication is strictly Prohibited.
If you have received this message by error, please notify us
immediately, return the original mail to the sender and delete the
message from your system."

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com


-----------------------------------------------------------------
Este correo electr�nico y, en su caso, cualquier fichero anexo al mismo, contiene 
informaci�n de car�cter confidencial exclusivamente dirigida a su destinatario o 
destinatarios. Queda prohibida su divulgaci�n, copia o distribuci�n a terceros sin la 
previa autorizaci�n escrita de Indra. En el caso de haber recibido este correo 
electr�nico por error, se ruega notificar inmediatamente esta circunstancia mediante 
reenv�o a la direcci�n electr�nica del remitente.
-----------------------------------------------------------------
The information in this e-mail and in any attachments is confidential and solely for 
the attention and use of the named addressee(s). You are hereby notified that any 
dissemination, distribution or copy of this communication is prohibited without the 
prior written consent of Indra. If you have received this communication in error, 
please, notify the sender by reply e-mail.
-----------------------------------------------------------------

==========================================================================To 
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to