Starting logminer from java

I want to start logminer tool from java
To start logminer tool the first step is
alter system set utl_file_dir='C:\oracle\product\10.2.0\logminer_dir' scope=spfile;
shutdown immediate
startup
I am working on eclipse
The alter command is executed, but to startup and shutdown immediate, I am trying to use the below program. I getting the following error in eclipse
"Exception in thread "main" java.lang.Error: Unresolved compilation problems:
     DatabaseStartupMode cannot be resolved or is not a field
     DatabaseShutdownMode cannot be resolved or is not a field
     DatabaseShutdownMode cannot be resolved or is not a field
     at DBStartup1.main(DBStartup1.java:35)"
How to resolve it?????
import java.sql.*;
import java.util.Properties;
import oracle.jdbc.OracleConnection;
import oracle.jdbc.pool.OracleDataSource;
* To logon as sysdba, you need to create a password file for user "sys":
* orapwd file=C:\oracle\product\10.2.0\db_1\dbs\orapw entries=5
* and add the following setting in init.ora:
* REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
* then restart the database.
public class DBStartup1
static final String DB_URL = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=XYZ.com)(PORT=1521))"
+ "(CONNECT_DATA=(SERVICE_NAME=rdbms.devplmt.XYZ.com)))";
public static void main(String[] argv) throws Exception
// Starting up the database:
OracleDataSource ds = new OracleDataSource();
Properties prop = new Properties();
prop.setProperty("user","system");
prop.setProperty("password","oracle");
prop.setProperty("internal_logon","sysdba");
prop.setProperty("prelim_auth","true");
ds.setConnectionProperties(prop);
ds.setURL(DB_URL);
OracleConnection conn = (OracleConnection)ds.getConnection();
//OracleConnection.getMode();
conn.startup (OracleConnection.DatabaseStartupMode.NO_RESTRICTION);
conn.close();
// Mounting and opening the database
OracleDataSource ds1 = new OracleDataSource();
Properties prop1 = new Properties();
prop1.setProperty("user","sys");
prop1.setProperty("password","manager");
prop1.setProperty("internal_logon","sysdba");
ds1.setConnectionProperties(prop1);
ds1.setURL(DB_URL);
OracleConnection conn1 = (OracleConnection)ds1.getConnection();
Statement stmt = conn1.createStatement();
stmt.executeUpdate("ALTER DATABASE MOUNT");
stmt.executeUpdate("ALTER DATABASE OPEN");
stmt.close();
conn1.close();
// Shutting down the database
OracleDataSource ds2 = new OracleDataSource();
Properties prop2 = new Properties();
prop.setProperty("user","sys");
prop.setProperty("password","manager");
prop.setProperty("internal_logon","sysdba");
ds2.setConnectionProperties(prop);
ds2.setURL(DB_URL);
OracleConnection conn2 = (OracleConnection)ds2.getConnection();
conn2.shutdown(OracleConnection.DatabaseShutdownMode.IMMEDIATE);
Statement stmt1 = conn2.createStatement();
stmt1.executeUpdate("ALTER DATABASE CLOSE NORMAL");
stmt1.executeUpdate("ALTER DATABASE DISMOUNT");
stmt1.close();
conn2.shutdown(OracleConnection.DatabaseShutdownMode.FINAL);
conn2.close();
}

See other thread with the same name!

