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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:28:28+00:00 2026-06-15T15:28:28+00:00

I have a database in which i have 3 columns (id, name, info_link). I

  • 0

I have a database in which i have 3 columns (id, name, info_link).

I have the id and names stored in the database.

I have a text file where i have all the info links scraped.

Info link is in the form of : http://someURL/**Name**.htm

Now what I want to do is Take a name from the database, read a line from the text file of links, find if the link(line) contains that drug name, put that link in the info_link column of the record.

This is what my code is

BufferedReader reader = new BufferedReader(new FileReader("./Links.txt"));
BufferedWriter writer = new BufferedWriter(new FileWriter("./AddedLinks.txt"));
int id = 1;
//Creates a connection to the Database
connection = DriverManager.getConnection(DB_URL,DB_USER,DB_PASS);

statement = connection.createStatement();
for(id=1;id<=1153;)
{   
   query = statement.executeQuery("SELECT name FROM drug_list WHERE id = '"+id+"';");
   query.next();
   String name = query.getString(1);
   String words[] = name.split(" ");
   String Myvalue = reader.readLine();
   boolean Found = false;
   while(!Found)
      if(Myvalue.toLowerCase().contains(words[0].toLowerCase()))
      {
         Boolean f = false;
         System.out.println("Found"+name);
         update = connection.prepareStatement("UPDATE drug_list SET info_link = ? WHERE id = ?;");
         update.setString(1, Myvalue);
         update.setInt(2, id);
         f = update.execute();
         if(!f)
         {
            System.out.println("QSE");
            id++;
            writer.write(Myvalue);
            Found = true;
         }

      }
      else
      {
         System.out.println("Could Not Find"+name+"\n");
         id++;
         Found = false;
      }
}

I am able to match the container links that have to be processed on Single Words. But the problem is

I have a drug names like

  • Albuterol (Salbutamol)
  • Dorzolamide/Timolol

etc..

And Their Corresponding Links like :

 - http://Somelink/**albuterol_salbutamol**.htm
 - http://Somelink/**dorzolamide_timolol**.htm

Also there are a few Names in the Database that do not have a corresponding link in the text file, i also want to skip those. I have 1153 Values in total in my database.

Also I have a few drug names like

  • Calcium Something
  • Calcium Something Something
  • Calcium Not Something

So this creates a problem IF i am matching just the word[0] that i split up. Because it will update all the values for Calcium Something Field Only.

  • 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-15T15:28:29+00:00Added an answer on June 15, 2026 at 3:28 pm

    You use a regex to split the words. Something like

    String words[] = a.split("[/()]");
    

    and iterate over and check all the words instead of just one word.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one database table which contains 8 columns. One of the columns is
I have an Ultrawingrid to which I am binding some columns from the database.
I am using mysql 5.0. I have a stored procedure which gets all the
I have database with following columns: id, parent, name, description The id has been
I have info in a database which can have different versions per entity. I
i have a database in MySql that has a name column in it which
I have three textfields (ID,Name,Address) which reflects columns in DB table i'm trying to
I have a database table named tree1, which has a table names student_details.This table
I have a gridview with 3 columns Name,Surname,Change(ButtonField column) which is populated from an
I have a table in my database (Mysql) which has 6 columns. I am

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.