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

Similar Messages

  • Edge Animate CC 2014 issue with SVG - Images greater than 1024 x 1024

    Hi, since i updated my Edge Animate CC for Edge Animate CC 2014 i have issues when i import .svg files. Edge told me "Images greater than 1024 may cause unexpected behavior on mobile device" when i import .svg files smaller than 1024 x 1024 ?
    When i publish my animation i have a weird things happening and my image scaling default is 10% instead of 100% when i import. Someone had this issue ? Something we can do ? My images a less then 1024 x 1024 and work perfectly in Edge Animate CC 2.0

    Ok. I've solved. I needed to load some things:
    EC.Parallax.setup (sym);
    The full code (that works for me) is:
    -- compositionReady:
    EC.Parallax.setup(sym);
    // Load Edge Commons
    yepnope({
    load: [
    "http://cdn.edgecommons.org/an/1.1.0/js/min/EdgeCommons.js",
    // Load style sheet for the overlay
    "http://cdn.edgecommons.org/an/1.1.0/css/style.css"
    -- click
    // Open image in spotlight overlay
    // Set up configuration
    var config = {
    width: "1024",
    height: "768",
    type: "image",
    source: "images/dog.jpg"
    EC.Spotlight.open( config );
    I hope to serve others.
    Regards

  • 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 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

  • Restricting users from uploading files greater than certain size in Kpro

    Hi,
    How can we restric users from uploading files in SAPoffice which are greater than certain size (5MB)?
    Awaiting for reply.

    Hello Gino,
    you go to Tcode DC10, in the define document type,
    there is a option file size, this gives you restriction , only if you are not using KPro and content server.
    If you are using Kpro and content server, then please do the enhancement (SE80, package ,CV)
    With the help of this you can restrict and put the warinig message if your original size is exceed.
    Thanks & Regards,
    nitin
    Award point if useful

  • Restricting users froms uploading files greater than certain size in km.

    Hi,
           How can we restric users to upload files in KM which are greater than certain size (5MB)?Awaiting for reply.

    Hi,
       It is out of standard you must develop your own upload command (SAP Developer Studio).
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/kmc/knowledge management and collaboration developers guide.html
    Patricio.

  • Problem with uploading images in interMedia

    Hi,
    I'm a newbie trying to upload images to the Database (Oracle 10g release 2) using interMedia. I created a test table called hmm:
    create table hmm(product_id number, product_photo blob);
    Then I tried to insert the image into the table :
    SQL> insert into hmm (product_id, product_photo) values
    (3003,ORDImage.init('FILE','MEDIA_DIR','mvd.jpg'));
    and I got the following error :
    insert into hmm (product_id, product_photo) values (3003,ORDImage.init('FILE','MEDIA_DIR','mvd.jpg'))
    ERROR at line 1:
    ORA-00932: inconsistent datatypes: expected BLOB got ORDSYS.ORDIMAGE
    Can somebody explain.
    Thanks,
    Steve

    Hi Steve,
    Yes, you created your table with a 'blob' type:
    create table hmm(product_id number, product_photo blob);
    But your insert assumes the product_photo column is an ORDImage type:
    SQL> insert into hmm (product_id, product_photo) values
    (3003,ORDImage.init('FILE','MEDIA_DIR','mvd.jpg'));
    The error: "ORA-00932: inconsistent datatypes: expected BLOB got ORDSYS.ORDIMAGE" is telling you it expected a BLOB in your insert because your table was created with a BLOB type.
    If you change your table creation to this it should work:
    create table hmm(product_id number, product_photo ORDSYS.ORDIMAGE);
    You might want to take a look at the interMedia Image Quick Start on Oracle Technology Network. It should get you up and running quickly. You can find it here:
    http://www.oracle.com/technology/products/intermedia/htdocs/intermedia_quickstart/intermedia_quickstart.html
    Good luck,
    Sue

  • New MacMini.....Any problem with hard drive greater than 500gb?

    I'm interested in buying a new MacMini. I could definitely use a hard drive larger than 500gb though. Is there any problem installing a drive larger than 500gb? Since the Mac store only offers 320 and 500gb, I'm wondering if there is some limitation (special size?) or other problem.
    I'd rather not have to use an additional external drive.
    Thanks in advance.
    Fabian

    Hi Fabian,
    any 2.5" SATA harddisk with a maximum height of 9.5mm fits in the Mac Mini.
    OSX doesn't "care" about the amount of GB the harddisk has.
    With the above specs 750GB seems to be the largest widely avaiable size but 1TB should be avaiable too.
    Have a look at MacSales or NewEgg.
    Regards
    Stefan

  • Problem in uploading images.

    Hi,
    I have developed mobile game.I have coded the program along with logos and images.But I can't able to know where I have to upload that images and logos.I have created classes for new game ,main menu,multiplayer,sound,credits,levels,Instructions.But I can't know where I have to put the images and splash screen images.Please help me out.
    Thanks in advance.

    in the root of your project.

  • File Upload greater than 30 MB

    How can i restrict the user to upload file greater than 30Mb.I can restrict by using "maxUploadSize" of commons-fileupload but the issue is that it raises exception only after the whole file gets uploaded.
    Can we restrict before this?
    Thanks in advance
    CSJakharia

    elOpalo wrote:
    How about:request.getContentLength()?
    Is it also available after the whole request is sent?That's the whole problem; everything stated in this thread works after the request has already been generated, thus the entire file is already in there. Hence my suggestion to limit the maximum request size to prevent too much data from being uploaded.

  • Upload image in Dynamic Region

    Hello.
    Excuse me. my English is not very good.
    I use Jdeveloper 11.1.1.3.0
    in my application i have 2 Bounded Task Flow and i use them as a dynamic region.
    in each bounded task flow i use InputFile component to upload image. but i can't upload image, because when i click the Browse button and select the image, then i click another button in my application to upload image, but the InputFile component value reset . I don't know why this happen.
    this problem just happen in dynamic region, in another case I don't have any problem with upload image.
    Thanks.

    Habib,
    Welcome to OTN.
    As you said you are using taskflows as region, can you check the refresh condition of the region binding in the pagedef and see if that has anything to do with this?
    -Arun

  • Error in VL01N(Delivery qty is greater than target qty while taking return)

    Hi Experts,
    I am facing a problem "Delivery Quantity is greater than the target quantity" while doing the inbound delivery from VL01N t-code for sales returns with reference to return order.
    I am trying to do the inbound delivery for the same Quantity which is in return order but still it is showing error.
    I have checked my configuration and could not find any mistake under this process. I am not able to identify the error. In my delivery item category we have put "B" under over delivery check which is our business requirement.
    If I remove "B" from delivery item category, i am not getting any error in inbound delivery but which is not right way of doing.
    I could not find suitable query in SDN. Can any one please share your expertise to solve this problem?
    Thanks in advance,
    Regards
    Srinivas

    You have to check the following:-
    a)  whether for that return delivery, picking is not activated
    b)  whether customer master or material master is maintained for over delivery tolerance
    c)  whether in VD51, any overdelivery tolerance is maintained
    You can also have a look at the following notes:-
    1)  Note 151901 - Check of delivery quantity is consistent
    2)  Note 322588 - VLSP:incor.checks for qty to be delvrd during split
    thanks
    G. Lakshmipathi

  • Problem in uploading PDF file greater than 450Kb in portals

    Hi All,
            There is aproblem when we upload a PDF file of size greater than 450 KB in portals,it shows some error.
    Do i need to change any server settings for this or any other configuration is required.
    Help will be appreciated
    Thanks in Advance

    Hi Amit,
    Pls check the thread below:
    /message/1634863#1634863 [original link is broken]
    Hope this helps.
    Regards,
    venkat

  • Problem using email to upload image files to Mobile Me gallery

    I will cross post this question to both Mail and Mobile Me discussion groups because I don't know where my problem lies.
    I have published a gallery page from iPhoto to my Mobile Me gallery. There are two ways to upload additional photos. I am not having trouble adding image files with the Upload feature. I cannot get the email function to work. The emails I send to the email address for the gallery bounce back to my mail inbox.
    Subject: Delivery Notification: Delivery has failed
    and in the body of the bounced email:
    Recipient address: [email protected]
    Reason: SMTP transmission failure has occurred
    Diagnostic code: smtp;521 5.2.1 Fatal failure of WOA
    Remote system: dns;post.mac.com (TCP|10.150.69.91|51195|10.13.19.27|25) (mbin002.mac.com ESMTP [2.3.3/gso-r197-19Feb2007] ready to rumble)
    Original-envelope-id: [email protected]
    Reporting-MTA: dns;asmtp028-bge351000 (tcp-daemon)
    Original-recipient: rfc822;[email protected]
    Final-recipient: rfc822;[email protected]
    Action: failed
    Status: 5.2.1 (SMTP transmission failure has occurred)
    Remote-MTA: dns;post.mac.com (TCP|10.150.69.91|51195|10.13.19.27|25)
    (mbin002.mac.com ESMTP [2.3.3/gso-r197-19Feb2007] ready to rumble)
    Diagnostic-code: smtp;521 5.2.1 Fatal failure of WOA
    One of the images I am trying to attach is a jpeg file of 61 kb.
    I have tried to drag the image from my desktop to the body of the email. I have tried using the "attach" function and selecting the file name. I am not sending any text with these files.
    When I built these albums, I checked and enabled all the options.
    I am having this same issue when I try to upload via email to any of my Mobile Me gallery pages.
    There is currently one photo displayed here:
    http://gallery.me.com/tplattenberger#100352
    If anyone wishes to try to upload to that gallery using email (Send to Album) that would be great and if successful, that might provide a clue to my problem.
    As I say, I currently have one photo there. If you find a lot more, please do not add.
    What's the problem?
    Tom

    The images I am trying are newly created and old.
    A weird hint perhaps...
    I just copied an image from Apple's home page and pasted it into the email and tried again...
    it worked.
    So I tried again, dragging from iPhoto and it did not work... the email bounced back.
    So I tried again, this time using copy and paste (like I did from Apple's page) from iPhoto... it did not work.
    Tom

  • Since installing LION having problems getting photo images to upload?

    since installing LION having problems getting photo images to upload? anyone else havie this problem? I did finally get a message that the format was wrong, but I have changed nothing on my camera. Only change was the installing of LION.

    This is from the Kodak site which says there is no Lion compatible driver/software yet, but it is coming in late August:
    http://support.en.kodak.com/app/answers/detail/a_id/41646/kw/os%20x%20lion/selec ted/true
    If you don't want to wait there is always this kind of device for less than $10 (I don't own or endorse it):
    http://www.walmart.com/ip/Moultrie-USB-2.0-SD-Card-Reader/14972138

