Solving task 1 by 1 from bundle of task data

Solving task 1 by 1 from bundle of task data

Hello and namaste guys, i really need help here.i use ResultSet to query data from database. as we know, it query row by row using while (ResultSet()) this means, i have a lot of row.row means task.in each task, there will be an information like userid, Taskid, user_input

i have to use the information for eash task to solve the task it self.the problem im facing now is the code is just solve for the last data in result set.what should i do so that the solve code solve data 1 by 1?do i need to use array?what kind of array?

View Answers

April 7, 2011 at 3:16 PM

import java.sql.*;
import java.util.*;
class  Retrieve{
public static void main(String[] args){
    try{
           Class.forName("com.mysql.jdbc.Driver");
           Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
           Statement st=con.createStatement();
           ResultSet rs=st.executeQuery("select * from employee");

           ArrayList name=new ArrayList();
           ArrayList address=new ArrayList();
           ArrayList contact=new ArrayList();
           ArrayList email=new ArrayList();

           while(rs.next()){
             name.add(rs.getString("name"));
              address.add(rs.getString("address"));
              contact.add(rs.getInt("contactNo"));
              email.add(rs.getString("email"));
              }
           for(int i=0;i<name.size();i++){
           System.out.println(name.get(i)+"\t"+address.get(i)+"\t"+contact.get(i)+"\t"+email.get(i));
           }
    }
    catch(Exception e){
    System.out.println(e);
    }

    }
}

April 7, 2011 at 8:40 PM

using arraylist makes me more problem because i need to pass the value to the constructor.ive tried to change to single array,but got error.cannot find symbol constructor...

for(int i=0;i<count;i++)
                    {
                        String user_input = input[i];
                        int t_number = t_num[i];
                        String user_id = id[i];
                        int taskid = task_id[i];

                        Tway gen = new Tway(user_input , t_number , user_id , taskid);
                        gen.solve();

                     }

whats ive done wrong?









