Inserting html or doc file in database

Can I send an HTML or DOC file to Oracle database? The file houses text data along with some images and I'd like to send whole this file to database. Could anyone help me do this?
Thanks

Thanks...you are right, the html file contains references to images and I've been able to distinguish all images of the JEditorPane and send those to database. Now I need to send the text contens of JEditorPane to database. Problem is the text data can't be taken differently. If you do have any idea of tracing only the text contents, please let me know.

Similar Messages

  • How can upload doc file into database !!

    Dear Everyone,
    How can i upload a doc file into Mysql database ....
    can any one please give ur suggestions...
    i will show u my code
    upload.jsp
    <form name="uploader" action="uploaded.jsp"
    enctype="multipart/form-data">
      <div align="center">
      <table id="table1" border="1" bordercolor="#ff0000"
    cellpadding="0" cellspacing="0" width="50%">
        <tbody bgcolor="#c8d8f8">
          <tr>
            <td bgcolor="#ccccff">
            <p align="center">
               Resume Upload! </p>
            </td>
          </tr>
          <tr>
            <td> 
            <p align="center">You can upload your
    resume.. </p>
            <p align="center">
            <table align="center" border="1"
    cellpadding="10" cellspacing="10">
              <tbody>
                <tr>
                  <td>
                  <p><input name="file" type="file">
                  <input name="uploadButton" value="Upload"
    type="submit"></p>
                  </td>
                </tr>
              </tbody>
            </table>
            </p>
            </td>
          </tr>
        </tbody>
      </table>
      </div>
    </form>
    uploaded.jsp
    <BODY>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.io.*" %>
    <% 
        String file1=request.getParameter("file");
        int len;
        String query;
        PreparedStatement pstmt;
       int i=0;
        Class.forName("com.mysql.jdbc.Driver");
    DriverManager.getConnection("jdbc:mysql://localhost:3306    Connection conn= /employee","root","");
         try {
                File file = new File(file1);
                   if (file==null)
    %>
    <center>Nothing in It</center>
    <%
                else
                FileInputStream fis = new FileInputStream(file);
                len = (int)file.length();
                query = ("insert into loader(resume) VALUES(?)");
                pstmt = conn.prepareStatement(query);
                pstmt.setString(1,file.getName());
                pstmt.setInt(2, len);
                //method to insert a stream of bytes
                pstmt.setBinaryStream(3, fis, len);
              i=pstmt.executeUpdate();
                   if(pstmt!=null)
                 pstmt.close();
                if(conn!=null)
                 conn.close();
            } catch (Exception e) {
                e.printStackTrace();
                 if(i>0)
                        out.println("uploaded");
                    else
                        out.println("not uploaded")
    %>
    </BODY>

    File file = new File("myDoc.doc");
    FileInputStream fis = new FileInputStream(file);The file name will most likely NOT be hard-coded. I don't think the question surrounding this topic is how to do the insert statement (he/she clearly knows SQL).
    HTTP and the web browser take care of the file transfer, but the server stores the file in a temporary location. The question is, "How do I found out that location?" In PHP (I know that doesn't offer much help to you, but ...), that location is held in a variable called $_FILES. From there you can simply copy the file to a location you specify (probably with a user-specified name under a directory specifically for that user).
    I hope this is of some help:
    http://www.oop-reserch.com/mime_example_4.html
    Good Luck,
    C. R.

  • Reading HTML / PDF / DOC  Files

    I tried to read an PDF file using FIleInputStreamReader and tried to print the contents. Some grabage value is getting printed. on tried to read the HTML filre..only the source is getting printed by the printer.
    How can i overcome this problem

    How are you printing this stuff?
    If you want to print files of various formats, for each file type, you need a way to read the file and render it's contents like the regular application does (Acrobat Reader, Word, etc) and print that rendered output. You can't just send the file as text and have it print correctly. Whatever you do to print the text file works for text files only. HTML works the way it does cuz it's a text file which the browser interprets the markup in it to make it look nice. But you aren't rendering that HTML, you're just printing the text in the file, which includes the markup. The PDF and DOC files are even more different, they are binary formats.
    Whatever you are calling to get the text files to print is not some magic code that's going to interpret and render any file format you give it. That's why there are different programs for viewing PDFs and DOCs and HTML files and the like instead of one magic do-it-all program that can read/write any file type.

  • Insert PDF or Doc file to the Database from Frontend

    Hi
    I am in ISB company working with Oracle 9iDS. The scenario is to me that I would like to insert some document files(especially Pdf formated files) to the database.
    I can use Read_Image_file. but that is used for the image file to bring the image file from physical location to my application, how it is for PDF?
    and how can i save it in the database?
    thanks
    farhad

    So are you saying you want to load a file from the pc/client to the database - then you can use webutil.
    see otn.oracle.com/products/forms
    Regards
    Grant Ronald
    Forms Product Management

  • Inserting HTML and support files into Dreamweaver table cell!

    HELP! I'm using photoshop to generate it's "flash" web photo
    gallery. That yields a folder of pages, swf files and more folders
    of images. I want this slideshow from p'shop to reside in a cell in
    a table on my existing dreamweaver HTML page. HOW! HELP!!!!
    ALSO, does anyone know of an automated, drag-and-drop (but
    slightly customizable) web gallery solution that yields just a
    simple flash .SWF file?
    Why is this so hard. Isn't there any company out there that
    makes a solution that yields a simple file? help! Need this in the
    next few hours! Yikes.
    Thanks so much!

    Flash is this great program - you import images into it, set
    some simple
    timelines, and BOOM! you're all done up.
    I can't remember who makes it.....
    (using right tools for job makes sure your thumbs are
    unharmed)
    HTH,
    Jon
    "tim_and_hazel" <[email protected]> wrote in
    message
    news:enlfmt$kdn$[email protected]..
    > HELP! I'm using photoshop to generate it's "flash" web
    photo gallery. That
    > yields a folder of pages, swf files and more folders of
    images. I want
    > this
    > slideshow from p'shop to reside in a cell in a table on
    my existing
    > dreamweaver
    > HTML page. HOW! HELP!!!!
    >
    > ALSO, does anyone know of an automated, drag-and-drop
    (but slightly
    > customizable) web gallery solution that yields just a
    simple flash .SWF
    > file?
    >
    > Why is this so hard. Isn't there any company out there
    that makes a
    > solution
    > that yields a simple file? help! Need this in the next
    few hours! Yikes.
    >
    > Thanks so much!
    >

  • Import xml zip file into database

    Should it be possible to zip the xml file and insert the that zip file into database?

    Hello,
    You can refer to <p>this article to see how store/edit files with the Webutil library<p><br><br>
    Francois

  • Ability to insert HTML code snippets not available

    Supposedly I can insert HTML into a file in Contribute but
    that option is grayed-out and can't be used. Does anyone know why
    that capability would not be functioning. I have the most recent
    version of Contribute and use it on a PC

    In the main menu go to:
    1. Edit, Administer Websites
    2. Users and Roles, click Edit Role Settings
    3. go to Editing
    4. check 'Allow HTML snippets insertion...' (last option)

  • How To Store pdf or doc file in Oracle Database using Java Jdbc?

    can any one help me out How To Store pdf or doc file in Oracle Database using Java Jdbc in JSP/Serlet? i tried like anything. using blob also i tried. but i am able 2 store images in DB not files. please if u know or else if u have some code like this plz send that to me, and help me out plz. i need that urgent.

    Hi.. i am not getting error, But i am not getting the original contents from my file. i am getting all ASCII vales, instead of my original data. here i am including my code.
    for Adding PDF in DB i used image.jsp
    Database table structure (table name. pictures )
    Name Null? Type
    ID NOT NULL NUMBER(11)
    IMAGE BLOB
    <%@ page language="java" import="java.util.*,java.sql.*,java.io.*" pageEncoding="ISO-8859-1"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%
    try{
         Class.forName("oracle.jdbc.driver.OracleDriver");
         Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
         PreparedStatement ps,pstmt,psmnt;
         ps = con.prepareStatement("INSERT INTO pictures VALUES(?,?)");
    File file =
    new File("D:/info.pdf");
    FileInputStream fs = new FileInputStream(file);
    ps.setInt(1,4);
    ps.setBinaryStream(2,fs,fs.available());
    int i = ps.executeUpdate();
    if(i!=0){
    out.println("<h2>PDF inserted successfully");
    else{
    out.println("<h2>Problem in image insertion");
    catch(Exception e){
    out.println("<h2>Failed Due To "+e);
    %>
    O/P: PDF inserted successfully
    i tried to display that pdf using servlet. i am giving the code below.
    import java.io.IOException;
    import java.sql.*;
    import java.io.*;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class DispPDF extends HttpServlet {
         * The doGet method of the servlet. <br>
         * This method is called when a form has its tag value method equals to get.
         * @param request the request send by the client to the server
         * @param response the response send by the server to the client
         * @throws ServletException if an error occurred
         * @throws IOException if an error occurred
         public void service(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
              //response.setContentType("text/html"); i commented. coz we cant use response two times.
              //PrintWriter out = response.getWriter();
              try{
                   InputStream sPdf;
                   Class.forName("oracle.jdbc.driver.OracleDriver");
                        Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
                        PreparedStatement ps,pstmt,psmnt;
                   psmnt = con.prepareStatement("SELECT image FROM pictures WHERE id = ?");
                        psmnt.setString(1, "4"); // here integer number '4' is image id from the table.
                   ResultSet rs = psmnt.executeQuery();
                        if(rs.next()) {
                   byte[] bytearray = new byte[1048576];
                        //out.println(bytearray);
                        int size=0;
                        sPdf = rs.getBinaryStream(1);
                        response.reset();
                        response.setContentType("application/pdf");
                        while((size=sPdf.read(bytearray))!= -1 ){
                        //out.println(size);
                        response.getOutputStream().write(bytearray,0,size);
                   catch(Exception e){
                   System.out.println("Failed Due To "+e);
                        //out.println("<h2>Failed Due To "+e);
              //out.close();
    OP
    PDF-1.4 %âãÏÓ 2 0 obj <>stream xœ+är á26S°00SIá2PÐ5´1ôÝ BÒ¸4Ü2‹ŠKüsSŠSŠS4C²€ê P”kø$V㙂GÒU×713CkW )(Ü endstream endobj 4 0 obj <>>>/MediaBox[0 0 595 842]>> endobj 1 0 obj <> endobj 3 0 obj <> endobj 5 0 obj <> endobj 6 0 obj <> endobj xref 0 7 0000000000 65535 f 0000000325 00000 n 0000000015 00000 n 0000000413 00000 n 0000000168 00000 n 0000000464 00000 n 0000000509 00000 n trailer <<01b2fa8b70ac262bfa939cc786f8770c>]/Root 5 0 R/Size 7/Info 6 0 R>> startxref 641 %%EOF
    plz help me out.

  • Error while inserting .doc file into CLOB object in oracle

    hello everybody ,
    i am trying to insert .doc file into clob column in oracle database.i am using oracle 8i. But i am getting error saying
    ORA-01461: can bind a LONG value only for insert into a LONG column
    i have no clue.
    i am pasting code here
    please help me out.
    regards
    darshan
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileReader;
    import java.io.Reader;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    public class InsertingClob {
    public static void main(String[] args) {
    File f = new File("E:\\dar
    sowres.doc");
    int len = (int) f.length();
    System.out.println(len);
    Connection conn = null;
    PreparedStatement ps = null;
    try {
    FileReader fr = new FileReader(f);
    String FILE_INSERT_QUERY = "INSERT INTO RESUMED VALUES(?,?)";
    conn = JDBCUtility.getConnection();
    ps = conn.prepareStatement(FILE_INSERT_QUERY);
    ps.setString(1,"1");
    ps.setCharacterStream(2,fr,len);
    int result = ps.executeUpdate();
    if(result ==1) {
    System.out.println("file has been successfully inserted into the db");;
    }else {
    System.out.println("not inserted");
    }catch (Exception e) {
    e.printStackTrace();
    and the error is
    java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:582)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1986)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1144)
    at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2152)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2035)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2876)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:609)
    at InsertBlob.main(InsertBlob.java:21)
    java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column

    You may have one of a few errors going for you there:
    The error says your column in Oracle is a Long not a CLOB, if it is, then make your column a CLOB.
    CLOB's are not suppored in all environments and/or all interfaces (specifically Windoz ODBC has a problem).
    I believe a DOC (Windoz MS-Word) file is a BLOB, due to formatting characters in the file.
    I had a very similar error using Access and trying to do this, but changing to SAS fixed the problem. It could very well be that your version of ODBC/JDBC drivers does not support it properly.

  • Problems inserting a Word doc in an Oracle database

    Hi folks...
    I have a method that successfully inserts a .gif file into an Oracle 8i database table that has a column that accepts files of the type BLOB. Below is part of it to give you an idea:
    db.conn.setAutoCommit(false);
    File file = new File(imageFile.getPath());
    FileInputStream fis = new FileInputStream(file);
    File mydoc = new File(imageFile.getPath());
    FileInputStream fid = new FileInputStream(mydoc);
    PreparedStatement pstmt = db.conn.prepareStatement("INSERT INTO blob_table VALUES (?, ?)");
    pstmt.setString(1, mydoc.getName());
    pstmt.setBinaryStream(2, fid,(int)mydoc.length());
    pstmt.executeUpdate();
    pstmt.close();
    fid.close();
    blob_table has two columns only: first is a VARCHAR2 for the name of the file, second is a BLOB for blob files.
    When I tried using the same method to insert a word doc it doesn't work.
    Can anyone tell me why? And if you have sample code that does what I want to achieve can you share it?
    Thanks!

    Thanks for your reply.
    When I insert .gif files JDeveloper ends with a message saying "Process exited with exit code 0". I then go and check in the database and I find the image added to the table.
    With a word doc, JDeveloper does not give that message. No message at all regarding what the status of the process is. And the document is not added to the database. No error messages too. Could this be an issue with Oracle?

  • Insert doc file into report

    Hello all,
    I want to insert a .doc file into a report, I generate finally a .pdf document.
    I´ve tried two things:
    1.- Insert an OLE2 object (word document), but it doesn´t work, it is reported in the document 74902.1. Reports reservates the space but doesn´t insert the document.
    2.- Use a field "Link File", with a .doc documetn doesn´t work, the only option is to scan the text and insert as an image, but this is not a good option as I have to scan the file every time it changes and a .gif file is bigger than a .doc file.
    Thanks in advance.
    Vicent Aracil. Spain.

    Hi Vincent,
    Pl take a look at Note 166649.1 - it says -
    LIST OF PROBLEMS/LIMITATIONS
    1. Problem:
    Client/Server mode using OLE2 to read in a MS Word document will work as long
    as the output is sent to the previewer but will not work if DESTYPE is set to
    file. That is, an OLE object embedded in the report will display as an empty
    box or nothing at all when the report is generated to a PDF, HTML, or RTF file.
    Solution:
    This is because RTF, HTML and PDF formats do not support OLE.
    The summary is that you cannot embed an OLE object into PDF, and I guess there is no workaround as well to embed the Word document "dynamically" into Oracle Reports PDF output.
    Navneet.

  • Inserting pdf file into database

    I am trying to insert a adobe pdf file into a multimedia field in my database and while I can get it to cut and past I would like it to auto size into the box that I have defined for it. I have many records to compile, thousands. Some of these pdf files have several pages and it would be nice to be able to scroll through thier content in that multimedia field box. How do I do this? Is it possible? If not I assume I am stuck with making a link that opens the file. I assume this is possible. How do I do this?
    Thanks in Advance,
    Shane

    Hello
    You may enter the Layout > Layout mode to enlarge the area dedicated to the multimedia field.
    But there is no provision for an autosize feature.
    The link soluce is not available in databases.
    I mimic it true the "enhanced database" structure requiring an AppleScript.
    You may find the script on my temp iDisk or in the Peggy's one which is organised well.
    Peggy's idisk
    Yvan KOENIG (from FRANCE 20 octobre 2005 12:20:17)

  • Interactive report - Save as html, possible to save file in database?

    Hi
    I am in a situation where I want the output of a interactive report in HTML format, but I do not wan't to download the files to my computer. I want to automate my process to display the report and save the file to database and to be attached to a email from Apex in a later stage.
    Is this possible at all? tried different aproaches with saving data to clob and converting to blob, but it all look horrible for the end user.
    Sincerely
    Johnny

    Check if the subscription feature or download -> email available in apex 4.0 serves your purpose.

  • Insertion of ppt file and doc file

    How to insert ppt file,wbmp file(used in mobile application) and doc file using intermedia objects?
    Please provide me a pl/sql code to insert ppt,doc and wbmp file

    You can use SQL*loader to load the PPT to a BLOB. Then you need to create a text index and you are ready to search. Sample code is available at technet.oracle.com/products/text

  • Smartform - insert html attach file and adjust preview magnification ratio

    Hi guys!
    I have  two question!
    1. How to insert html file to stmartform!
    2. How to adjust preview magnification ratio!
    If anyone to know about this please help me!
    Thank you!

    Hi again Ned, just to let you know that it worked fine that way. The swf is now up and running (literally)
    Thanks once more!

Maybe you are looking for

  • How do you get your site removed from the reported attack sites list?

    Hi, Our site https://mail.ccgs.nsw.edu.au/owa appears to be on the 'reported attack sites' or reported web forgeries' lists and is getting blocked in Firefox. This is a mater of urgency as we use Firefox as our web browser in this organization and th

  • Not able to edit the emailed document to SharePoint library

    Did anyone try to edit the Word Documents that are populated from the outlook emails into the SharePoint library using Incoming Email setttings? This library doesn't have any required cols but still it is giving this error message all the time: The F

  • Previews no loading, but viewing photo full screen is fine

    hi all. perhaps someone can help with a solution to my problem; when i view libary as thumbnails, some of the images only display with a dashed-grey line border, and no picture, BUT if i double click to view the image full screen - its fine! thanks f

  • Urgent, need to load movie frame, p

    I've been caught in this for 2 days, please help, it's been difficult to get someone to answer my threads... Thanks I have a preloader movie that loads a movie called rotando6.swf the problem is that on the main stage I have only a movie called spher

  • Duplicate Postings in SAP

    Hi All, I have encountered an interesting situation. While trying to post a document through an RFC I have come across two postings which have all the header and line items same except for the document number. Even the posting time is same for both e