Maybe you are looking for

  • OracleBamAdapter: "Bad response: 401 Unauthorized"

    Hi I'm trying to connect BPM to BAM over the OracleBamAdapter. I set properties of the outgoing connection "eis/bam/soap" to server "localhost" and port "29001" (on which BAM Server is running) plus userName and password. The user works well with iCo

  • Idoc generation and reprint for smartforms and sapscripts

    Dear Experts, Currently our scenario is as below. We are using XML for all outputs. once IDOC is generated it is passed to XML port and print is issued. To reprint IDOC we have a customised program where in we can enter idoc number and print output.

  • Illustrator inactive

    Illustrator went inactive, need to update credit card and reactivate. Chated with three people on the Adobe site, got no help. Called 866-772-3623 and 800-833-6687 and got no answer. Customer service is non existant. How am I supposed to get Illustra

  • User exit for pa20

    Hello expert, I am working on case where i need to calculate insurance coverage amount for IT168.I am using user exit PBEN0011 for that..but for doing some validation i need begin date to read IT0008..So my question that since BEGDA is not available

  • GREP remove white space at start and end of paragraph

    Hi, Question for the GREP experts: I'd like to construct a GREP expression that will remove all white space at the start AND end of a paragraph in one go. What I've got so far works, but you have to run it twice to work: I'll try and post it at the b