How to point on value from csv file and compare it to values from MySQL DB table? [closed]











up vote
-2
down vote

favorite












I have MySQL DB table my_dictionary, containing soundex_code,word, translation



Also, I have a csv file containing sentences separated by ','. Each sentence contains a set of words separated by ' '.



I would like to read each word from the csv file and compare it with values of the column soundex_code from my_dictionary. And return its equivalent 'translation'
I started this code but I didn't know how to point on each word from my csv file and compare it.



import java.sql.*;

public class dbConnection {

public static void main (String args) throws Exception {
String url = "jdbc:mysql://localhost:3306/dictionary";
String user = "root";
String password = "";
String query = "select translation from my_dictionary where soundex_code='3tl00'";

Class.forName("com.mysql.cj.jdbc.Driver");
Connection con = DriverManager.getConnection(url, user, password);

Statement st = con.createStatement();
ResultSet rs = st.executeQuery(query);
rs.next();
String name = rs.getString("translation");


System.out.println(name);
st.close();
con.close();

}

}









share|improve this question















closed as off-topic by Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal Nov 17 at 2:05


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.









  • 1




    Hello and welcome to Code Review! I'm afraid your question is off-topic because our site only handles questions about working code.
    – Graham
    Nov 17 at 0:16















up vote
-2
down vote

favorite












I have MySQL DB table my_dictionary, containing soundex_code,word, translation



Also, I have a csv file containing sentences separated by ','. Each sentence contains a set of words separated by ' '.



I would like to read each word from the csv file and compare it with values of the column soundex_code from my_dictionary. And return its equivalent 'translation'
I started this code but I didn't know how to point on each word from my csv file and compare it.



import java.sql.*;

public class dbConnection {

public static void main (String args) throws Exception {
String url = "jdbc:mysql://localhost:3306/dictionary";
String user = "root";
String password = "";
String query = "select translation from my_dictionary where soundex_code='3tl00'";

Class.forName("com.mysql.cj.jdbc.Driver");
Connection con = DriverManager.getConnection(url, user, password);

Statement st = con.createStatement();
ResultSet rs = st.executeQuery(query);
rs.next();
String name = rs.getString("translation");


System.out.println(name);
st.close();
con.close();

}

}









share|improve this question















closed as off-topic by Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal Nov 17 at 2:05


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.









  • 1




    Hello and welcome to Code Review! I'm afraid your question is off-topic because our site only handles questions about working code.
    – Graham
    Nov 17 at 0:16













up vote
-2
down vote

favorite









up vote
-2
down vote

favorite











I have MySQL DB table my_dictionary, containing soundex_code,word, translation



Also, I have a csv file containing sentences separated by ','. Each sentence contains a set of words separated by ' '.



I would like to read each word from the csv file and compare it with values of the column soundex_code from my_dictionary. And return its equivalent 'translation'
I started this code but I didn't know how to point on each word from my csv file and compare it.



import java.sql.*;

public class dbConnection {

public static void main (String args) throws Exception {
String url = "jdbc:mysql://localhost:3306/dictionary";
String user = "root";
String password = "";
String query = "select translation from my_dictionary where soundex_code='3tl00'";

Class.forName("com.mysql.cj.jdbc.Driver");
Connection con = DriverManager.getConnection(url, user, password);

Statement st = con.createStatement();
ResultSet rs = st.executeQuery(query);
rs.next();
String name = rs.getString("translation");


System.out.println(name);
st.close();
con.close();

}

}









share|improve this question















I have MySQL DB table my_dictionary, containing soundex_code,word, translation



Also, I have a csv file containing sentences separated by ','. Each sentence contains a set of words separated by ' '.



I would like to read each word from the csv file and compare it with values of the column soundex_code from my_dictionary. And return its equivalent 'translation'
I started this code but I didn't know how to point on each word from my csv file and compare it.



import java.sql.*;

public class dbConnection {

public static void main (String args) throws Exception {
String url = "jdbc:mysql://localhost:3306/dictionary";
String user = "root";
String password = "";
String query = "select translation from my_dictionary where soundex_code='3tl00'";

Class.forName("com.mysql.cj.jdbc.Driver");
Connection con = DriverManager.getConnection(url, user, password);

Statement st = con.createStatement();
ResultSet rs = st.executeQuery(query);
rs.next();
String name = rs.getString("translation");


System.out.println(name);
st.close();
con.close();

}

}






java mysql csv






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 17 at 0:55









Graham

538113




538113










asked Nov 16 at 23:24









Jihene Sassi

1




1




closed as off-topic by Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal Nov 17 at 2:05


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.




closed as off-topic by Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal Nov 17 at 2:05


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.








  • 1




    Hello and welcome to Code Review! I'm afraid your question is off-topic because our site only handles questions about working code.
    – Graham
    Nov 17 at 0:16














  • 1




    Hello and welcome to Code Review! I'm afraid your question is off-topic because our site only handles questions about working code.
    – Graham
    Nov 17 at 0:16








1




1




Hello and welcome to Code Review! I'm afraid your question is off-topic because our site only handles questions about working code.
– Graham
Nov 17 at 0:16




Hello and welcome to Code Review! I'm afraid your question is off-topic because our site only handles questions about working code.
– Graham
Nov 17 at 0:16















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Сан-Квентин

8-я гвардейская общевойсковая армия

Алькесар