Related Tutorials/Questions & Answers:
Solving task 1 by 1 from bundle of task data
Solving task 1 by 1 from bundle of task data  Hello and namaste guys, i really need help here.i use ResultSet to query data from database. as we know... set.what should i do so that the solve code solve data 1 by 1?do i need to use
task 1 - Java Beginners
task 1  Please write a Java client that send a small letters string to a Java server which convert it to uppercase letters and send it back to the client. Please submit both the client and server programs  Hi Friend
Advertisements
data insertion and fetch 1
data insertion and fetch 1  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <... rs = (ResultSet) request.getAttribute("data"); while...; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ insert int data base @@@@@@@@@ import
1 year data science masters
1 year data science masters  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: 1 year data... can learn the topic "1 year data science masters". Also tell me which
master data science in 1 month
master data science in 1 month  Hi, I am beginner in Data Science... data science in 1 month Try to provide me good examples or tutorials links so that I can learn the topic "master data science in 1 month". Also tell
1 year masters in data science
1 year masters in data science  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: 1 year... that I can learn the topic "1 year masters in data science". Also tell
data science 1 year masters
data science 1 year masters  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data... can learn the topic "data science 1 year masters". Also tell me which
data science 1 year course
data science 1 year course  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data science... learn the topic "data science 1 year course". Also tell me which
1 year masters data science
1 year masters data science  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: 1 year... can learn the topic "1 year masters data science". Also tell me which
masters in data science 1 year
masters in data science 1 year  Hi, I am beginner in Data Science... in data science 1 year Try to provide me good examples or tutorials links so that I can learn the topic "masters in data science 1 year". Also tell
Generate random numbers from 1 to 100
Generate random numbers from 1 to 100  1)A class Called: RandomNumberGenerator that generate random numbers from 1 to 100 2)A class Test that tests... an object from the Random NumberGenerator class to generate your input test data
print the sum of even number from 1 to 100
print the sum of even number from 1 to 100  how to print the sum of even number from 1 to 100 using for loops? Thanks
udemy master data science in 1 month
udemy master data science in 1 month  Hi, I am beginner in Data...: udemy master data science in 1 month Try to provide me good examples or tutorials links so that I can learn the topic "udemy master data science in 1
1 year masters programs in data science
1 year masters programs in data science  Hi, I am beginner in Data...: 1 year masters programs in data science Try to provide me good examples or tutorials links so that I can learn the topic "1 year masters programs
passing from 1 jsp to another - JSP-Servlet
passing from 1 jsp to another  Hi Sir, What are the ways and means of passing from 1 jsp page to another page.what are the different types of methods?  Hi Friend, You can use tag,sedRedirect() method
How to Create Multiplication Table from 1 to 10?
How to Create Multiplication Table from 1 to 10?  Hi, I want... table 1 to 10. Please suggest online example related to creating multiplication table. Thanks   Hi, Did you want to create multiplication table 1
task
Java task scheduling
Java task scheduling  What is a task?s priority and how is it used in scheduling
Java task scheduling
Java task scheduling  What is a task?s priority and how is it used in scheduling
Create Multiplication Table from 1 to 10
to create multiplication table from 1 to 10. For this purpose, we have created...]; for (int i=1; i<array.length; i++) { for (int j=1; j<array[i].length; j++) { array[i][j] = i
display the hidden text from that row, when onclick on a row of 1- 10
display the hidden text from that row, when onclick on a row of 1- 10  Using JSP: I'm displaying a set of values from the databse in a table rows (1... created to show: <TABLE cellpadding="15" border="1" style="background-color
ModuleNotFoundError: No module named 'task'
ModuleNotFoundError: No module named 'task'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'task' How to remove the ModuleNotFoundError: No module named 'task' error
ModuleNotFoundError: No module named 'task'
ModuleNotFoundError: No module named 'task'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'task' How to remove the ModuleNotFoundError: No module named 'task' error
task 2 - Java Beginners
task 2  Write a time server that follows the time protocol outlined in RFC 868. When a client connects, the server sends a 4-byte, big-endian..., January 1, 1970 GMT (the epoch
Java Timer Task
Java Timer Task  How to assign a task in java at specified date & time (with seconds) using threads
problem 1 - Java Beginners
. Method to input data from the data file Method to display the table...problem 1   Hi, please help me!!!! How can i code in java using.... this is my input data file: 88 90 94 102 111 122 134 75 77 80 86 94 103 113 80
ModuleNotFoundError: No module named 'aio-task'
ModuleNotFoundError: No module named 'aio-task'  Hi, My Python...-task' How to remove the ModuleNotFoundError: No module named 'aio-task... to install padas library. You can install aio-task python with following
ModuleNotFoundError: No module named 'cubicweb-task'
ModuleNotFoundError: No module named 'cubicweb-task'  Hi, My... 'cubicweb-task' How to remove the ModuleNotFoundError: No module named 'cubicweb-task' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'django-task'
ModuleNotFoundError: No module named 'django-task'  Hi, My Python... 'django-task' How to remove the ModuleNotFoundError: No module named 'django-task' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'ecs-task'
ModuleNotFoundError: No module named 'ecs-task'  Hi, My Python...-task' How to remove the ModuleNotFoundError: No module named 'ecs-task... to install padas library. You can install ecs-task python with following
ModuleNotFoundError: No module named 'pangu-task'
ModuleNotFoundError: No module named 'pangu-task'  Hi, My Python... 'pangu-task' How to remove the ModuleNotFoundError: No module named 'pangu-task' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'prediction-task'
ModuleNotFoundError: No module named 'prediction-task'  Hi, My... named 'prediction-task' How to remove the ModuleNotFoundError: No module named 'prediction-task' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'py-task'
ModuleNotFoundError: No module named 'py-task'  Hi, My Python...-task' How to remove the ModuleNotFoundError: No module named 'py-task... to install padas library. You can install py-task python with following command
ModuleNotFoundError: No module named 'scheduled-task'
ModuleNotFoundError: No module named 'scheduled-task'  Hi, My... named 'scheduled-task' How to remove the ModuleNotFoundError: No module named 'scheduled-task' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'scrape-task'
ModuleNotFoundError: No module named 'scrape-task'  Hi, My Python... 'scrape-task' How to remove the ModuleNotFoundError: No module named 'scrape-task' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'slider-task'
ModuleNotFoundError: No module named 'slider-task'  Hi, My Python... 'slider-task' How to remove the ModuleNotFoundError: No module named 'slider-task' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'slider-task'
ModuleNotFoundError: No module named 'slider-task'  Hi, My Python... 'slider-task' How to remove the ModuleNotFoundError: No module named 'slider-task' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'slider-task'
ModuleNotFoundError: No module named 'slider-task'  Hi, My Python... 'slider-task' How to remove the ModuleNotFoundError: No module named 'slider-task' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'sqs-task'
ModuleNotFoundError: No module named 'sqs-task'  Hi, My Python...-task' How to remove the ModuleNotFoundError: No module named 'sqs-task... to install padas library. You can install sqs-task python with following
ModuleNotFoundError: No module named 'Task_allocator'
ModuleNotFoundError: No module named 'Task_allocator'  Hi, My... named 'Task_allocator' How to remove the ModuleNotFoundError: No module named 'Task_allocator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Task_allocator'
ModuleNotFoundError: No module named 'Task_allocator'  Hi, My... named 'Task_allocator' How to remove the ModuleNotFoundError: No module named 'Task_allocator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'task-dispatcher'
ModuleNotFoundError: No module named 'task-dispatcher'  Hi, My... named 'task-dispatcher' How to remove the ModuleNotFoundError: No module named 'task-dispatcher' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'task-distribute'
ModuleNotFoundError: No module named 'task-distribute'  Hi, My... named 'task-distribute' How to remove the ModuleNotFoundError: No module named 'task-distribute' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'task-estimator'
ModuleNotFoundError: No module named 'task-estimator'  Hi, My... named 'task-estimator' How to remove the ModuleNotFoundError: No module named 'task-estimator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'task-dispatcher'
ModuleNotFoundError: No module named 'task-dispatcher'  Hi, My... named 'task-dispatcher' How to remove the ModuleNotFoundError: No module named 'task-dispatcher' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'task-distribute'
ModuleNotFoundError: No module named 'task-distribute'  Hi, My... named 'task-distribute' How to remove the ModuleNotFoundError: No module named 'task-distribute' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'task-estimator'
ModuleNotFoundError: No module named 'task-estimator'  Hi, My... named 'task-estimator' How to remove the ModuleNotFoundError: No module named 'task-estimator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'task-indicator'
ModuleNotFoundError: No module named 'task-indicator'  Hi, My... named 'task-indicator' How to remove the ModuleNotFoundError: No module named 'task-indicator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'task-indicator'
ModuleNotFoundError: No module named 'task-indicator'  Hi, My... named 'task-indicator' How to remove the ModuleNotFoundError: No module named 'task-indicator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'task-mcmc'
ModuleNotFoundError: No module named 'task-mcmc'  Hi, My Python... 'task-mcmc' How to remove the ModuleNotFoundError: No module named 'task... have to install padas library. You can install task-mcmc python with following

Ads