-1

I have written an application that fetching records from one DB and runs all those data in another DB to check proper error less data.

ir in DB1 i have million records, My application fetches 1000 records from DB1 and runs a query in another db say DB2 with those records to find out proper data.

My problem here is java by default fetches only 1000 records, but i would need to fetch minimum of 6000 records

How can i do that in java, and I am using preparedStatement (My researches on google and stackoverflow says FetchSize cannot be used for prepare statement)

Is there any special function or shld we write an algorithm to fetch 6000 data and add them to an ArrayList and use that in another DB ???

3
  • yeah.. but when wrong info is entered it has to respond in a correct way Commented Sep 2, 2014 at 12:03
  • This is not duplicate !!!! I wanted to knw how it can be handled in java!!! Commented Sep 2, 2014 at 12:46
  • Handling in database is different !! handling from java side is different.. kindly do not mark this as duplicate !!, I can even use idno in that table and check from db end.. but from coding side also people should know.. i did thorough check before raising this question! Commented Sep 2, 2014 at 12:48

1 Answer 1

0

when you are entering the wrong password..the query is returning..null. And thats why its showing error. so you need to check if the query returning a value means if resultset is not null. then only need to check the username ok. so if query returns null means its a wrong password so you can set auth=false. and redirect to the same login page itself.

And before redirecting to login page either you can set a errorlabel value as "please enter the correct login credentials"

this error label should be invisible intially and when you enter wrong password change its visibility and set the message. or you can show a message box with the message.

Sign up to request clarification or add additional context in comments.

2 Comments

should i use resultSet.wasNull() ???
if(r!=null){ while(r.next()){ if(r.getString(1).equalsIgnoreCase("1")){ user=r.getString(2); //System.out.println(user); tester=r.getString(3); //System.out.println(tester); if(tester.equalsIgnoreCase(password)){ System.out.println("success"); auth=user; System.out.println(auth); }} }}else { System.out.println("Error"); auth="failed"; System.out.println(auth); }

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.