Maria Smith

Ranch Hand
+ Follow
since Apr 01, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Maria Smith

Sudha,

You can do this.
List list = Collections.synchronizedList(new ArrayList(...));
Thank you so much for your reply. I am going to change the code to to see if i get any better performance.
But in general for a query about million rows I get result set back by 12 minutes. Then it takes another 50 to 60 minutes to dump the data in a file.

Maria
12 years ago
I just get the data like this from the result set and dump it in a file

while(rs.next()
{
out.write(rs.getString(1).trim()+',');
out.write(rs.getString(2).trim()+',');
out.write(rs.getString(3).trim()+',');
out.write(rs.getString(4).trim()+',');
out.write(rs.getString(5).trim()+',');
out.write('\n');
out.flush();
}
Thanks
12 years ago
Hi I am new to java. What is the efficient way of writing data into *.txt file using java
I need to dump data from one of the oracle table to *.txt file using java.
Right now I am using
File outputFile = new File(fileName);
PrintWriter out =new PrintWriter(new BufferedWriter (new FileWriter(outputFile)));
using out.write method to write the data into text file.

Gurus please let me know if there is any other way to acheive same result much faster.
Because right now it takes about 30 minutes to create file for about 300,000 records.

Thanks,
Maria
12 years ago
I tried CachedRowSet and it is working in my java class.

crs.setPageSize(20);

while (crs.nextPage())
{
System.out.println ("Page Number :"+ n++)
if (crs != null) {
crs.beforeFirst();
while(crs.next())
{
System.out.println("crs.getString(1));
}
}
}
How to call this method from JSP so that it should get only 20 rows when I click the NEXT button.

Gurus Please help me
[ September 06, 2006: Message edited by: Maria Smith ]
Thank you for your reply
That looks very expensive to me. Because every time I am running my query against million rows to get my next 20 rows.
Is it possible to right a cursor like this "FOR SELECT OF" in DB2? I am using Java and I am unfamiliar with righting cursor for DB2.
Please give me an example for creating Cursor for DB2
Thank you for your reply. But how to get next set of rows?
[ September 05, 2006: Message edited by: Maria Smith ]
Can some one help with my DB2 issue

Thanks
Hi everyone

Thankfully I don't have to retrieve 2 milion rows. But I need to retrive 1000 rows and need to display 20 rows per page.
I am using DB2 database and and tried this query to limit number of rows

select emp_name
,rownumber() OVER (ORDER BY emp_name) AS ROW_NEXT
from EMPLOYEE
ROW_NEXT BETWEEN 20 and 40

But it doesn't seem to work and got following error.
[Error Code: -104, SQL State: 42601] [IBM][CLI Driver][DB2] SQL0104N An unexpected token "(" was found following "". Expected tokens may include: ", FROM INTO ". SQLSTATE=42601


then tried this

select emp_name
,rownumber() OVER ORDER BY emp_name AS ROW_NEXT
from EMPLOYEE
ROW_NEXT BETWEEN 20 and 40


and got this error.
[Error Code: -199, SQL State: 42601] [IBM][CLI Driver][DB2] SQL0199N The use of the reserved word "ORDER" following "" is not valid. Expected tokens may include: ", FROM INTO ". SQLSTATE=42601


I also tried use com.sun.rowset.CachedRowSetImpl creating CashedRow like this

CachedRowSet crs = new CachedRowSetImpl();
crs.setPageSize(20);
but get error for setPageSize method

Some one plase help with this or let me know if there is any better way of doing this.

I really appreciate your help

Maria
But that is going to look ugly because I am opening a popup window as I click submit button and after 30 seconds showing some data from database
Thank you for your response

But I need to create a popup window based on response object from a Servlet and same thing goes true with redirecting content to parent window.
I cann't use a link or click some link to create a popup.

Can someone please let me know is it possible to create a popup and redirect back to parent window using response from server side
Gregg can you please help with solution or give me an example how to open a pop up window when i get response from servlet

thanks
Sorry to post the same topic again in JSP form. But I am not sure it is only related to html and JavaScript Because I need to create a popup window based on response object from a Servlet and same thing goes true with redirecting content to parent window.

I am not familiar with JavaScript. And as far as I know we can use URL to open a pop up window in JavaScript and here I have JSP and Servlet request and response object

Please can some one help me with some examples

Thanks,
Maria
12 years ago
JSP
I am not much familiar with the JavaScript Can you Please give me an example.
And one more thing I do use Servlet response object to open a pop up window where I don�t have an URL to click is it possible to do this using java script?

Thanks for your help
Gurus please help me. I am not able to get my popup window working correctly.

In my jsp when user clicks "Submit" button the request goes to a Servlet and I would like to display the response from the Servlet into a popup window (Which basically contains only higher level info) When user clicks the "View Detail" button to view the detail information on pop up window the request goes back to Servlet again and I would like the response from the Servlet back to Original that is my parent window.

Now my problem is as soon as I click "Submit" button on my first JSP page I loose the content of my page. To avoid that is used target='_blank" to create new window. But new window looks just like standard window but I need a popup window. And more then that when I click "View Detail" button on new window all the response from the Servlet gets displayed in new window rather then parent window.

Please let me know how I can make this thing work

Thanks,
Maria