MySQLDump and Batch Files

Hello all,
I've been using the mysql connector package to populate and retrieve data from a mysql database. Two questions. First, I have recently become very fond of the mysqldump feature attached with the mysql package. Is there a way to call somthing like that from my connector module? ... or any other mysql "-esque" commands for that matter? (ie show tables, show create table someTable) ...
I know that the first command I issue is actually a "USE myDatabaseName" to point the connector module at the correct databse. If the USE command is a mysql command, then I'm lead to believe that commands like SHOW will also be legit. However, what would the return structure be? ... would that also be some kind of ResultSet?
Anyway the other question would be about the execution of batch files like the ones a mysqldump command would generate. I know that I am able to open the dumped text file and populate and run the commands via the methods:
addBatch(String sql)throws SQLException // to populate
executeBatch() // to run.. but is there a method that already does that?
Thanks in advance
-Curt

Hi,
Try Runtime.getRuntime().exec("batchfile.bat");
Check out Class Runtime for more info.
-adam

Similar Messages

  • Please help how to run System commands and batch files thru java program

    Sir,
    I want execute OS commands like dir,cls..etc and batch files,.exe filesthru java program.
    I have tried it sofar thru Runtime.getRuntime().exec("execute.bat");
    but it is not working.anybody knows about how to run the system commands thru java please give me the code.
    thank you,
    regards,
    j.mouli

    I've seen other posts with this questions, and answers. Unfortunately I didn't pay much attention. But the basic idea is to exec command.com and pass the specifc batch or command as an argument.

  • ALE-Interface and batch file

    Hi,
    So far we have transferred Data from one system to main system through ALE-Interface and Batch file. Now we are thinking to harmonize and optimize this process and run all data transfers though ALE-Interface and eliminate Batch File process.
    Can anybody tell me, why the ALE-Interface is better than Batch file for data transfers?
    Thanks

    Batch file is carried out at offline and at certain time intervals
    where as ALE is online transfer and while triggering a particular tcode it can be made to trigger
    This is why ALE is best
    cheers
    S.Janagar

  • Java and batch files

    i want to launch my application by a batch file, whit this script:
    @echo off
    "C:\j2sdk1.4.2_08\bin\java.exe" -cp "C:\Documents and Settings\Intrepido\Desktop\my tesina" BSServer 2103
    pause
    my application as first operation, read from a txt file some row just to configure himself.
    if i launch my application from DOS, writing the path manually, my application does function correctly, instead, launching it from batch file, the first row read return a null value; (i use the RandomAccessFile class and the readLine() method to access file...)
    moreover, since my application is a JFrame class, i've associate some icon to the buttons of the window. starting the application manually from DOS the icons are benn loaded, instead, launching the application from the batch file, the icons are not loaded...
    Help me please...
    and sorry for my bad english...

    i want to launch my application by a batch file, whit
    this script:
    @echo off
    "C:\j2sdk1.4.2_08\bin\java.exe" -cp "C:\Documents and
    Settings\Intrepido\Desktop\my tesina" BSServer 2103
    pause
    my application as first operation, read from a txt
    file some row just to configure himself.
    if i launch my application from DOS, writing the path
    manually, my application does function correctly,
    instead, launching it from batch file, the first row
    read return a null value; (i use the RandomAccessFile
    class and the readLine() method to access file...)
    moreover, since my application is a JFrame class,
    i've associate some icon to the buttons of the
    window. starting the application manually from DOS
    the icons are benn loaded, instead, launching the
    application from the batch file, the icons are not
    loaded...
    Help me please...
    and sorry for my bad english...Since it is a java forum, I suppose that your app is a java app, isn�t it?
    First, define the MANIFEST.MF of your application, that must call the class that contains the famous public static void main(String[] args) method. If you haven�t made this method yet, make it. This method must initialize your app. If you don�t know how to create or how to configure the MANIFEST.MF file, read the articles below:
    http://java.sun.com/developer/Books/javaprogramming/JAR/basics/manifest.html
    http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html
    Don�t forget to configure the reference of some jar files required by your app in the MANIFEST.MF if it is necessary.
    Second, create the batch file. The content of this file is simple. It has has to be like below:
    java -jar MyJarFile.jar
    Where MyJarFile.jar is your jar file. Then, put this batch file in the same directory of the jar file and double click it. Finish! Your app will be executed as you want.
    Of course, first of all, you have to configure the java environment variables in order to this app works well (JAVA_HOME, PATH, CLASSPATH, etc).
    It is just one manner to do what you want. There are other ways to do it, of course.

  • Use CSV and batch file for net user command

    Hello Guys,
    I am trying to load domain user id's from a csv file and parse them through the net user /domain command.  I would appreciate it if someone could help me open the csv file and store each line as a variable so that it could be parsed.
    Thanks in advance.

    My apologies, I didn't notice that you specifically mentioned batch files in your question title.
    I don't have much to offer, as my batch skills are extremely rusty.
    I would personally be doing all of this via PowerShell, as the AD cmdlets can return any bit of information about your users that you'd like.
    Don't retire TechNet! -
    (Don't give up yet - 12,420+ strong and growing)

  • Orbd and batch file

    What am I doing wrong? If I start the orbd by opening a cmd prompt on win2k, and typing orbd -ORBInitialPort 1050 -serverPollingTime 200
    Then, I start servertool and register....everything works fine.
    If I take orbd -ORBInitialPort 1050 -serverPollingTime 200 and put it into a batch file....
    start orbd -ORBInitialPort 1050 -serverPollingTime 200
    register in servertool....
    run the client and it cannot connect to the orb, a null value is returned instead?
    Any help is very much appreciated.

    I tried this for my batch file...still doesn't work
    REM - Start the ORB daemon
    start %JAVA_HOME%\bin\orbd -ORBInitialPort 1050 -serverPollingTime 200
    @echo Wait 10-15 seconds for the orbd to start
    @pause
    REM - Register the persistent server with orbd using servertool
    %JAVA_HOME%\bin\java com.sun.corba.se.internal.Activation.ServerTool -ORBInitialPort 1050 -cmd register -server MyServer -applicationName s1 -classpath c:\myserver\myfiles;

  • OWF and batch files

    Hi!
    I have a question to Oracle Workflow.
    Particularly with regard to the Activity USER_DEFINED.
    Is there a way out of a batch file to get a access to the contents of "Process Editor => Activities => USER_DEFINED => Script => value".
    When I debug I saw the variable "argv.stdin". So that ought to be possible?
    Thanks!

    Hi,
    If you meant , a way to list the values specified for SCRIPT attribute the you can use OMB+ scripts to crawl through your process flows and list the values for this attribute.
    Regards
    Mahesh

  • Fscommand and Batch Files

    Hello, been wrestling with this one for a bit. I am trying to
    figure out what code to use that would let me push a button ( on
    release ) in my standalone projector , and have a batch file
    execute.. is this possible ?

    yes it is posible
    create your .bat file,
    put in the "fscommand" folder relative to your projector file
    for your button
    on(release){
    fscommand("exec", "filename.bat");
    }

  • CF PROBE and batch files

    I've setup a CF Probe on my Development Server to ensure my
    CF Production server is up and running (services = Apache and CF
    Application Server). It checks the PROD login page and if it times
    out in 30 sec the probe fails. I understand I can execute a file
    (batch file with net start and net stop) but the problem is I need
    to have the probe somehow point to the .bat file on the PROD server
    and not on the local machine. How can I remotely access this batch
    file and execute it? I don't know how to point to the file on the
    other server... can anyone help?

    I've setup a CF Probe on my Development Server to ensure my
    CF Production server is up and running (services = Apache and CF
    Application Server). It checks the PROD login page and if it times
    out in 30 sec the probe fails. I understand I can execute a file
    (batch file with net start and net stop) but the problem is I need
    to have the probe somehow point to the .bat file on the PROD server
    and not on the local machine. How can I remotely access this batch
    file and execute it? I don't know how to point to the file on the
    other server... can anyone help?

  • Runtime.exec() and batch files

    I am having a problem on Windows 2000 while trying to execute a batch file with the Runtime.exec() method. Basically, the exit value returned from the call to Runtime.exec(), returned specifically by the waitFor() method in the Process class, is always zero, even if the batch file fails miserably. After looking into batch files further, it seems to me that the only way to get the exit value of the commands run in the batch file back to the Runtime.exec() call is to put "EXIT %ERRORLEVEL%" in the batch file. What this actually does is exit the command(cmd) shell that the batch file was running in with the exit code of the last command run. This is all great when calling the batch file with a Runtime.exec() call, but when you run it in a cmd window, the window closes when the batch file completes, because the call to EXIT exits the entire shell. I guess i'm just wondering, am i correct in assuming the exit value returned to the java process is going to be the exit value of the shell in which the batch file is running? I need to have the exit value actually indicate whether the batch file ran successfully or not, and if i have to put in the EXIT %ERRORLEVE% (which exits the cmd shell with the exit value of the last command run), then i'll do that, but if someone knows a better way of doing this, i am all ears. Thanks in advance

    To run any command from java code, the method is
    Runtime.getRuntime().exec( myCommandString )
    Where, myCommandString is something like "/full/pathname/command".
    If the pathname contains spaces (specifically in Windows), e.g. "c:\program files\windows\notepad", then enclose it in quotes within the quoted string. Or pre-tokenize them into elements of an array and call exec(String[] cmd) instead of exec(String cmd).
    From JDK1.3 there are two new overloaded Runtime.exec() methods. These allow you to specify starting directory for the child process.
    Note, there is a gotcha associated with reading output from commands. When the runtime exec's the process, it passes to it 3 streams, for stdin, stdout, and stderr; the out and err are buffered but the buffer size isn't very big. When your process runs, it reads (if needed) from in, and writes to out and err.
    If it doesn't write more than the buffer-size, it can run to completion.
    But if it tries to write more data to one or the other stream than the buffer can hold, the write blocks, and your process hangs, waiting for you to empty the buffer so it can write some more.
    So after the exec call, get the streams, and read from them in a loop until they both hit end-of-stream (don't block on either one, just read whatever is available from each, each loop iteration).
    Then when the streams have ended, call the process.waitFor() method to let it finish dying.
    Now, here is a code snippet how you achieve this.
    String strCommand = "cmd.exe /c " + strCommand;
    // For Solaris / unix it will be
    // String strCommand = "/usr/cobra/sol/runInstaller.sh";
    boolean bWait = true;
    //execute the command
    try
         Runtime r = Runtime.getRuntime();
         Process pr = r.exec(strCommand);
         Process pr = r.exec(callAndArgs);
         BufferedInputStream bis =new BufferedInputStream(pr.getInputStream ());
         int c=0;
         /** Outlet for IO for the process **/
         while (c!=-1)
              c=bis.read();
         /**Now wait for the process to get finished **/
         if(bWait == true)
              pr.waitFor();
              pr.destroy();
    catch(Exception e)
         System.out.println("Could not execute process " + strCommand);
         return(false);

  • Java and Batch File Issue - need urgent help

    I have a java program which calls a batch file. This batch file calls another java program. I want an option so that I can close this java program from main program.
    If i try process.destroy then it will call batch file and not java program.
    I can't go away with batch file.
    I will appreciate if someone can help me.

    khannap wrote:
    Hi, Thanks for the help but this doesn't seem solving my problem completely. I will appreciate if you can help more.
    I will explain you the scenario -
    1. There is java program provided as an external program to me.Only changes things slightly.
    2. This java program is called using batch file. When batch file is started this java program starts and listens on a socket for incoming data.I would want to wrap the launch of this java program in another JVM so we can use process.destroy().
    3. I am writing a program to check performance of the above java program. I want to call this java program from my program in a loop having some varying config data. When I run the loop first time I create a batch file at run time which executes the batch file provided by vendor. This batch file starts the socket. Once my message list is over then my loop goes to executing the batch file again with different config parameters. But this time I run into issue because my previous java program is not killed after message sending was over.Would it be acceptable to mung the 3rd party batch file to insert a wrapper JVM?
    Even if i use threads I don't think I can get rid of batch file.I did not suggest getting rid of batch files.
    So, I need to find a way so that when any iteration of loop is over then this socket program is killed. These 3rd party java programs - do they not have a "terminate" command you can put at the end of your message list?
    Even if i closed the socket from my client program that doesn't help because server is still listening and waiting for new client.
    I need to kill server which was started by batch file.On Linux it would be fairly simple to modify your batch file to determine what the process id is and send the process a signal to terminate it.
    Not sure what you can do on Windows.

  • System Administration and Batch File

    Hi all,
    I linked a batch file to be opened in my pdf file, but every time I open this through the link a message comes up saying "disallowed by your system administrator".
    Can anyone show me how to allow the batch file to be opened
    Thanks

    This is a Security feature. In order to change what can be opened as an attachment, you need to edit the registry.  The ETK Preference Reference has the information to edit the registry that you will need.
    Attachments

  • Javaw and batch files

    Right, so I want my Java application to run without those pesky DOS windows, first things first, we make a little .bat file and then we use javaw.exe instead of java.exe right?
    Fine so far... but wait! A weird DOS box flickers up briefly and then dissappears before the app loads. Humph, how very unprofessional.
    "Ah but wait!" I hear you cry... "Can't you just make a shortcut to the javaw.exe and slap your classpath on the end as an argument, cos we all know that no .bat means no DOS window!". Well what can I say?! Sounds like the perfect solution.... except for the fact that when you make a new shortcut you are limited to a rather small number of characters, plenty enough for most uses, but not for mine. My classpath is a beast and gets truncated by the short text field.
    Sooooo... how can I get my app to run from a shortcut/batch/executable WITHOUT the silly DOS window nonsense and [i[REGARDLESS[/i] of the length of the command line to be executed. Or am I asking a bit much?
    Anyone?

    Make a desktop shortcut in a different way - set the "Start in" parameter, the classpath isn't then needed.
    See my reply # 6 to this thread for a detail explanation
    http://forum.java.sun.com/thread.jsp?forum=31&thread=548762
    Works fine, without a DOS window popping up.

  • Problem Executing Batch File

    I wrote out a java class that I tried using cfobject to call. It didn't work. So I wrote a batch file to call the java class.  The batch file works, but NOt when I have coldfusion call it. Nothing happens, no error... nothing.  I thought it might be a permissions issue, but I tried changing permissions for coldfusion although I may have doneit wrong since I'm not too familiar with Vista.  Can anyone offer advice on what I can do.  Its a simple java class and I can't get it to run.  no errors in the log.  There isn't much for me to go on.  All I know is that the class and batch file work fine if Coldfusion doesn't call them.

    Amosl wrote:
    To limit the problems with the class itself and cfobject, I've created a batch file to run the class.  The batch file runs the class fine, so long as I execute the batch via command line.  But coldfusion doesn't execute the batch with cfexecute.  the same exact problem with absolutely no error messages.
    Unfortunately, cfexecute is not the easiest tag to debug. In my experience sometimes it confuses more than clarifies.  But trying it is not a bad idea from a troubleshooting point of view.
    However,  if I create a java class in the same folder that doesn't write to the system and only returns variables, it works fine.  This indicates the class path is set correctly and that cfobject does work.
    Yes, I would agree.
    It does sound like it might be a permissions issue. But I have little experience with Vista, so there may well be another cause.  Since it sounds like you are just testing a very simple java class, can you post the code for the class itself as well as the exact cfexecute code you are using? I could test it on another operating system. Just to see if there is some obvious problem.
    Amosl wrote:
    From the 100's of pages I've read online with people with similar problems, this seems to be a permissions issue.  however, I've set Coldfusion to run as me, the administrator and only person who uses this computer.  It is no longer running as local system.
    However, this didn't fix anything.  My only guess is that perhaps I've no set it to run as me correctly.  But I have no way of testing this.  Windows logs show no error messages either.  Is there any way to have coldfusion show me what user its trying to execute the batch as.
    I believe the user account can be obtained from the java system properties.  Try:
    <cfset sys = createObject("java", "java.lang.System")>
    <cfoutput>
       <b>user.name</b> = #sys.getProperty("user.name", "not found")#<hr>
       <b>coldfusion.classPath</b> = #sys.getProperty("coldfusion.classPath")#<br>
    </cfoutput>

  • Help, how to install jvm and set the classpath using a batch file

    hello,
    i have created my java application and now have to create an installable / batch file which will install the JVM on the users machine and also the java packages such as javamail and the class files that i have created . it also has to set the classpath.
    i would like to know if anyone can tell me how to go about iti.e. how can i install the JVM using a batch file and then place the javamial packages etc in the apropriate directory .
    or is it advisable to explain it to the user how to go about it in tht user manual.
    and would also like to know that if i install the JVM will the path for the java.exe be set
    or will i have to set the path explicitly from the "batch file" so that the user can run the application without and problem just by running the java command followed by filename from the command prompt.

    hi,
    I have windows and I use it.
    The only problem with the free edition is that you can only create 1 launcher and that during the installation you get 1 popup showing that the installer was created with an unregistered version.
    Stijn

Maybe you are looking for

  • Installing solaris 8 and not erasing racine disk

    I have one hardisk of 45G partitionned into 20G and 25G. Windows98 lives on the first partition. My plan was to intall Solaris on the second partition. But when I launch the installation, it says it wants to run fdisk on the c0d0 device, and that it

  • FCPX Crashes On Open- Render File Problem

    Hello- Right now I cannot open FCPX. I've been working on a 15 minute project with a moderate amount of effects. Tried to edit today, and after opening, quits after trying to render. Ran Pro Maintinance Tools which generated this crash report: Effect

  • TAXINJ , TAXINN & Excise

    Dear Experts,    1) If my tax procedure is TAXINJ, How systems links CIN with TAXINJ ? How the calculation takes place ?    2) If my tax procedure is TAXINN, How systems links CIN with TAXINN ? How the calculation takes place ?    3) What is the link

  • How can I use set up a tv and monitor to my desktop

    I had my TV set up for 2 years but I decided I want to connect a monitor so u can have 2 screens. I have an hp desktop setting it up with my toshiba tv was easy all I had to do was plug it in using a hdmi cable.i have an acer monster connecting it to

  • Is soundblaster live compatible with DirectX 9

    All the new games are running with directx 9.0c now. Does my Soundblaster Li've card support this and if not is there a driver / firmware download available to fix it's My current driver is ctaud2k.sys, 5.2.000.0252