| Author |
Problem in retrieving data and store it in string
|
Micheal John
Ranch Hand
Joined: Nov 01, 2006
Posts: 344
|
|
I am running an application in tomcat 5.0. I have used the following coding for retreving the data from db and store it in string: The above coding worked properly. I have added one new employee and the above code is not working and in the tomcat console it's just hacked. I have copied that below. If i am deleting the added user,then the application is working. What will be problem??? From TOmcat Console [CONSOLE] sql ::SELECT EMPLOYEEID,EMPLOYEENAME FROM EMPLOYEEINFO WHERE ACTIVATIONSTATUS='Y ' AND EMPLOYEEGRADE LIKE 'E%' ORDER BY EMPLOYEENAME in while EmployeeInfo ::-Select-~-Select- in while EmployeeInfo ::-Select-~-Select-^6000~Mukesh Ambani in while EmployeeInfo ::-Select-~-Select-^6000~Mukesh Ambani^6001~Tom in while EmployeeInfo ::-Select-~-Select-^6000~Mukesh Ambani^6001~Tom^9000~anil kumar in while EmployeeInfo ::-Select-~-Select-^6000~Mukesh Ambani^6001~Tom^9000~anil kumar^1000~asdad in while EmployeeInfo ::-Select-~-Select-^6000~Mukesh Ambani^6001~Tom^9000~anil kumar^1000~asdad^9002~ganesh in while EmployeeInfo ::-Select-~-Select-^6000~Mukesh Ambani^6001~Tom^9000~anil kumar^1000~asdad^9002~ganesh^9001~hari in while EmployeeInfo ::-Select-~-Select-^6000~Mukesh Ambani^6001~Tom^9000~anil kumar^1000~asdad^9002~ganesh^9001~hari^6002~jack in while EmployeeInfo ::-Select-~-Select-^6000~Mukesh Ambani^6001~Tom^9000~anil kumar^1000~asdad^9002~ganesh^9001~hari^6002~jack^7878~pete in while EmployeeInfo ::-Select-~-Select-^6000~Mukesh Ambani^6001~Tom^9000~anil kumar^1000~asdad^9002~ganesh^9001~hari^6002~jack^7878~pete^9005~pravin _ [/CODE]
|
Micheal John
SCJP 1.4 (86%), SCWCD 1.4 (86%), SCBCD 1.3 (85%), SCDJWS (Just Started...) - Satisfaction Lies in Our EFFORT, Not in the ATTAINMENT
|
 |
Bill Johnston
Ranch Hand
Joined: Nov 17, 2005
Posts: 194
|
|
"The above coding worked properly. I have added one new employee and the above code is not working" Not sure if it's working or not?
|
~Bill
|
 |
Micheal John
Ranch Hand
Joined: Nov 01, 2006
Posts: 344
|
|
I executed the below query in the toad and it returned 12 rows. SELECT EMPLOYEEID,EMPLOYEENAME FROM EMPLOYEEINFO WHERE EMPLOYEEGRADE LIKE 'E%' AND ACTIVATIONSTATUS='Y' ORDER BY EMPLOYEENAME By the coding, It's returning upto the record 9000-pravin and it is stored in the string EmployeeInfo, after that it just hanged and nothing is happening and the page is keep on loading. Since I am having only limited records (12 records only), why it is not returning all the records..?
|
 |
A Kumar
Ranch Hand
Joined: Jul 04, 2004
Posts: 973
|
|
|
Can you paste the code where you are invoking this method..
|
 |
Micheal John
Ranch Hand
Joined: Nov 01, 2006
Posts: 344
|
|
I executed the below query in the toad and it returned 12 rows. SELECT EMPLOYEEID,EMPLOYEENAME FROM EMPLOYEEINFO WHERE EMPLOYEEGRADE LIKE 'E%' AND ACTIVATIONSTATUS='Y' ORDER BY EMPLOYEENAME By the coding, It's returning upto the record 9000-pravin and it is stored in the string EmployeeInfo, after that it just hanged and nothing is happening and the page is keep on loading. Since I am having only limited records (12 records only), why it is not returning all the records..?
|
 |
A Kumar
Ranch Hand
Joined: Jul 04, 2004
Posts: 973
|
|
Hi micheal, Can you paste the code ... where you invoke...this method .. getEmployeeIdAndNameDeveloper(conn,stmt,rs,projectName); Regards
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26201
|
|
Note that this overwrites the EmployeeInfo variable. This means you will only get the last value returned in the string. (This doesn't necessarily have to be the last row in the table.) Using the following will append the records into the EmployeeInfo variable. EmployeeInfo += EmployeeInfo+ ROW_SEPARATOR + ...
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Bill Johnston
Ranch Hand
Joined: Nov 17, 2005
Posts: 194
|
|
No Jeane that is not true. EmployeeInfo = EmployeeInfo+ ... is the same as EmployeeInfo += ... ~Bill
|
 |
Bill Johnston
Ranch Hand
Joined: Nov 17, 2005
Posts: 194
|
|
|
I wouldn't pass the Statement Object and the ResultSet Object in, only the Connection Object. I'd rather keep the former two local, build them in the method and then close them in the method ... I think that is your problem, you are not closing them. Don't forget to close them in the opposite order you build them.
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26201
|
|
Originally posted by Bill Johnston: No Jeane that is not true.
Doh! I knew that. For some reason, I read it as "EmployeeInfo = ROW_SEPARATOR ..." rather than what was actually written.
|
 |
Micheal John
Ranch Hand
Joined: Nov 01, 2006
Posts: 344
|
|
|
|
 |
Micheal John
Ranch Hand
Joined: Nov 01, 2006
Posts: 344
|
|
|
I have posted the coding...any help....
|
 |
 |
|
|
subject: Problem in retrieving data and store it in string
|
|
|