Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8028573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:10:28+00:00 2026-06-05T00:10:28+00:00

I am using a tool called LogMiner in Oracle for my project. I am

  • 0

I am using a tool called LogMiner in Oracle for my project. I am using Oracle 10g on a Windows 7 32 bit machine.

In order to start the log miner tool I log on into sqlplus and execute the following query:

 //Query to create flat file

 alter system set utl_file_dir='C:\oracle\product\10.2.0\logminer_dir' scope=spfile;
 shutdown immediate
 startup
 show parameter utl_file_dir
 SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM V$DATABASE;    
 ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;

 SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM V$DATABASE;
 alter system switch logfile;

This PL/SQL query runs fine using sqlplus but now I want to run the same using jdbc in Java

I have written the following code for it as follows:

    package src;
    import java.awt.event.ActionEvent;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Statement;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.WindowConstants;
    import javax.swing.SwingUtilities;

    public class LogMiner extends javax.swing.JFrame {
      private JLabel jLabel1;
      private JButton jButton1;
      private JButton jButton4;
      private JButton jButton3;
      private JButton jButton2;


public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            LogMiner inst = new LogMiner();
            inst.setLocationRelativeTo(null);
            inst.setVisible(true);
        }
    });
}

public LogMiner() {
    super();
    initGUI();
}

private void initGUI() {
    try {
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(null);
        {
            jLabel1 = new JLabel();
            getContentPane().add(jLabel1);
            jLabel1.setText("LogMiner Tool");
            jLabel1.setBounds(236, 18, 97, 21);
        }
        {
            jButton1 = new JButton();
            getContentPane().add(jButton1);
            jButton1.setText("Create the flat file");
            jButton1.setBounds(212, 71, 133, 28);
        }
        pack();
        setSize(600, 400);
    } catch (Exception e) {

        e.printStackTrace();
    }




 jButton1.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {

        //write query statement
            try
              {
               // load oracle driver
              Class.forName("oracle.jdbc.driver.OracleDriver");
              // connect using Thin driver
              Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:test","system","oracle");
              System.out.println("Connected Successfully To Oracle");
                      //getting errors in the following line...need help here
              String sql="alter system set                              
                     utl_file_dir='C:\oracle\product\10.2.0\logminer_dir'scope=spfile;"
                     +"shutdown immediate"+
                     "startup"+
                     "show parameter utl_file_dir"+
                     "SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM V$DATABASE"+
                     "alter system switch logfile";


                      Statement statement = con.createStatement();
              ResultSet resultset = statement.executeUpdate(sql);  

           resultset.next();
           String s = resultset.getString(1);      
           System.out.println(s);
          statement.close();
              con.close();
              }
              catch(Exception ex)
              {
                ex.printStackTrace();
              }

               }

         });

     }

    }

How should I write the same query in Java for proper execution? Can someone please tell me ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T00:10:31+00:00Added an answer on June 5, 2026 at 12:10 am

    There are several problems with your code:

    1. you cannot run more than one statement with a single executeUpdate() call
    2. executeUpdate() will never return a result set, you need to use execute() or executeQuery()
    3. shutdown and startup are SQL*Plus commands and cannot be executed through JDBC. Since 11.1 there is however an extension in Oracle’s JDBC driver that will allow you to do so: http://docs.oracle.com/cd/E11882_01/java.112/e16548/dbmgmnt.htm#CHDJABJI
      However I don’t know if this will also work with Oracle 10 (which by the way is de-supported if I’m not mistaken, you should upgrade to 11.x anyway)
    4. show parameter is a SQL*Plus command that you cannot run from JDBC. You need to run a select * from v$parameter instead.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am analyzing the following piece of code using a static analysis tool called
I developed a Windows command line tool using C, and compiled it in VC++,
i wrote a C tool to mess around with the windows kernel a bit.
I am using a tool called TopQuadrant to create a Semantic Web (RDF/OWL) Ontology.
I am using a mapping tool by Altova called mapForce. I am using it
I am using an automated build tool called Automated Build Studio . I have
I'm using a test-generating tool called KLEE, that creates lots of tests for my
For a while we were using a tool called CodeVeil. I'm just wondering if
I'm using a python tool called Ajaxterm(http://wiki.kartbuilding.net/index.php/Ajaxterm). After setting it up. The problem ,
I am trying to build a tool called sscep (http://www.klake.org/~jt/sscep/) for Windows. It does

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.