I have this text file with this format
int | string | string | string |
int | string | string | string |
int | string | string | string |
.
.
.
Size of this file is about 80 MB. I have to read this file and after some evaluation add it to the database.
What I do is that I read one line and based on some condition I add them to the database. But this code is taking so long. It's been literally more than a day that I ran this code and no result yet!
What can I do to make it faster.
I know there should be some way to read the whole file at once.
BTW I'm using mysql
Help me out guys!
Here is my code
public void fill_names_db() throws Exception{
    MySQLAccess dao = new MySQLAccess();   
    Scanner stringScanner;
    BufferedReader in = new BufferedReader(new FileReader("C:\\Users\\havij\\Downloads\\taxdump\\names.dmp"));
    String tax_id;
    String name_txt;
    String unique_name;
    String name_class;
    Connection connect=null;
    connect = dao.newConnection();
    while (in.ready()) {
        String s = in.readLine();
        //System.out.println(s);
        stringScanner = new Scanner(s).useDelimiter("\t|\t");
        tax_id = stringScanner.next();
        stringScanner.next();
        name_txt = stringScanner.next();
        stringScanner.next();
        unique_name = stringScanner.next();
        stringScanner.next();
        name_class = stringScanner.next();
        if(name_class.equals("scientific name"))
            dao.insertToDB(connect, "id_to_name", tax_id.toString(), name_txt);
        if(dao.hasKey(connect,"name_to_id",name_txt))
            if (!unique_name.isEmpty())
                dao.insertToDB(connect, "name_to_id",unique_name,tax_id.toString(),name_txt,unique_name, name_class );
        else if(!name_txt.isEmpty())
            dao.insertToDB(connect, "name_to_id",name_txt,tax_id.toString(),name_txt,unique_name, name_class );
    }
    dao.close(connect);
    in.close();
    System.out.println("done");
    }