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.

Similar Messages

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

  • How to store crystal report (rpt file) into disk using java

    hello
    i want to coonect my report file to java .want convert this file into pdf and store into disk using simple java program
    if any have code for this then provide me
    thanks & regards
    ram

    Have you given up on your other threads? All your questions seem to be on the same general problem. Could you please stop creating new threads for this?

  • 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 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 find a dump file is taken using norma exp or expdp

    Hi All,
    How to find out whether a dump file is taken using the conventional exp or using the expdp utility?
    OS: HPUX
    DB: 10.2.0.4

    Hi ,
    I go with Helios's reply. We cannot just predict if it was taken my expdp or exp.
    Since your DB version is 10 , both could be possible.
    The simplest way would be : just run the imp , if it throws error , then its created through expdp.
    because dump from expdp cannot be used with imp and vice versa. So that could help you find..
    else , try to get the syntax by which the dump was created.
    If you have any doubts , wait for experts to reply.
    HTH
    Kk

  • Have  a MYSql dump file in *.sql extension

    Hi
    I have a MySql dumped file in *.sql extension.
    I have been reviewing ( maybe cannot see) SQL dev to see if I can use it to migrate the mysql file.
    Is this possible?  I looked at the snippet of the sql file and it has indications to create tables using specific MySQl engines...
    Is connecting to the source db ( MySQL) the only way to do this?
    thanks

    The supported methods of migrating from MySQL to Oracle RDBMS via the SQL Developer tool are discussed in ...
    Getting Started: SQL Developer Migrations
    MySQL Migration
    Even very old versions of SQL Developer (say, version 1.5.5) support migration, but the steps may vary depending on version so it is best to use the latest 4.0.3production release. If your migration is small, then using the Copy to Oracle feature may suffice:
    Getting Started: SQL Developer Migrations

  • Can i use impdo while dump file was creeated using exp

    hi,
       I am using oracle 10g database I want to use impdp but my dump file was created using exp utility so can I use impdp now?
    regards

    Hi,
    >>kindly tell me how can I replace existing user from new dump user using imp utility
    You mean the user which used to take the Exp/import right?
    if yes, You do not need to drop/replace this, you just need to add/grant read,write privilege on directory. you can check this:http://www.oracle-base.com/articles/10g/oracle-data-pump-10g.php
    HTH

  • How do I view ipod music files with out using I tunes?

    I trying to view my Ipod music files without using itunes. But when I conect my Ipod to my pc I can only view contacts, notes, and caladar through the driver.
    How do I view ipod music files with out using I tunes?

    they should be under ur my music folder if u have windows

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

  • Q: How do I convert a pdf file to Word using Adobe Export PDF? - all my attempts are scrambled.

    Q: How do I convert a pdf file to Word using Acrobat Export PDF - all my attempts are scrambled

    Do you subscribe an Adobe Export PDF account? If you do not have an account, please go to https://www.acrobat.com/exportpdf/en/home.html?trackingid=JPZKN to subscribe.
    If you have an account, make sure verify your email address and sign in from https://exportpdf.acrobat.com/SignIn.html
    Jyh-Jiun Liou

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

  • I am not able to Sync. My iPOD classic 80Gb. It tells that as iTunes can not read the contents-restore to factory settings- after restoring – it tells that it can not be restore bcause there are files that are used by other application. I am having Widows

    I am not able to Sync. My iPOD classic 80Gb. It tells that as iTunes can not read the contents-restore to factory settings- after restoring – it tells that it can not be restored bcause there are files that are used by other application. My iPOD appears in My Computer in drive H as a mass storage generick volume

    Try disabilng the Enable Disk Use option from under the iPod's Summary tab, applying the changes, and seeing if that helps.
    Otherwise, temporarily disabling any antivirus, security, firewall, or file indexing software that may be running on your system and then try restoring your iPod again.
    B-rock

  • How do I upload an XML file to salesforce using BULK API?

    Hi There,
    Please let me know how do we upload an XML file to salesforce using Bulk API?
    Thanks,
    ET

    Hi,
    I think that this is a more SalesForce.com question and think you will have more chance looking at SOAP API Developer's Guide for salesforce. Sending a SOAP request from the API Server is very straight forward and there are several tutorials and well documented about this.
    Cheers,
    Stefan

Maybe you are looking for

  • Error when DBMS_LOB.FILEOPEN , why ?

    Hi.. I create a directory , example : ULLOA "create or replace directory ULLOA as 'c:\';" This path (c:\) are inside of the server.. But , when execute the block pl/sql l_bfile := bfilename( 'ULLOA', 'setup.txt' ); dbms_lob.fileopen( l_bfile ); Obtai

  • Creating DataMarts in BI 7.0

    Hi, If I have to load the data from the Data Source to the InfoCube, then the procedure of creating the data marts for the Data Source still exist in BI 7.0 or is there any other process to do that. Can any one please explain me with the detailed ste

  • Fixed position header / logo / home link / spry menu dreamweaver cs5

    Hi all, I'm starting a new discussion on this: I have posted the code below for the header and the spry. The header with logo and homelink keeps going underneath the spry and the spry jumps to the top of the page, this has only happened when I addded

  • Updating without using the updater?

    Hi I was wondering if it is possible to download updates without using the updater as it is for a pc that is not online. Im after 3.2.0 on xp. Many thanks

  • Export omport advice

    Hi, We are facing few space issues on the servers. now as a part of the schema refresh we have no option but to use the import and export using the NETWORK LINK. just wanna confirm whether it suuports the BLOB LONG with NETWORK LINK Thanks