Mysqldump command execution in java

public class SqlDum
public static void main(String args[])
try
String str="mysqldump -u root -p threadpool > test.sql";
Process p=Runtime.getRuntime().exec(str);
p.waitFor();
catch(Exception e)
System.out.println(e);
}The above code executed sucessfully but there is no generation of sql file.If iam run the command mysqldump -u root -p threadpool > test.sql its executes sucessfully and backup file created.... Command execution takes place in linux platform...?how can i execute in java?

hi friends,can anyone tell me the way to do backup of
my database in MySql.Iam already shown my program....
anyone tell me the changes what i do in that
program?iam using that program in linux
platform...?can anyone tell me the solution or
suggestion... thanks in advanceCome on man! Wake up!
READ THIS this -> http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
AND NOTE WHAT "it says there about output redirection"
Okey buddy?

Similar Messages

  • Mysqldump command execution.............

    public class ProcessDemo
    public static void main(String args[])
    try
    String str="mysqldump -u root -p threadpool>thre.sql";
    ProcessBuilder pb=new ProcessBuilder(str);
    pb.start();
    catch(Exception e)
    System.out.println(e);
    }hifriends.. Iam execute the 'mysqldump' command using java.lang.process but it will throws IOException.....?whats the solution for that?but using the same process class iam executing the linux command 'gedit' it will execute correctly... can anyone give me the solution for this problem...?

    hi friends,can anyone tell me the way to do backup of
    my database in MySql.Iam already shown my program....
    anyone tell me the changes what i do in that
    program?iam using that program in linux
    platform...?can anyone tell me the solution or
    suggestion... thanks in advanceCome on man! Wake up!
    READ THIS this -> http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    AND NOTE WHAT "it says there about output redirection"
    Okey buddy?

  • Usage of mysqldump command

    Hi buddies i need to call the mysqldump command from my java code... Anyone know how to call that command by using java program... pls tell the solution... thanks in advance

    hi yar.. Iam execute the mysqldump command using java.lang.process but it will throws IOException.....?whats the solution for that?but using the same process class iam executing the linux command 'gedit' it will execute correctly... can u give me the solution for this problem...?

  • How to execute MySqlDump Command from java..........

    hi friends,Iam used mysqldump command in linux platform to take backup of the database,its work properly....the command am used is
    mysqldump -u root -p threadpool > sampledatabase.sql
    I need to execute the same command in java....?Anyone here to know how to do that....?Thanks in advance........

    Crosspost:
    http://forum.java.sun.com/thread.jspa?threadID=5185230&messageID=9721722#9721722
    http://forum.java.sun.com/thread.jspa?threadID=5185199&messageID=9721587#9721587
    Do not mess the forum.

  • MDM Database command execution error. A SQL statement failed to execute

    Hi,
    When we tried to execute an MDM Java query modify/create, we get the following dump.
    Is this anything to do with the parameters that we pass or is it something to do with the database ?
    We have checked the code and we do not find anything wrong with the code at all.
    We are using Java API 5.5.63.73 and calling MDM API's using WebDynpro for Java.
    I have noticed this issue has been raised here as well :
    Database command execution error. (While mounting a repository)
    com.sap.mdm.commands.CommandException:
    com.sap.mdm.internal.protocol.manual.ServerException: Database command execution error. A SQL
    statement failed to execute. The actual error may have been written to a log file. at
    com.sap.mdm.data.commands.ModifyRecordCommand.execute(ModifyRecordCommand.java:163) at
    Regards,
    Subramanian V.
    Edited by: Subramanian Venkateswaran on Dec 10, 2008 8:11 PM

    Hi Subramanian  ,
    The error looks more like a problem with the data base or MDM system rather than the java code.
    Which is the underlying database you are using with MDM? As some users have faced some difficulties when working with the DB2 Data base,If this is the data base you too are working upon then may be the issue could be similar,if possible try using the Oracle or SQL data base as these databse show more compatibility than a DB2 when working with MDM .
    Also check the MDM users autorization and authentication to modifyor create recordrs in MDM.try given the user the ADMIN rights,and tehn try and see if teh user is able to modify/Create the mdm records.
    Lastly you can check the database instance and listener configuration correctly.try restarting the Database service form the system if possible.
    Hope It Helped
    Thanks & Regards
    Simona Pinto

  • Help needed for building report with execution method Java Concurrent prog

    Hi,
    I have saw a report like this:
    The report has executable "XML Publisher Data Template Executable", short name as "XDODTEXE", application "XML Publisher",execution method "Java Concurrent program". Also the report has a XML publisher Data Template and Data definition and in the data definition a .xml file is attached.
    I could not understand what is the data source?
    Could anyone help me on how to build or update this type of report?
    Is there any link or help docs which has proper step by step procedure to build this type of xml publisher report?
    Please help.
    Thanks.

    The xml file which is attached to the data definition is the data source and it has sql queries and structure of xml file.
    Check this out for step-by-step guidance.
    http://www.oracle.com/technetwork/middleware/bi-publisher/overview/xmlebsrep-132947.pdf
    http://apps2fusion.com/at/ps/51-prabhakar/262-xml-publisher-and-data-template-sql-query-to-develop-bi-publisher-reports
    For more on data templates refer user guide
    http://download.oracle.com/docs/cd/E10415_01/doc/bi.1013/e12187/T421739T434255.htm

  • Way to display the output of tail command in a Java app

    Hi,
    I have a Java app running in the Linux environment. The Weblogic outputs get written to a log. I would like to design a screen in my app that will enable me to monitor my logs. I normally log into the Linux machine and do a tail -f on the log.
    tail -f Managed_1.logI would like to run this tail -f command from my Java app so that I am able to view the log proress from my app itself. I know we can use Runtime to run external programs but this is a case where a command will be executed continuously and the output will need to be displayed in my app, more specifically on a JSP.
    Any ideas would be most appreciated.
    Thanks and regards,
    Ganesh

    I had a look at the API for the Process class which
    lists an abstract method called getOutputStream().
    What I am not clear is that the documentation says
    that the exec method of Runtime will return an
    instance of a subclass of Process. Does this mean
    that the getOutputStream() method would have already
    been coded for the subclass instance returned?Yes.
    And even if we do get the OutputStream from the tail
    -f process, we will still have to read and display
    the info on a line by line basis. Will this happend
    to be fast enough to macth atleast to some extent the
    speed at which the log is written to?There are two ways to answer this:
    1. Ask somebody who knows how fast the log is written to.
    2. Try it and see.
    My approach would be the second option.

  • Running curl command from a java program using Runtime.getRuntime.exec

    for some reason my curl command does not run when I run it from within my java program and errors out with "https protocol not supported". This same curl command however runs fine from any directory on my red hat linux system.
    To debug the problem, I printed my curl command from the java program before calling Runtime.getRuntime.exec command and then used this o/p to run from the command line and it runs fine.
    I am not using libcurl or anything else, I am running a simple curl command as a command line utility from inside a Java program.
    Any ideas on why this might be happening?

    thanks a lot for your response. The reason why I am using curl is because I need to use certificates and keys to gain access to the internal server. So I use curl "<url> --cert <path to the certificate>" --key "<path to the key>". If you don't mid could you please tell me which version of curl you are using.
    I am using 7.15 in my system.
    Below is the code which errors out.
    public int execCurlCmd(String command)
              String s = null;
              try {
                  // run the Unix "ps -ef" command
                     Process p = Runtime.getRuntime().exec(command);
                     BufferedReader stdInput = new BufferedReader(new
                          InputStreamReader(p.getInputStream()));
                     BufferedReader stdError = new BufferedReader(new
                          InputStreamReader(p.getErrorStream()));
                     // read the output from the command
                     System.out.println("Here is the standard output of the command:\n");
                     while ((s = stdInput.readLine()) != null) {
                         System.out.println(s);
                     // read any errors from the attempted command
                     System.out.println("Here is the standard error of the command (if any):\n");
                     while ((s = stdError.readLine()) != null) {
                         System.out.println(s);
                     return(0);
                 catch (IOException e) {
                     System.out.println("exception happened - here's what I know: ");
                     e.printStackTrace();
                     return(-1);
         }

  • Running a perl shell command through a java program on linux platform

    i'm trying to execute the following command in a java program "perl xxx.pl" using the runtime.getruntime method
    here is the piece of code
    String[] cmd={"perl","-c","AraMorph.pl",""};
    Process p = Runtime.getRuntime().exec(cmd,null,new File("/home/ahmed/buckwalter_morphan_1/data"));
    p.waitFor();
    BufferedReader in=new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line;
    while ((line=in.readLine())!=null)
    System.out.println(line);
    but it doesn't output anything even if i tried to print the output to a file
    i'm trying to execute this program on linux platform but its working properly on a windows platform
    thx
    raar

    String[] cmd={"perl","AraMorph.pl"," </home/ahmed/in.txt"," >/home/ahmed/ast.txt"};
    Process p = Runtime.getRuntime().exec(cmd,null,new File("/home/ahmed/buckwalter_morphan_1/data"));
    BufferedReader in=new BufferedReader(new InputStreamReader(p.getErrorStream()));
    String line;
    while ((line=in.readLine())!=null)
    System.out.println(line);
    p.waitFor();
    String str2=p.getInputStream().toString();
    System.out.println("==================================="+str2);
    and it still outputs nothing but goes in something like infinite loop or as assumed in the article u suggested a deadlock but even all solutions to all pitfalls didn't succeed

  • Running ssh command in a java application

    Hi there!
    I am trying to run a ssh command from a java application cause I need to store the result.
    Actually I can run this command in the cygwin shell so I need to open the shell and run the command, all trough java.
    so, what my process needs to do is:
    1) open the cmd
    2) run C:\cygwin\cygwin.bat
    3) execute the ssh command
    ssh -l fip-user ipdb fip 42704) print the result of the ssh command.
    Note that the cygwin opens in the same command line window and so will print it's result to the same process inputstream
    Message was edited by:
    RBervini

    Use "Runtime.getRuntime().exec()" to execute the SSH program,
    and you can then get the output of the SSH program
    via the getInputStream() method on the returned Process object.
    Note: there are many pitfalls with this. In particular, most people don't know
    they should create separate threads to drain the input/output pipes.
    See this excellent classic article http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    on how to do it right.

  • Creation Of Custom Queries of Execution Type Java.

    Hi All ,
    I want to know if I can create Custom queries of Execution type java which have Query Executor class.
    I got this requirement because I got to customize "Search Master Agreements and Agreements".
    It seems like it's not possible as Query Executor Class is uneditable so no chance of deploying any class file in server and trying out the ways...
    Any approach exists to customize these type of queries.?
    Regards,
    Uday

    Hi
    I understand your requirement is to customize Search Master Agreements and Agreements query and display the new custom report in the Contract Management dropdown on workbench along with other queries.
    This could be achieved by duplicating original query  i.e.Search Master Agreements and Agreements, customize and save it, go to Query Group in set up, identify  and open the query group containing the original query and add the new customized query as query reference.Also don't forget to remove the original query from the query list.
    Regards
    Mudit Saini

  • An unexpected error during Command execution

    Hi,
    I am using Project Server 2007 SP 2 at the moment. One of our user keeps encountering this error "An unexpected error during Command execution" for a project file.  We tried to restore the earlier version of the plan using Administrative restore.
    But it only works as a temporary fix as the problem keeps reapprearing. Kindly help.

    Only SP2 for Project 2007? Probably not worth trying to debug, with 2007 it is almost essential to have SP3 and the very last cumulative update for Project pro and Server. 2007 was a very buggy version (they were forced to release at same time as Office
    2007 and it was too soon).
    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

  • Remote command execution via ssh on ips sensor...

    I am attempting to execute a command remotely via ssh so that I can collect the information on another host.
    ex: ssh -t username@sensor show tech-support
    Instead of the output I expect, I receive an error message: Error: Received invalid command line argument.
    Is this type of remote command execution supported by the sensor?
    Kevin Riggins

    Not true, i already created scritp to automaticly backup the IPS

  • How to execute Dos Command 'Pause' from Java ?

    How to execute Dos Command 'Pause' from Java ?
    I have read the article in javaworld for Runtime.exec() anomalies.
    Can someone please give an insight on this?

    Thanks Buddy!
    That was very useful. Even though its a simple
    solution, I never thought about that.Bullshit! Reread reply #7 of http://forum.java.sun.com/thread.jspa?threadID=780193

  • How to run a openssl command from a java program

    Hi All
    Please suggest on how to run a openssl command from a java program.
    I am using this
    Runtime runtime = Runtime.getRuntime();
    runtime.exec("openssl pkcs8 -inform der -nocrypt test.der result.pem");
    This is suppose to take test.der as input and create result.pem.
    There are no errors but the file result.pem isnt created.
    Thanks in Advance

    First off is that openssl command correct? Should it be this instead:
    openssl pkcs8 -inform der -nocrypt -in test.der -out result.pem
    Try out your openssl command within a command prompt so that you know that it works ok. I think the command line you specified waits on stdin (well it does for me).
    After that.....
    runtime.exec creates a Process object. If you do this:
    Process openssl = runtime.exec("....")
    then you can examine the return code from openssl to see the exit code - for instance if the input file does not exist then exit = 1. You can test for this with Java
    Alternatively you could get the stderr from the process and look inside it - if it is 0 length then all is good, if it has some text in there then it has likely failed. You could then throw an exception and include the stderr output in the exception messgae. You may need to experiment with this, runnig it first when openssl is happy then running it again when openssl is upset.
    M

