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

  • SEARCH
  • Home
  • 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 9009961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:20:06+00:00 2026-06-16T02:20:06+00:00

I have a method that extracts and cleans data from a MySQL database. Next

  • 0

I have a method that extracts and cleans data from a MySQL database.

Next step in the process is moving this data to Oracle database.

However, during the process of extracting and cleaning the data from MySQL, I have a coninous connection to the oracle db. This is not nescessary and extremely slows down the extraction process.

How do I let java wait till the extracion/cleaning processes are complete and THEN make a connection to Oracle?

This is my code:

public void ConvertFiles() {

    try {

        connectToDB();

        RawFile tempFile = new RawFile(super.mFileType);
        try {
            ArrayList<String> values = new ArrayList<String>();

            try {
                Statement stmt = conn.createStatement();
                ResultSet result = stmt.executeQuery("SELECT * FROM coffeedata");
                int ii = 0;
                while (result.next()) {
                    ii++;
                    System.out.print("Reading Row:" + ii + "/" + 41429 + "\n");
                    mStore = (result.getString(1));
                    mCategory = (result.getString(2));
                    mName = (result.getString(3));

                    // Add columns 2007 Q1 - Q4 t/m 2009 Q1 - Q2 to ArrayList   


                    for (int i = 4; i < 14; i++) {
                        values.add("" + result.getInt(i));

                    }
                    tempFile.addData(new SQLData(mCategory, mName, values, mStore));

                    try {
                        OracleController.DataToOracle();

                    } catch (Exception e) {
                        System.out.println(e.getMessage());

                    }
                }

                tempFile.CleanCategory();
                mRawFiles.add(tempFile);

            } catch (Exception e) {
                System.out.println(e.getMessage());
                closeDBConnection();

            }
        } catch (Exception e) {
            System.out.println(e.getMessage());
            //return values;
            //System.out.println(values);


        }
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }

For clarification: I want to let this Try wait till the previous one is completed:

try {
    OracleController.DataToOracle();

}
  • 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-16T02:20:07+00:00Added an answer on June 16, 2026 at 2:20 am

    Refactor your code and place your try block after try - catch - finallythat you want to wait.

    try{
        //block that you need to excecute before
    } catch { ... }
    // Than your block
    try {
         OracleController.DataToOracle();
     } catch (Exception e)
    
    
                        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a process that extracts customer info from multiple databases (MySql) based on
I have a process that extracts customer info from multiple databases (MySql) based on
I have a method that hash input string to generate MD5 pass from it
A query (see below) that extracts climate data from weather stations within a given
I have a method that extracts the 8bit value (below), although my impression of
I have around 30 scenarios that all bar one require this step to be
I have a method that extracts multiple zip files but can't delete them until
I have method that returns Drawable , and if its Bitmap object is recycled
I have method that returned NSManagedObject and I don't know what kind of NSManagedObject
I have method that returns module path of given class name def findModulePath(path, className):

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.