Similar Messages

  • Starting MySQL from java??

    hi i am trying to start mysqlserver from java and have used the getRuntime() method as such
    try{
    Runtime r=null;
    r=r.getRuntime();
    Process p=r.exec("C:/mysql/bin/mysql -u mark_r -p");
    p.waitFor();}
    catch(Exception ex){System.out.print("Error");}}
    unfortunally iam getting no responce from the server, i think this is because the command C:/mysql/bin/mysql -u mark_r -p does not take in the actual password until the return key is pressed therefor the program wont start , so what i need is a way of getting the enter password prompt back from dos intom he java program and the to send the password back to dos
    thanks

    See other thread with the same name!

  • Starting weblogic server from java program

    Runtime r=Runtime.getRuntime();
    Process p=r.exec("cmd /c d:/bea/weblogic700/server/bin/setWLSEnv.cmd");
    when ihave given like this it is working.
    now i want to start weblogicserver from jav program
    String s="-Dweblogic.Domain=mydomain weblogic.Server"
    Process p=r.exec("cmd /c d:/bea/weblogic700/server/bin/setWLSEnv.cmd java "+s);
    when i gave like this weblogicserver should start with specified domain
    but no output is comming.please tellme where the problem is

    no - nothing happened. it perform the next java code - and there is nothing else happen on the windows.
    maybe i don't check in the right place for the error you are talking about?
    i also tried i simple cmd file that does nothing - but still nothing...
    for any other file types it works properly.

  • I just downloaded and instaled firefox 4. Now, everytime I institute a command I get a po[p-up from Java script that tells me to uninstal set. I cannot go on untin I press ok and then I am good for one more command and it starts with the pop-up again.

    I'm not even sure if this is an extension or plug-in and all I can tell you is what I have already stated. I can only make one command at a time and after each one I get a pop-up from Java script that says uninstal set. I must depress ok to move on, but only for one more command and it starts over again. This also happened when I tried to instal firefox 4 a couple months ago and I deleted the program and went back to an earlier version.

    Mail troubleshooting - Yosemite
    Troubleshooting sending and receiving email messages
    Troubleshooting sending email messages
    SMTP servers keep going offline

  • How can I open help file (HTML or .chm) from Java Web Start (new to JAVA)

    Hi All,
    Im trying to open the help file of my application.
    When trying to access the help file from the GUI (pressing F1 for launching the help file), I'm geting the an error, something like:
    "Can't show help URL: jar:file:C:\Documents and Settings\%USER%\Application Data\Sun\Java\Deployment\javaws\cache\http\Dlocalhost\P7001\DMwebstart\RMjar-name!/com/resources/helpFiles/MyHelpFile.html"
    It seems that the file which is packed in a jar, was downloaded to the Java Web Start cache directory:
    C:\Documents and Settings\%USER%\Application Data\Sun\Java\Deployment\javaws\cache\http\Dlocalhost\P7001\DMwebstart
    The code which is activated when launching the help file is:
    try
                ResourceBundle resourceBundle = DoubleResourceBundle.getBundle("Resource", "ResourceImpl");
                RuntimeUtil.launchFile(new File(resourceBundle.getString("help.file")));
            } catch (IOException e)
                // TODO Auto-generated catch block
                e.printStackTrace();
            }where the property "help.file" is in some property file in the resource bundle named "Resource", and looks like this :
    help.file="com/trax/docs/help/global/MyHelpFile.html"
    The function "RuntimeUtil.launchFile" knows how to launch any file in its default application, and indeed it does launches the html, when giving it an absolute path to the file on my PC, as "C:\Helpfiles\MyHelpFile.html" as such:
    RuntimeUtil.launchFile("C:\Helpfiles\MyHelpFile.html");My question is :
    The application is going to be deployed on a Customer PC. How can I access the html file from the code, with a relative path and not its absolute path on the customer pc, which I can't know?
    I found these restrictions regarding web start:
    (copied from "http://rachel.sourceforge.net/"):
    *Rule 1: Java Archives only. No loose files.* All your resources have to be packaged in Java Archives (jar) if you want to have
    them delivered to the user's machine and kept up-to-date automatically by Java Web Start.
    *Rule 2: No file paths.* You can't use absolute or relative file paths to locate your
    jars holding your resources (e.g. <code>jar:file:///c:/java/jws/.cache/resources.jar</code>).
    Absolute file paths won't work because you never know where Java Web Start
    will put your jar on the user's machine. Relative file paths won't work because Java Web Start
    mangles the names of your jars (e.g. <code>venus.jar</code> becomes <code>RMvenus.jar</code>)
    and every JNLP client implementation has the right to mangle your names
    in a different way and you, therefore, can't predict the name with
    which your jar will be rechristend and end up on the user's machine in
    the application cache.Seems complex or impossible, to perform a simple task like opening a file.
    Please advise (I'm new to Java and Web Start).
    BTW, I'm working with IntelliJ IDEA 5.0.
    Thanks,
    Zedik.
    {font:Tahoma}{size:26pt}
    {size}{font}

    the follwing method i have used to open html file ...
    so to access html file i am shipping resources folder with jar file ..
    private void openHtmlPages(String pageName) {
         String cmd[] = new String[2];
         String browser = null;
         File file = null;
         if(System.getProperty("os.name").indexOf("Linux")>-1) {
              file = new File("/usr/bin/mozilla");
              if(!file.exists() ) {
              }else     {
                   browser = "mozilla";
         }else {
              browser = "<path of iexplore>";
         cmd[0] = browser;
         File files = new File("");
         String metaData = "/resources/Help/Files/"+pageName+".html"; // folder inside jar file
         java.net.URL url = this.getClass().getResource(metaData);
         String fileName = url.getFile();
         fileName = fileName.replaceAll("file:/","");
         fileName = fileName.replaceAll("%2520"," ");
         fileName = fileName.replaceAll("%20"," ");
         fileName = fileName.replaceAll("jarfilename.jar!"," ").trim();
         cmd[1] = fileName;     
         try{
              Process p = Runtime.getRuntime().exec(cmd);
         }catch(java.io.IOException io){
                   //Ignore
    can anyone give me the solution..???
    Regards
    Ganesan S

  • Starting exetutable java file from java code

    Hi I was wondering how I can start a executable java file from java code?
    thanks

    Hi Mkaveli,
    Yes, it's possible. If you have a JAR executable, you've just to call the main method of its starter class. For a simple executable class, just call its main method.
    This way :
    SomeStarter.main(null); // if there's no argumentSmall precision : the executable JAR or class must be specified in the classpath of your application.

  • Java console doesn't launch when starting Java Web Start app from Firefox

    Updated my Linux desktop from RHEL to Fedora 12 with resultant upgrade of Firefox to 3.5.9 and now when I launch our Java Web Start application, no Java console appears. The Java Control Panel still shows "Show Console" as set. My app uses Java 1.5 which I have installed on my desktop.
    What do I do to properly configure my browser/desktop to support use of the Java console?
    Please help, I need to debug our app!
    Ilane

    IlaneMarie wrote:
    ..Please help, I need to debug our app!Cannot tell you the answer to your FF hassles (because I have no idea why you're seeing that behaviour(1)), but note that you might be able side-step FF by launching a JWS app. using the javaws tool directly from the command line or an Ant build file.
    1) Though you might try rebooting the machine if any installation/configuration changes have occurred since last boot.
    Also note that many problems with JWS apps. can be sorted be checking the JNLP using JaNeLA.

  • Starting a external program from java

    hi iam trying to start MySQL server from java, the command in dos is as follows C:\mysql\bin\mysql -u username -p ,then the user hits return and the user is prompted to enter a password. i have got as far as entering the the C:\mysql\bin\mysql -u username -p but dont know how get the prompt back to the java program i would be greatfull if anyone could tell me where iam not doing,heres my code so far
    try{
    Runtime r=null;
    r=r.getRuntime();
    Process p=r.exec("C:/mysql/bin/mysql -u mark_r -p");
    p.waitFor();}
    catch(Exception ex){System.out.print("Error");}}

    You should try using the getOutputStream() and getInputStream() methods for the Process object. Each returns either an inputStream or OutputStream object.
    You should be careful if the mySQL password is added to the command since anyone doing a 'ps' on the machine could see the password.

  • Start and stop the Communication channel from Java Mapping

    How to start and stop the Communication channel from Java Mapping in XI 3.0
    Scenario  PI - > MQ -> Third Party web application 
    Web application is down and then Communication channels are stop manually .  
    We need to automate this process,
    MQ Solution - Trigger will be set in MQ which will be called when web application is stopped
    Trigger will send u201CSTOP u201C message to PI
    How to configure PI scenario to stop different com channels when this message received ?

    check this link: http://help.sap.com/saphelp_nw04/helpdata/EN/45/0c86aab4d14dece10000000a11466f/frameset.htm
    make sure that MQ send http request to PI. i dont think a configuration scenario is required in PI. Only roles should be enabled with proper user provided to MQ team.
    However, for security reasons, you can configure a scenario if you dont want to expose PI infrastructure directly to 3rd parties.

  • Start and Stop a Windows Service From Java

    Is there any way to start and stop a Windows service from Java? The only post I found on it (http://forum.java.sun.com/thread.jspa?threadID=647509) had a link to one of the many aps that allow Java programs to be services, which is not what I am interested in doing.
    I am attempting to get data from performance counters from the Windows Performance Monitor into a Java ap without using JNI. I can get the data from C++ or a .net language pretty easily and was going to create a service that would listen for socket requests and feed back the data. However, I'd like to start and stop that service when my java code starts and stops. Is this possible? Would it make more sense to just use a .exe and Runtime.exec()?

    If it's only to start or stop a service then you could use the net command without any need for JNI.import java.io.*;
    public class MsWinSvc {
        static final String CMD_START = "cmd /c net start \"";
        static final String CMD_STOP = "cmd /c net stop \"";
        public static int startService(String serviceName) throws Exception {
            return execCmd(CMD_START + serviceName + "\"");
        public static int stopService(String serviceName) throws Exception {
            return execCmd(CMD_STOP + serviceName + "\"");
        static int execCmd(String cmdLine) throws Exception {
            Process process = Runtime.getRuntime().exec(cmdLine);
            StreamPumper outPumper = new StreamPumper(process.getInputStream(), System.out);
            StreamPumper errPumper = new StreamPumper(process.getErrorStream(), System.err);
            outPumper.start();
            errPumper.start();
            process.waitFor();
            outPumper.join();
            errPumper.join();
            return process.exitValue();
        static class StreamPumper extends Thread {       
            private InputStream is;
            private PrintStream os;
            public StreamPumper(InputStream is, PrintStream os) {
                this.is = is;
                this.os = os;
            public void run() {
                try {
                    BufferedReader br = new BufferedReader(new InputStreamReader(is));
                    String line;
                    while ((line = br.readLine()) != null)
                        os.println(line);
                catch (Exception e) {
                    e.printStackTrace();
    }Regards

  • Starting applications from a Java GUI

    Hi,
    I am creating a main menu application that will act as a front end for users to a selection of other applications. They will use this main menu application to start any of the other applications.
    Most of these other application are written in Java, however, some of the applications have been written in Xview and until I can convert them to Java I have to be able to start them from my main menu application. When I exec these Xview applications they fail every time with the following message:
    X Error of failed request: Bad Access (attempt to access private resource denied)
    Major opcode of failed request: 89 (X_StoreColors)
    Serial number of failed request: 152
    current serial number in output stream: 153
    Now from what I can gather the problem is (apart from my lack of Xview knowledge) the Xview application is trying to change and lock the colormap which I assume is locked by the java application or something along these lines. I don't suppose anyone has come across this problem themselves and has any suggestions???
    Cheers
    Jim

    Welcome to the forums!
    Keynote does not support the use of AppleScript in that fashion.

  • Just now i started learning ABAP and basically from JAVA background.

    hi,
    Just now i started learning ABAP and basically from JAVA background.Can anyone tell me how to implement(steps) java in sap(from where i have to start).
    regards,
    Venkat.

    Hi Venkat,
         if u know java very well, then u can take up EP. ABAP is also very easy one to read and understand, as ur basically from prgming background.
    To start with go thro the classical abap and then come to abapoo.
    u can find so many link when u search for doc in sdn.
    all the best,
    Regards
    Sathish

  • Starting an executable system command from java

    I'm new to Java and i was wondering : is it possible to start an executable from Java under Windows? If so, how?
    Thanx

    There are only about 9 billion responses a day on how to do this. Use the search feature.

  • Start JavaFX application from Java

    Hello,
    I have the following scenario:
    I have a small JavaFX application and a big Java application. Now the Java App should call the JavaFX App to start up.
    Further the JavaFX App has to call some methods from the Java App. Is this possible?
    What is the best approach for my scenario?
    Maybe somebody has made some experiences ..
    thanks!
    Edited by: 799878 on 03.11.2010 07:54

    "Now the Java App should call the JavaFX App to start up."
    I'm assuming that the JavaFX code and the Java code are in the same application, correct? If so, then there are hacks available, but no standard way to start up JavaFX from Java will exist until the APIs have been ported from JavaFX script to Java.
    "Further the JavaFX App has to call some methods from the Java App. Is this possible?"
    Yes. Java can be called from JavaFX just fine. Just be careful if you use multi-threading or time consuming operations, since JavaFX script is apparently single threaded. Also be aware that netbeans normally compiles JavaFX applications with JSE version 1.5, so library features that did not exist until later versions will not be available by default.

  • Start java application from java program

    My problem is the following:
    I start a java application A that allows you to select a couple of .java files.
    After having choosen them, the application adds some additional information to these .java files (that means some more lines of code � we call it �infecting� the java files).
    After the files have been infected, I want to start the application B implemented by these choosen and infected .java-files (without a new start of the Java Virtual Machine)
    For doing so, we use the following method whichs works quite fine:
    public static void ExecuteWithInvoke(String path, String classname)
         try
              new URLClassLoader(new URL[] {new File(path).toURL()})
                   .loadClass(classname).getMethod("main",
                   new Class[] { String[].class }).invoke(null,
                   new Object[] { new String[] {} });
         catch (Exception e)
         {e.printStackTrace();}
    The only problem that occurs:
    When the application B is launched, the �old� version of the choosen .java files is used and not the current, already infected version of these files. (I guess because the �old� .class files are used.)
    I solved this problem by finishing the program A after the infecting and restart my application B manually. In this case the infected .java files are used (I guess the new Start of the Java Virtual Machine solves my problem by reloading the �new� .class files)
    How can I reach to start my application with the mentioned method but with the infected .java files and without having a new start of the JVM ??
    Can anybody help me?
    Thanks in advance
    Sorry for my English, it�s a long time since I quit school

    Hello,
    my problem of reloading classes is still unsolved although you tried to help me!
    Therefore I posted a little program to illustrate our difficulty.
    It would be nice if somebody could have a look at this program.
    We have a file Testdatei.java whose only method is the main method.
    I get the class object of this file and with the help of Reflection the declared methods.
    Evereything works fine so far.
    Then I change the content of this file by adding an additional method a() (see change() for this).
    Now I delete the old class file and I compile Testdatei.java again (see compileJava()) and once more I get the class object for this changed file. Afterwards I get the declared methods for this class via reflection.
    But instead of showing now the methods main() and a() Reflection still only shows the method main().
    I guess the changed class has not been reloaded!!
    package testpackage;
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.lang.reflect.Method;
    import java.net.URL;
    import java.net.URLClassLoader;
    import com.sun.tools.javac.Main;
    public class LoadClass
         private File f;
         private Class c = null;
         private Object o;
         public LoadClass()
              f = new File("C:/AAJ/src/testpackage/Testdatei.java");
              try
                   o = neuesExemplar(f.getPath(), "testpackage.Testdatei");
                   c = o.getClass();
                   System.out.println("Class " + c.getName() + " found.");
              catch (Exception e)
              {e.printStackTrace();}
              Method [] method = c.getDeclaredMethods();
              for (int i=0; i<method.length; i++)
                   System.out.println(method.getName());
              change();          
              compileJava(f.getPath());
              File fileToDelete = new File("bin/testpackage/Testdatei.class");
              System.out.println(fileToDelete.delete());
              Class cla = null;
              try
                   Object o = neuesExemplar(f.getPath(), "testpackage.Testdatei");
                   cla = o.getClass();
                   System.out.println("Class " + cla.getName() + " found.");
              catch (Exception e)
              {e.printStackTrace();}
              Method [] methods = cla.getDeclaredMethods();
              for (int i=0; i<methods.length; i++)
                   System.out.println(methods[i].getName());
         private int compileJava(String javaFile)
         String[] args = {"-d", "C:/AAJ/bin/", "-classpath", System.getProperty("java.class.path"), javaFile};
         return Main.compile(args);
         public static void main(String[] args)
              new LoadClass();
         private Object neuesExemplar(String pfad, String klassename) throws Exception
         URL url = new File(pfad).toURL();
         URLClassLoader cl = new URLClassLoader( new URL[]{ url });
         Class c = cl.loadClass(klassename);
         return c.newInstance();
         private void change()
              FileWriter fw;
              BufferedWriter bw;
              try
                   fw = new FileWriter(f);
                   bw = new BufferedWriter(fw);               
                   bw.write("package testpackage;");
                   bw.newLine();
                   bw.newLine();
                   bw.write("public class Testdatei");
                   bw.newLine();
                   bw.write("{");
                   bw.newLine();
                   bw.write("public static void main (String [] args)");
                   bw.newLine();
                   bw.write("{");
                   bw.write("System.out.println(4);");
                   bw.newLine();
                   bw.write("}");
                   bw.newLine();
                   bw.newLine();
                   bw.write("private void a ()");
                   bw.newLine();
                   bw.write("{");
                   bw.newLine();
                   bw.write("System.out.println(55);");
                   bw.newLine();
                   bw.write("}");
                   bw.newLine();
                   bw.write("}");
                   bw.close();
                   fw.close();               
              catch (IOException e)
              {e.printStackTrace();}                                             
    I�m using eclipse 3.1.0. Is it possible that it�s a bug in eclipse that eclipse holds the old class file in memory from the beginning and always refers to this one and not to the new compiled one?
    Thanks a lot
    Simon

Maybe you are looking for