Problem while uploading Image to DataBase

Hi ,
i m getting exception while executing code below,
is there anything to configure the data base before uploading images onto the database....
Connection con=null;
try{
Class.forName("youroracledriver").newInstance();
con = DriverManager.getConnection("url");
PreparedStatement ps = con.prepareStatement("INSERT INTO pictures VALUES(?,?)");
File file=new File("F:/servletworkspace/insertingimage/bb.jpg");
FileInputStream fs = new FileInputStream(file);
ps.setInt(1,15);
ps.setBinaryStream(2,fs,(int)file.length());
int i = ps.executeUpdate();
if(i!=0){
out.println("image inserted successfully");
else{
out.println("problem in image insertion");
catch (Exception e){
System.out.println(e);
}

To connect to database if your need to register driver and then make connection. So instead of:
user8689318 wrote:
Class.forName("youroracledriver").newInstance();
con = DriverManager.getConnection("url");you should have (if you are connecting to oracle using oracle jdbc driver):
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
con = DriverManager.getConnection("jdbc:oracle:thin:@<your db listener ip>:<your db listener port>:<your db sid>", "<db user>", "<db user password");
plus in future if you getting exception, then you should post it as well

Similar Messages

  • I am facing a Problem with reading images from database

    Hi everybody..
    any help will be most appreciated, I am facing problem with reading images from database. I am pasting my code... 
                    string connect = "datasource = localhost; port = 3306; username = root; password = ;"; 
                    MySqlConnection conn = new MySqlConnection(connect); // creating connecting string
                    MySqlCommand sda = new MySqlCommand(@"select * from management.add_products ", conn); //creating query
                    MySqlDataReader reader; 
                    try
                        conn.Open(); // Opening Connection
                        reader = sda.ExecuteReader(); // Executing my Query..
                        while (reader.Read())
                            byte[] imgg = (byte[])(reader["Picture"]);
                            if (imgg == null)
                                pc1.Image = null;
                            else
                                MemoryStream mstream = new MemoryStream(imgg);
                                pc1.Image = System.Drawing.Image.FromStream(mstream);
    It says Parameter not Valid... i am reading all the images from database

    I agree with Viorel. You are getting the error because the format of the data is incorrect probably because the data was modify. It may not be the reading of the database the is incorrect, but the application that wrote the data into the database. You need
    to compare the imgg array data with the data before it was written to the database to see if the data matches.  I usually start by comparing the number of bytes which is easier to check then compare the actual to isolate which function is changing the
    byte count.
    An image is binary data.  The standard VS methods for reading and writing data (usually stream classes) default to ASCII encoding which will corrupt binary data.  The solution usually is to use UTF8 encoding instead of the default ascii encoding. 
    Ascii encoding with stream often aligns the data and adds extra null bytes to the end of the data which can produce these type errors.
    jdweng

  • Error while uploading images to SAP Mobile Documents from iPad application using ObjectiveCMIS.

    Hi,
    I am getting the error while uploading images to SAP Mobile Documents from custom iOS(iPad )application using ObjectiveCMIS library.
    My Custom method is as follows:
    - (void)createSalesOrderRouteMapImageInFolder:(NSString*)salesOrderRouteMapFolderId routeMapImageTitle:(NSString *)imageTitle routeMapContent:(NSData *)imageData
        NSInputStream *inputStream = [NSInputStream inputStreamWithData:imageData];
        NSMutableDictionary *properties = [NSMutableDictionary dictionary];
        [properties setObject:[NSString stringByAppendingFileExtension:imageTitle] forKey:@"cmis:name"];
        [properties setObject:@"cmis:document" forKey:@"cmis:objectTypeId"];
        [self.session createDocumentFromInputStream:inputStream
                                           mimeType:@"image/png"
                                         properties:properties
                                           inFolder:salesOrderRouteMapFolderId
                                      bytesExpected:[imageData length]
                                    completionBlock:^(NSString *objectId, NSError *error) {
                                        NSLog(@"Object id is %@",objectId);
                                        if(error == nil) {
                                            [inputStream close];
                                            NSLog(@"Uploading Sales order route map successfully.");
                                            [[NSNotificationCenter defaultCenter] postNotificationName:SaveOrderSuccessNotification object:nil];
                                        } else {
                                            [inputStream close];
                                            NSLog(@"Uploading sales order route map failed.");
                                            [[NSNotificationCenter defaultCenter] postNotificationName:SaveOrderFailedNotification object:error];
                                    } progressBlock:^(unsigned long long bytesUploaded, unsigned long long bytesTotal) {
                                        NSLog(@"uploading... (%llu/%llu)", bytesUploaded, bytesTotal);
    OBjectiveCMIS Method in which i am getting error during upload:
    - (void)sendAtomEntryXmlToLink:(NSString *)link
                 httpRequestMethod:(CMISHttpRequestMethod)httpRequestMethod
                        properties:(CMISProperties *)properties
                contentInputStream:(NSInputStream *)contentInputStream
                   contentMimeType:(NSString *)contentMimeType
                     bytesExpected:(unsigned long long)bytesExpected
                       cmisRequest:(CMISRequest*)request
                   completionBlock:(void (^)(CMISObjectData *objectData, NSError *error))completionBlock
                     progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
        // Validate param
        if (link == nil) {
            CMISLogError(@"Must provide link to send atom entry");
            if (completionBlock) {
                completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument detailedDescription:nil]);
            return;
        // generate start and end XML
        CMISAtomEntryWriter *writer = [[CMISAtomEntryWriter alloc] init];
        writer.cmisProperties = properties;
        writer.mimeType = contentMimeType;
        NSString *xmlStart = [writer xmlStartElement];
        NSString *xmlContentStart = [writer xmlContentStartElement];
        NSString *start = [NSString stringWithFormat:@"%@%@", xmlStart, xmlContentStart];
        NSData *startData = [NSMutableData dataWithData:[start dataUsingEncoding:NSUTF8StringEncoding]];
        NSString *xmlContentEnd = [writer xmlContentEndElement];
        NSString *xmlProperties = [writer xmlPropertiesElements];
        NSString *end = [NSString stringWithFormat:@"%@%@", xmlContentEnd, xmlProperties];
        NSData *endData = [end dataUsingEncoding:NSUTF8StringEncoding];
        // The underlying CMISHttpUploadRequest object generates the atom entry. The base64 encoded content is generated on
        // the fly to support very large files.
        [self.bindingSession.networkProvider invoke:[NSURL URLWithString:link]
                                         httpMethod:httpRequestMethod
                                            session:self.bindingSession
                                        inputStream:contentInputStream
                                            headers:[NSDictionary dictionaryWithObject:kCMISMediaTypeEntry forKey:@"Content-type"]
                                      bytesExpected:bytesExpected
                                        cmisRequest:request
                                          startData:startData
                                            endData:endData
                                  useBase64Encoding:YES
                                    completionBlock:^(CMISHttpResponse *response, NSError *error) {
                                        if (error) {
                                            CMISLogError(@"HTTP error when sending atom entry: %@", error.userInfo.description);
                                            if (completionBlock) {
                                                completionBlock(nil, error);
                                        } else if (response.statusCode == 200 || response.statusCode == 201 || response.statusCode == 204) {
                                            if (completionBlock) {
                                                NSError *parseError = nil;
                                                CMISAtomEntryParser *atomEntryParser = [[CMISAtomEntryParser alloc] initWithData:response.data];
                                                [atomEntryParser parseAndReturnError:&parseError];
                                                if (parseError == nil) {
                                                    completionBlock(atomEntryParser.objectData, nil);
                                                } else {
                                                    CMISLogError(@"Error while parsing response: %@", [parseError description]);
                                                    completionBlock(nil, [CMISErrors cmisError:parseError cmisErrorCode:kCMISErrorCodeRuntime]);
                                        } else {
                                            CMISLogError(@"Invalid http response status code when sending atom entry: %d", (int)response.statusCode);
                                            CMISLogError(@"Error content: %@", [[NSString alloc] initWithData:response.data encoding:NSUTF8StringEncoding]);
                                            if (completionBlock) {
                                                completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeRuntime
                                                                                     detailedDescription:[NSString stringWithFormat:@"Failed to send atom entry: http status code %li", (long)response.statusCode]]);
                                      progressBlock:progressBlock];
    Attaching the logs:
    ERROR [CMISAtomPubBaseService sendAtomEntryXmlToLink:httpRequestMethod:properties:contentInputStream:contentMimeType:bytesExpected:cmisRequest:completionBlock:progressBlock:] HTTP error when sending atom entry: Error Domain=org.apache.chemistry.objectivecmis Code=260 "Runtime Error" UserInfo=0x156acfa0 {NSLocalizedDescription=Runtime Error, NSLocalizedFailureReason=ASJ.ejb.005044 (Failed in component: sap.com/com.sap.mcm.server.nw) Exception raised from invocation of public void com.sap.mcm.server.service.AbstractChangeLogService.updateChangeLog(java.lang.String,boolean) throws com.sap.mcm.server.api.exception.MCMException method on bean instance com.sap.mcm.server.nw.service.NwChangeLogService@4e7989f3 for bean sap.com/com.sap.mcm.server.nw*annotation|com.sap.mcm.server.nw.ejb.jar*annotation|NwChangeLogService in application sap.com/com.sap.mcm.server.nw.; nested exception is: javax.ejb.EJBTransactionRolledbackException: ASJ.ejb.005044 (Failed in component: sap.com/com.sap.mcm.server.nw) Exception raised from invocation of public com.sap.mcm.server.model.ChangeLog com.sap.mcm.server.dao.impl.ChangeLogDaoImpl.findByUserId(java.lang.String) method on bean instance com.sap.mcm.server.dao.impl.ChangeLogDaoImpl@2852b733 for bean sap.com/com.sap.mcm.server.nw*annotation|com.sap.mcm.server.nw.ejb.jar*annotation|ChangeLogDaoImpl in application sap.com/com.sap.mcm.server.nw.; nested exception is: javax.persistence.NonUniqueResultException: More than 1 objects of type ChangeLog found with userId=25f8928e-8ba0-4edd-b08e-43bf6fb78f1a; nested exception is: javax.ejb.EJBException: ASJ.ejb.005044 (Failed in component: sap.com/com.sap.mcm.server.nw) Exception raised from invocation of public com.sap.mcm.server.model.ChangeLog com.sap.mcm.server.dao.impl.ChangeLogDaoImpl.findByUserId(java.lang.String) method on bean instance com.sap.mcm.server.dao.impl.ChangeLogDaoImpl@2852b733 for bean sap.com/com.sap.mcm.server.nw*annotation|com.sap.mcm.server.nw.ejb.jar*annotation|ChangeLogDaoImpl in application sap.com/com.sap.mcm.server.nw.; nested exception is: javax.persistence.NonUniqueResultException: More than 1 objects of type ChangeLog found with userId=25f8928e-8ba0-4edd-b08e-43bf6fb78f1a}
    2015-03-12 04:08:31.634 Saudi Ceramics[4867:351095] Uploading sales order route map failed.

    Hi Sukalyan,
    Have you checked the below links?
    These will give you step by step implementation procedure.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a099a3bd-17ef-2b10-e6ac-9c1ea42af0e9?quicklink=index&overridelayout=true
    http://wiki.sdn.sap.com/wiki/display/WDJava/KmuploadusingWebdynproapplication
    Regards,
    Sandip

  • Long text problem while uploading Inspection plan through BDC.

    Hi,
    I am facing some problem while uploading the inspection plan. There are few MICs for which we are having long text, while uploading the inspection plan through BDC - some other long text is getting copied into the MIC's long text. After checking I came to know that in function module, read_text - some text which is stored in ABAP memory is getting copied into the inspection plan.
    I am working in SAP release 4.7. I have checked with SAP notes: 97419, but it is also not satisfying.
    Waiting for quick solution.
    Thanks in advance.
    Fahié

    Hi a®s,
    Thanks a lot for your kind reply.
    My requirement is I want to maintain long text for few MICs (which are not having long texts at MIC level) in inspection plan (QP01).
    When I am trying to manually assign the MIC's to inspection plan (QP01), long text is copied whereas I am not clicking the long text icon in (QP01). Long text is not maintained in MIC level, still some long text is copied to this MIC. This was also happening while uploading the inspection plan thro' BDC.
    I believe what you have mentioned about function module SAVE_TEXT cannot be used here since long text is already copied before we pass the long text. Also if we pass some long text, still apart from the long text what we have passed there is some other long text copied (extra long text).
    Waiting for quick solution.
    Thanks in advance.
    Fahié

  • FileNotFoundException Uploading image to database

    Hello
    I'm trying to upload image to databases, in my server it works perfectly but when i run the application in the hosting appear FileNotFoundException.
    This is the part of html file than call to servlet.
    <FORM ACTION="http://hosting/servlet/lordcyb3r.Connect">
    <center><h4><b>Insert image</b></h4></center><BR><BR>
         Name:
    <input type="text" class="bginput" name="nombre" value="" size="40"/><BR>
    <input type="hidden" name="c" value=""/>
    <input type="file" class="bginput" name="image" size="40"/><BR>
    Comment:
    <input type="text" class="bginput" name="comentario" value="" size="60"/><BR>
    <INPUT TYPE="SUBMIT" VALUE="Insert">
    </FORM>
    This is the get method of Connect servlet
    protected void doGet(HttpServletRequest request,
                   HttpServletResponse response) throws ServletException, IOException {
              response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              String nombre = request.getParameter("nombre");
              String ruta = request.getParameter("image");
              String comentario = request.getParameter("comentario");
              try {
                   Class.forName("org.gjt.mm.mysql.Driver").newInstance();
                   Connection connection = DriverManager
                             .getConnection("jdbc:mysql://host/db?user=userid&password=psw");
                   PreparedStatement ps = connection
                             .prepareStatement("insert into imagedata values ( ?, ?, ?, ? )");
                   ps.setString(1, nombre);
                   ps.setString(2, ruta.substring(ruta.lastIndexOf("/") + 1));
                   ps.setString(3, ruta.substring(ruta.lastIndexOf(".") + 1));
                   ps.setString(4, comentario);
                   ps.execute();
                   ps = connection
                             .prepareStatement("insert into image values ( ?, ? )");
                   File file = new File(request.getParameter("image"));
                   InputStream is = new FileInputStream(file); // LINE 86 <--- HERE IS THE EXCEPTION
                   ps.setString(1, nombre);
                   ps.setBinaryStream(2, is, (int) file.length());
                   ps.execute();
                   is.close();
                   connection.close();
                   out.println("<br><br>Imagen insertada con �xito");
              } catch (InstantiationException e) {
                   out.println("<br><br>InstantiationException");
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (IllegalAccessException e) {
                   out.println("<br><br>IllegalAccessException");
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (ClassNotFoundException e) {
                   out.println("<br><br>ClassNotFoundException");
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (SQLException e1) {
                   out.println("<br><br>SQLException");
                   // TODO Auto-generated catch block
                   e1.printStackTrace();
    This is the StackTrace.
    java.io.FileNotFoundException: G-Natalia Duque.jpg (No such file or directory)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.<init>(FileInputStream.java:106)
         at lordcyb3r.Connect.doGet(Connect.java:86)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:95)
         at com.caucho.server.http.Invocation.service(Invocation.java:291)
         at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:339)
         at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:268)
         at com.caucho.server.TcpConnection.run(TcpConnection.java:136)
         at java.lang.Thread.run(Thread.java:602)
    Can you help me?
    I think so the method is searching the image in the server and no in the client.
    If is this, How can i do it works?
    Thanks for your help.

    to upload the file basic thump rule is the form type is multipart form data and method should be post.
    u have to use any upload component to upload the file from the client machine to the server and then u have to upload it to the database
    baiju

  • I have problems with uploading images to my printing company have the images have been manipulated through CS6 i have saved images as jpeg but the printer company tell me they are not j peg, they will not upload images save from a camera are fine

    I have problems with uploading images to my internet printing company when  the images have been manipulated through CS6 and  i have saved images as jpeg  the printer company tell me they are not j peg,
    but images saved from my phone or camera images that have not been manipulated upload fine, What am i doing wrong?

    Save/Export them as JPG. Photoshop defaults to PSD, so make sure you select JPG and not just rename the file to .jpg.
    There are two ways to save them as JPG: Regular Save as option or Save for Web & Devices
    Take your pick.

  • Problem while uploading bank details in Vendor Master - XK01

    Hello Experts,
    I am encountering a problem while uploading Vebndor Master Details in Quality server . The bank details for a given bank (Eg : BankABC and Bank Key IN) throws an error saying BANK IN BANKABC DOES NOT EXIST . But , with the same details i am able to upload in Sandbox and Development Servers. Pls suggest on the same.

    Hello again,
    Thank you for the inputs.
    Venkat,
    All the required fields are active. Please give some more input.
    Rob,
    Bank is supposed to be created during the upload. The bank details which already exists in the sytem are not throwing the error. Please give suggestions for this scenario.
    Regards,
    Trishna

  • Problems while accessing images outside the web document-root folder

    Our application runs on Oracle application server on Linux. Facing problems while accessing images outside the web document-root folder. This works with changes in global-web-application.xml by including the <virtual-directory> tag. The same change does not work when done on Linux machine. It is unable to find the image. Please help in resolving this issue.
    </locale-encoding-mapping>
    </locale-encoding-mapping-list>
    </web-app>
    <virtual-directory virtual-path="/img" real-path="/home/eposuat/" />
    </orion-web-app>
    Code in the jsp:
    <img width=700 height=700 src="/img/3.tif"></img>
    <img width=700 height=700 src="/img/WB.gif"></img>

    This is one of the least satisfactory aspects of site management in Dreamweaver, and several developers, including myself, have been pressuring the Dreamweaver team for some years to improve this. Who knows? They might eventually take notice.
    The only way to do this at the moment is to create two site definitions, one nested inside the other. Set up the site definition normally based on htdocs as your site root. Then create a new site definition based on site. Dreamweaver will nag you that it can cause problems, but it won't actually stop you from doing it. The only potential problem is with site synchronization.
    The problem with using site as the only basis for your site definition is that Dreamweaver automatically puts things like the Connections, Scripts, and other folders in the site root. So, everything ends up at the wrong level of the site hierarchy. Quite frankly, the whole thing is a bit of a pain. Dynamic site development was added to Dreamweaver only in version 6 (Dreamweaver MX), and no one had really thought through the need to store files outside the site root.

  • Problem while uploading data with GUI UPLOAD Function

    Hi,
      I am facing problem while uploading data with FM GUI UPLOAD    in out text file there are 7 row  but after the FM GUI UPLOAD  there are 14 entries are coming in Internal table   and each alternate row is coming as blank  with  0000 in some column   in internal table first row is proper and second line is blank so on.
    what can be the problem .
    The program in which we are using this we are using it from last 2 year but we are facing problem today only.
    regards,
      zafar

    Hi,
      The file formate is same as it is from last two years it is automatically generated by one another bar code server and there is no change  in the file formate.
      So waht can be the problem  to check any inconsistancy in system  i have develop a samll program fro  uploading a text file with same function module ,  but it is working fine.
    regards,
      zafar

  • Problems while uploading text documents into Unicode Database

    I just upgraded our database from 9iR1 to 9iR2 (9.2.0.1.0). The server
    character set is AL32UTF8. Now I'm facing a problem when
    uploading text documents into the database via a web frontend.
    I use the upload table defined for the PL/SQL Database Access Descriptor:
    create table TB_UPLOAD (
    NAME VARCHAR2(256) not null,
    MIME_TYPE VARCHAR2(128),
    DOC_SIZE NUMBER,
    DAD_CHARSET VARCHAR2(128),
    LAST_UPDATED DATE,
    CONTENT_TYPE VARCHAR2(128),
    BLOB_CONTENT BLOB);
    After uploading a text document containing the two words "hallo welt",
    the following statement returns not "hallo welt", but "68616C6C6F2077656C74":
    declare
    b_loc blob;
    v_amount integer := 100;
    v_buffer varchar2(100);
    v_offset integer := 1;
    begin
    select blob_content into b_loc from tb_upload where name like 'mydoc.txt';
    dbms_lob.read(b_loc, v_amount, v_offset, v_buffer);
    htp.prn(v_buffer);
    end;
    What is this? I studied the documentation, but didn't found a solution.
    When trying to use Oracle's built-in procedure wpg_docload.download_file,
    the content is shown the way it should be. Unfortunately, I can't use
    wpg_docload.download_file in order to copy the BLOB content to another table.
    Any hints would be appreciated!
    Thanks so much in advance!
    Roman
    E-Mail: [email protected]

    Hi Roman,
    the upload uses a BLOB (Binary Lob). Your Document is
    stored as is in the binary representation. If you
    use dbms_lob.read on a blob and your buffer is a varchar2 the binary representation is not translated!!!
    use a raw for the buffer and utl_raw.cast_to_varchar2
    to do the conversion to varchar.
    try this
    Procedure SHOW_DOC(p_name doc_test.name%TYPE)
    IS
    v_len number;
    v_mime_type tb_upload.mime_type%TYPE;
    v_offset integer := 1;
    v_Buf_size integer := 32767;
    v_buf raw(32767);
    v_blob blob;
    v_Doc_name varchar2(1000);
    BEGIN
    v_doc_name := url_Decode(p_name);
    select mime_type,doc_size,blob_content
    into v_mime_Type,v_len,v_blob
    from tb_upload
    where name = v_doc_name;
    OWA_UTIL.MIME_HEADER(v_Mime_Type);
    begin
    LOOP
    DBMS_LOB.READ(v_blob,v_buf_size,v_offset,v_buf);
    HTP.PRN(UTL_RAW.CAST_TO_VARCHAR2(v_buf));
    v_offset := v_offset + v_buf_size;
    END LOOP;
    exception
    when no_data_found then
    null;
    end;
    END;
    HTH
    detlev

  • Problems while uploading text documents into Database

    I just upgraded our database from 9iR1 to 9iR2 (9.2.0.1.0). The server
    character set is AL32UTF8. Now I'm facing a problem when
    uploading text documents into the database via a web frontend.
    I use the upload table defined for the PL/SQL Database Access Descriptor:
    create table TB_UPLOAD (
    NAME VARCHAR2(256) not null,
    MIME_TYPE VARCHAR2(128),
    DOC_SIZE NUMBER,
    DAD_CHARSET VARCHAR2(128),
    LAST_UPDATED DATE,
    CONTENT_TYPE VARCHAR2(128),
    BLOB_CONTENT BLOB);
    After uploading a text document containing the two words "hallo welt",
    the following statement returns not "hallo welt", but "68616C6C6F2077656C74":
    declare
    b_loc blob;
    v_amount integer := 100;
    v_buffer varchar2(100);
    v_offset integer := 1;
    begin
    select blob_content into b_loc from tb_upload where name like 'mydoc.txt';
    dbms_lob.read(b_loc, v_amount, v_offset, v_buffer);
    htp.prn(v_buffer);
    end;
    What is this? I studied the documentation, but didn't found a solution.
    When trying to use Oracle's built-in procedure wpg_docload.download_file,
    the content is shown the way it should be. Unfortunately, I can't use
    wpg_docload.download_file in order to copy the BLOB content to another table.
    Any hints would be appreciated!
    Thanks so much in advance!
    Roman
    E-Mail: [email protected]

    Hi Roman,
    the upload uses a BLOB (Binary Lob). Your Document is
    stored as is in the binary representation. If you
    use dbms_lob.read on a blob and your buffer is a varchar2 the binary representation is not translated!!!
    use a raw for the buffer and utl_raw.cast_to_varchar2
    to do the conversion to varchar.
    try this
    Procedure SHOW_DOC(p_name doc_test.name%TYPE)
    IS
    v_len number;
    v_mime_type tb_upload.mime_type%TYPE;
    v_offset integer := 1;
    v_Buf_size integer := 32767;
    v_buf raw(32767);
    v_blob blob;
    v_Doc_name varchar2(1000);
    BEGIN
    v_doc_name := url_Decode(p_name);
    select mime_type,doc_size,blob_content
    into v_mime_Type,v_len,v_blob
    from tb_upload
    where name = v_doc_name;
    OWA_UTIL.MIME_HEADER(v_Mime_Type);
    begin
    LOOP
    DBMS_LOB.READ(v_blob,v_buf_size,v_offset,v_buf);
    HTP.PRN(UTL_RAW.CAST_TO_VARCHAR2(v_buf));
    v_offset := v_offset + v_buf_size;
    END LOOP;
    exception
    when no_data_found then
    null;
    end;
    END;
    HTH
    detlev

  • Problem in uploading image greater than 500KB

    This is a servlet method which is being called by the doGet() or doPost() method. I have developed this code to store an image in sql server 2005. This code is working very fine with image size < 500 KB but when i try to upload a file of even 501 KB it gives me error listed below. What exactly is the problem and how can i overcome it?
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)             throws ServletException, IOException {         response.setContentType("text/html;charset=UTF-8");         PrintWriter out = response.getWriter();         Part p = request.getPart("file");                      //part of servlet API 3.0         out.println(p.getSize());//part of servlet API 3.0         InputStream in = (InputStream) p.getInputStream();//part of servlet API 3.0       //  byte[] b = new byte[(int)p.getSize()];//part of servlet API 3.0       //  in.read(b, 0, b.length);         Connection connection = null;         PreparedStatement stmt = null;         HttpSession session = request.getSession();         String username = (String) session.getAttribute("username"); //part of servlet         try {             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");             Properties properties = new Properties();             connection = DriverManager.getConnection("jdbc:odbc:sn", properties);             stmt = connection.prepareStatement("UPDATE Photos SET Photo = ? WHERE username = ?");             stmt.setBinaryStream(1, in,in.available());             stmt.setString(2, username);             int rows = stmt.executeUpdate();             if (rows > 0) {                 RequestDispatcher view = request.getRequestDispatcher("Home.jsp");                 view.forward(request, response);             }         } catch (ClassNotFoundException ex) {             out.println(ex);         } catch (SQLException ex) {             out.println(ex);         } finally {             in.close();             try {                 connection.close();                 stmt.close();             } catch (SQLException ex) {                 ex.printStackTrace();             }             out.close();         }     }
    The error message which i am receiving while uploading the image < 500 KB is
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]The text, ntext, or image pointer value conflicts with the column name specified.
    Please help me thanks in advance.

    can you tell me how to create connection object using Driver manager ??
    My server name is CHINMAY-E70358D and database name is SN
    i tried to create connection using
    Connection conn = DriverManager.getConnection("jdbc:jtds:sqlserver://localhost:1433/SN");But i got this exception
    java.sql.SQLException: I/O Error: SSO Failed: Native SSPI library not loaded. Check the java.library.path system property. i tried this code also
    Connection conn = DriverManager.getConnection("jdbc:jtds:sqlserver://CHINMAY-E70358D:1433/SN");but this also is giving me this error
    java.sql.SQLException: I/O Error: SSO Failed: Native SSPI library not loaded. Check the java.library.path system property. So how can i create the connection
    Edited by: Chinmay3108 on Sep 16, 2010 11:34 AM

  • Error while getting  image from database in SUP using ios?

    Hi All,
      Im developing native iOS application using sup 2.1.3 . Im getting error While retrieving  image from SUP database. Here i'm trying to get image from database and show in imageView.can any one help me how to fix this issue?
    In database image datatype is  'LONG Binary' .
    My table Schema:
    CREATE TABLE dba.ImagesTable (
    RowID INT NOT NULL,
    ImageName VARCHAR(20) NOT NULL,
    PhotoData LONG BINARY NOT NULL,
    IN SYSTEM
    ALTER TABLE dba.ImagesTable
      ADD CONSTRAINT ASA137 PRIMARY KEY CLUSTERED (RowID)
    ALTER TABLE dba.ImagesTable
      ADD CONSTRAINT ASA138 UNIQUE NONCLUSTERED (RowID)
    in Xcode:
                [SUP107SUP107DB synchronize];
                SUP107ImagesTable *imgTable =[[SUP107ImagesTable alloc]init];
                SUP107ImagesTableList *list =[SUP107ImagesTable findAll];
                SUP107ImagesTable * oneRecord =[list objectAtIndex:0];
                NSLog(@"rowId:%d---imageName:%@---photoData:%@---photoLenght:%d",oneRecord.rowID,oneRecord.imageName,oneRecord.photoData,oneRecord.photoDataLength);
                NSData *tempData =[[NSData alloc]init];
                SUPBigBinary *responseBinaryData = (SUPBigBinary *)oneRecord.photoData.value;
                @try {
                    [responseBinaryData openForWrite:[oneRecord.photoData length]];
                    [responseBinaryData write:tempData];
                @catch (NSException *exception) {
                    NSLog(@"exception: %@",[exception description]);
                UIImageView *imgView =[[UIImageView alloc] initWithFrame:CGRectMake(50,50,100,100)];
                [self.window addSubview:imgView];
                UIImage * tempImage =[UIImage imageWithData:tempData];
                imgView.image = tempImage;
                [responseBinaryData close];
    Error Log:
    2014-04-02 18:42:15.150 SUP102[2873:70b] rowId:1---imageName:Apple---photoData:SUPBigBinary: column=c pending=1 allow_pending_state=1 table=sup107_1_0_imagestable mbo=0x0 key=(null) ---photoLenght:90656
    Printing description of responseBinaryData:
    <OS_dispatch_data: data[0xc891b40] = { leaf, size = 90656, buf = 0x1213a000 }>
    2014-04-02 18:42:33.304 SUP102[2873:70b] -[OS_dispatch_data openForWrite:]: unrecognized selector sent to instance 0xc891b40
    2014-04-02 18:42:33.305 SUP102[2873:70b] exception: -[OS_dispatch_data openForWrite:]: unrecognized selector sent to instance 0xc891b40
    2014-04-02 18:42:33.305 SUP102[2873:70b] -[OS_dispatch_data close]: unrecognized selector sent to instance 0xc891b40
    2014-04-02 18:42:33.306 SUP102[2873:70b] [ERROR] [AppDelegate.m:497] NSInvalidArgumentException: -[OS_dispatch_data close]: unrecognized selector sent to instance 0xc891b40

    This thread talks about uploading image to SAP from a IOS device,Sending Image to SAP via iOS Native app (SUP 2.1.3)
    Midhun VP

  • Problem while uploading data from flat file

    hi friends,
    suppose if there are 100 records in flat file , if 20 records uploaded with out any problem and if error occurs while uploading remaing data . is necessary to upload entire data again or else only remaining data should be uploaded?
    i had used call transaction for purchase order application?
    please give me reply  soon its urgent
    thanks & regards
    priya

    Hi Hari,
    you have to upload the remaining data.
    as u have used CT method, do 1 thing trap the error data in runtime & prepare another flat file. next time correct the data in new flat file. & run the DBC program again with this new flat file.
    Reward if useful
    Regards
    ANUPAM

  • I was facing problem while connecting to oracle database.Can some one help me soon!!!!!

    Hi all,
    I was facing problem from last week.Suddenly i was getting ora-12505 error while connecting to the database through toad.I tried to change tnsnames.ora & listener.ora in multiple ways,but no luck...Inspite i was getting different errors like ora - 01034: ORACLE not available / ora - 27101: shared memory realm does not exist...When i try to connect using sys / sys as sysdba,connection is establishing and when issue the command startup it was throwing the error ORA-01821: date format not recognized......Fed up solving these issues....Can some one help me out...It's very very urgent..
    Thanks in advance,
    pavankumar.

    Well, the obviously solution is to use separate Apple ID's for iCloud.

Maybe you are looking for

  • Can i have more than one apple id?

    can i have more than one apple id listed to a single email acount?

  • How many fonts are free prvoide from Adobe?

    Dear Sir/Miss:   I want to know how many fonts users can free download the fonts? Cause someone tell me, if you install Adobe reader, you can use their fonts for free !? and your system also will install these fonts?

  • How to import photos from external hard drive and exclude duplicate images

    Hi, I apologize if this is easy, but I can't seem to find out how to do it. I have an external hard drive that I used to back up my photos when I was in the Windows environment. I want to import these into iPhoto and/or Aperture, but how do I exclude

  • Force "Require password" option

    Just curious if there is a way to not allow the user to change the "Require password" option (Security Prefs/General) in Lion (10.7.3). If I make the user managed by the server I could disable the pane, but I'd rather than do that in this case. Any w

  • Launching CRM_IC Transaction

    Hi I am trying to launch the CRM_IC transaction and am getting the page cannot be displayed. The web address it is trying to open is pasted below. I do have the following settings IE 6.0 Java 1.4.2 server address sapserver.dns in the host file on the