Is It Possible to store an entire  file in database using java?

Hi All,
I am new to Programming. please help he out Is It Possible to store an entire file in database using java? is possible, can u tell me the way to make this success? Thank you in advance.

Thanks PhHein
i got that application. i stored one file in db, and i displayed that in browser. thank u very much.

Similar Messages

  • How to restore a mysql dump file to database using java

    hai friends,
    i'm developing an application. in that i need to back up and restore the database. i'm using mysql.
    in that i used a code to back up the db.. its working perfectly and the dump file is created perfectly..
    but while trying to restore the dump file nothing is happening...
    can anyone provide me a sample code to restore the dump to database using java code...
    thanks in advance...

    The first, biggest mistake you made in the code is that you didn't read standard output and error from the process, and/or you're ignoring exceptions. Because if you did, you would have read error messages that would have given you a clue what's wrong. (either that, or you ignored the clues, or didn't understand them and failed to tell us what the error messages are)
    The second mistake is that you invoked exec with the call that takes a single string, when that string includes whitespace not used as delimiters.
    The third mistake was that you used a terrible subject line for your post. Your problem is that you're having trouble with Runtime.exec. The fact that it's about mysql isn't relevent.
    The fourth mistake is that you didn't mention Runtime.exec at all until pushed. You should provide these details. When you try to self-diagnose something that you don't understand, and then hide information, you're just wasting everybody's time, including your won.
    The fifth mistake is that you're using poor spelling.
    The sixth mistake is that you still haven't said why you're doing this in Java.

  • Is it possible to store all iTunes files on an external drive?

    Is it possible to store all iTunes files on an external drive? I'd like to free up space on my Mac Book Air and iTunes is the largest space hog. What can I store on my 1TB external drive and delete from the laptop's hard drive?

    Drag the iTunes library there, launch iTunes with the Option key held down, click on Choose Library, and navigate to that instance of it.
    (85793)

  • HT4759 Only a few of my contacts are stored in iCloud. How do I store my entire file from my 5C iPhone?

    Only a few of my contacts are store in iCloud. How do I store my entire file from my 5C iPhone?

    I downloaded My Contacts Backup. that solved the problem. I had to work with it; but all my contacts are noe stored in iCloud.
    Thanks for the tip

  • How to store file content in BLOB field MySql database using java

    Hi!
    i want to store the file content in a BLOB field in MySql database using java.
    Please help me out..........
    thanx in advance...
    bye

    i stored images in db, and retrieved them. like that cant i store pdf file in db, and retrieve it back using oracle db?
    Plz help me out how to put a file in db. i need complete code. thanks in advance.

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

  • I want to store an xml file into database, and transport it to the XI.

    tell me  in how many ways we can store a xml file in database.
    one i know is.- create a table with field same as that of XML. store XML file data in it
    and at the time of transfering data to XI fatch data from table and create an XML file and transfer...
    tell me if u know some more

    Dear Swethi,
    You can move images to SAP using SE78. then u can use them where ever u you require them.
    SE78->GRAPHICS->BMAP here give ur image name and click on save
    Rgds,
    Kiran
    Edited by: Kiran on Jun 11, 2009 7:15 AM

  • Possible to create a JAR file from within a java app?

    Is it possible to create a jar file from within a java application?
    Can it be done more elegantly than by spawning-off another
    process with the Runtime and exec() portions of the api?
    Thanks
    Scott

    Thanks! I was mislead by the API notes for java.util.jar:
    The JarOutputStream class is used to write the contents
    of a JAR file to any output stream.
    I was looking for a class or method to make jar files.
    Seems this is it ;)
    Thanks
    Scott

  • Open a PDF file in linux using java

    Hi..
    How can I open a PDF file in linux using java.
    I am able to open PDF in windows and mac using this code
    in Windows
    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + path_of_PDF);
    in mac
    Runtime.getRuntime().exec("open " + path_of_PDF);
    But nothing is working with linux.
    Please help
    Thanks

    One thread is enough:
    http://forum.java.sun.com/thread.jspa?threadID=5267458

  • Open PDF file in linux using java

    Hi..
    How can I open a PDF file in linux using java.
    I am able to open PDF in windows and mac using this code
    in Windows
    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + path_of_PDF);
    in mac
    Runtime.getRuntime().exec("open " + path_of_PDF);
    But nothing is working with linux.
    Please help
    Thanks

    appi wrote:
    Hi.. I found the JDIC binary files. There are different binaries for all the plateform. Is there any solution which is independent of plateform.Yes, and we already told you: Use JDK6, which has those libraries built into the standard class library.
    How can I use these binaries in my existing project. does it work, If I place them at same place where other .class files are kept.Read the documentation of the JDIC project. I'm sure they answer this question in their FAQ.

  • How to store images in database using java

    hii
    how to store images in database using java..........
    Message was edited by:
    naveennaga

    I asked a similar question once and the answer I got was - Don't.
    Instead, store the images on a drive somewhere and store the path in the database.
    But I'm no expert - that's just what I was told by someone who does this kind of stuff a lot.
    Hope that helps.

  • How to trace changes in directories and files in windows using java.

    Hi,
    Want to know how to trace changes in directories and files in windows using java.
    I need to create a java procedure that keeps track of any changes done in any directory and its files on a windows System and save this data.
    Edited by: shruti.ggn on Mar 20, 2009 1:56 AM

    chk out the bellow list,get the xml and make the procedure.....     
         Notes          
    1     Some of the similar software’s include HoneyBow, honeytrap, honeyC, captureHPC, honeymole, captureBAT, nepenthes.     
    2     Some of the other hacking software’s include keyloggers. Keyloggers are used for monitoring the keystrokes typed by the user so that we can get the info or passwords one is typing. Some of the keyloggers include remote monitoring capability, it means that we can send the remote file across the network to someone else and then we can monitor the key strokes of that remote pc. Some of the famous keyloggers include win-spy, real-spy, family keylogger and stealth spy.          
    3     Apart from theses tools mentioned above there are some more tools to include that are deepfreeze, Elcomsoft password cracking tools, Online DFS, StegAlyzer, Log analysis tools such as sawmill, etc.

  • File to JDBC using JAVA Mapping

    Hello,
      Can u explain me about the above scenario of File to JDBC using JAVA Mapping.
       Iam new to XI explain above in detail.
    *Points will be Rewarded*
    Thanks&Regards,
    RavichandKone.

    HI,
    If your mapping is one to one then dont go for java mapping use graphical mapping.
    /people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30 --> for jdbc receiver: file -JDBC
    Here are the link which will help you in writing the stored procedure:
    Receiver JDBC scenario MS access - /people/sameer.shadab/blog/2005/10/24/connecting-to-ms-access-using-receiver-jdbc-adapter-without-dsn
    Stored Procedures-
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    http://www.ics.com/support/docs/dx/1.5/tut6.html
    /people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
    http://www.ics.com/support/docs/dx/1.5/tut6.html
    http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html
    http://www.sqlteam.com/article/stored-procedures-an-overview
    thnx
    Chirag Gohil

  • Convert XML file into DTD using Java

    Hi All,
    I want to do convert the xml file into DTD using Java.
    I read the DOM package but didnt get clear idea.
    Anyone of you have an idea please share the coding with me.
    Any suggestions greatly appreciated.
    Thanks
    Veera

    Hi All,
    I want to do convert the xml file into DTD using Java.
    I read the DOM package but didnt get clear idea.
    Anyone of you have an idea please share the coding with me.
    Any suggestions greatly appreciated.
    Thanks
    Veera

  • How to view file from vss using java Commandline

    Hi To ALL,
    I wanted to view a file from vss through java code.
    By using the folowing code,i could able to get vss file in to local folder.
    Runtime.getRuntime().exec
    ("cmd /c ss Get $/Mywork/Myfile.java -GLC:/New");
    But i wanted to view file from vss using java code.
    any one please help me..
    Thanks in advance.........

    As always, Google is your friend.
    Follow the bouncing link.
    http://www.google.com/search?hl=en&q=VisualSourceSafe+%2B+Java+API
    PS.

Maybe you are looking for

  • How can i do the following in oracle reports

    Hi, I have a query that can give me details of the commission for my clients branchwise. We can put the duration, e.g. January, 2009 to June, 2009, which gives me the result for sum of this duration. and in one single column. My concern here is how c

  • How do you make an itunes folder?

    Hi, Whenever I go to download the newest itunes it says "Cannot find /itunes" I accidently deleted it. How do I re-create it?

  • How do I talk to a mod

    Hi I'm having some infinity problems and would like to talk to a mod can someone help?

  • Minimal http 1.1 server implementation

    Hi, does anyone know a really simple (< 10 classes?) http 1.1 server implementation which at least offers keep-alive connections? I only have to process one type of get-request so I believe using one of the big (java) http servers with access control

  • Java API (web services) for  exportMetadata and importMetadata

    We ususally use WLST command : exportMetadata and importMetadata to export/import MDS. is there any corresponding web services or Java API avalaible for the similar purpose? Thanks