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 8861159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:25:51+00:00 2026-06-14T15:25:51+00:00

Suppose there is folder in C:\fileupload which contains these two csv files: file1.csv has

  • 0

Suppose there is folder in C:\fileupload which contains these two csv files:


file1.csv has 2 columns(VendorID,Name)


file2.csv has 2 columns(VendorID,address)///// here VendorID is corresponding to file1.csv and is randomly placed in file2.csv

suppose file1.csv contains :


101,vendor1
102,vendor2


file2.csv contains
102,australia
101,USA


i want to retrive data from these two files and store in oracle database as:

VendorID,Name,Address


101,vendor1,USA
102,vendor2,australia

and plz be specific in telling me through java only
Any help will be much appreciated.

Thanks

  • 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-14T15:25:53+00:00Added an answer on June 14, 2026 at 3:25 pm

    textfile1.csv

    loginid3,password3
    loginid5,password5
    loginid1,password1
    loginid4,password4
    loginid2,password2
    

    textfile2.csv

    loginid3,address3
    loginid2,address2
    loginid1,address1
    loginid5,address5
    loginid4,address4
    

    output:

    Key : loginid3 Value : password3 address :address3
    Key : loginid2 Value : password2 address :address2
    Key : loginid1 Value : password1 address :address1
    Key : loginid4 Value : password4 address :address4
    Key : loginid5 Value : password5 address :address5
    

    CSVReadLoginPass.java

    import java.io.BufferedReader;
    import java.io.DataInputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.InputStreamReader;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    
    
    public class CSVReadLoginPass {
    
     public static  Map<String,String> map1 = null;
     public static  Map<String,String> map2 = null;
      public static void main(String[] args) {
    
          try
          {
              readFileandPopulate();
              for (Map.Entry<String, String> entry : map1.entrySet()) {
                    System.out.println("Key : " + entry.getKey() + " Value : "
                        + entry.getValue()+" address :"+map2.get(entry.getKey()));
                    //insert into DB
                }
                }catch (Exception e){//Catch exception if any
                    e.printStackTrace();
              System.err.println("Error: " + e.getMessage());
              }
    
      }
      public static void readFileandPopulate() throws Exception
      {
    
    
          FileInputStream fstream = new FileInputStream("E:\\Eclipse-Leo\\StackOverflow\\src\\resources\\textfile1.csv");
          DataInputStream in = new DataInputStream(fstream);
          BufferedReader br = new BufferedReader(new InputStreamReader(in));
          String strLine;
          map1 = new HashMap<String,String>();
              while ((strLine = br.readLine()) != null)   {
                  System.out.println(strLine);
              String temp[] = strLine.split(",");
              map1.put(temp[0], temp[1]);
    
          }
         in.close();
         System.out.println("done 1");
    
    
         FileInputStream fstream2 = new FileInputStream("E:\\Eclipse-Leo\\StackOverflow\\src\\resources\\textfile2.csv");
          DataInputStream in2= new DataInputStream(fstream2);
          BufferedReader br2 = new BufferedReader(new InputStreamReader(in2));
          String strLine2;
              map2 = new HashMap<String,String>();
              while ((strLine2 = br2.readLine()) != null)   {
                  System.out.println(strLine2);
              String temp[] = strLine2.split(",");
              map2.put(temp[0], temp[1]);
    
          }
         in2.close();
      }
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose i have one folder and inside that another two files are there .
Suppose there is a table A which has a column AccessRights which is multivalued(
Suppose there are two lists a = {a1, a2, a3} and b = {b1,
Suppose there is a System A which gives some output. This output is used
Please Try to Understand my curiosity Suppose there is a web application that has
Hy, suppose you got many files in a folder and you want first to
Suppose that group A has its path set to folder A in the finder,
I am trying to run these two .data files from my c++ code for
Suppose I have a folder with a few files, images, texts, whatever, it only
I have a very simple question. Lets suppose there is C# project name Game

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.