Maybe you are looking for

  • Closing an Open Goods Return Document

    Hi to all We also experienced returning goods that were already paid and were invoiced through A/P reserve invoice (same case with Avelino Fidel - thread on AP Reserve Invoice posted last Apr. 19). In our case, not all items were returned and withhol

  • I am trying to download itunes to my windows xp an i keep getting error message

    the feature you are trying to use is on a network resource that is unavailable. Click ok to try again or enter an alternate path to a folder contaning the installation package itunes.msi in the box below. An in the box below it has this in it.C:\Docu

  • Registry settings are not consistent with version.exe

    Under the bin directory, there is version.exe which I think would print out the version of wls. When I try to use it, I got the following: E:\Apps\weblogic600\bin>version Cannot find key HKEY_LOCAL_MACHINE\Software\BEA Systems\WebLogic\6.0.0b1: The W

  • SB live! with ME sound too l

    Hello @ll, can someone help me? (sorry, my english is bad ;-) Every systemsound comes too late, sometimes 2 or more seconds later as the window of eg. a warning message...and at this time the sytem freezes for this few seconds... The same is, when I

  • Can't Burn a .img file

    iDVD file plays fine on Mac. File is a video transferred from VHS to iMovie, then made into iDVD file, with added scrolling block comments and one picture. The burn process completes the "Processing" step, but gives a message and hangs up without bur