Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Conie Ooi

Ranch Hand
+ Follow
since Jun 09, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
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 Conie Ooi

Hi, I'm having problem in retriving records from the DB2 database. The follwing is my code:
String sql = "select * from user";
execQuery(sql);

public void execQuery(String sql) throws SQLException, NullPointerException, Exception
{
if (sql == "" || sql == null) {
throw new Exception("sql cannot be null");
}

PoolManager poolMgr = null;
Connection conn = null;
Statement stmt = null;
ResultSet rst = null;
ResultSetMetaData rsmd = null;
Vector v = new Vector();
try {
poolMgr = PoolManager.getInstance();
System.out.println("poolMgr instantiated");
conn = poolMgr.getConnection();
System.out.println("conn instantiated");
stmt = conn.createStatement();
System.out.println("stmt instantiated");
rst = stmt.executeQuery(sql);
}
catch (SQLException sqle) {
System.out.println("sqle :" + sqle.getMessage());
catch (NullPointerException npe) {
System.out.println("npe :" + npe.getMessage());
}
catch (Exception e) {
System.out.println("e :" + e.getMessage());
}
finally {
stmt.close();
rst.close();
poolMgr.freeConnection(conn);
}
}
}
The following is the messages i received from the log file:
poolMgr instantiated
conn instantiated
npe :null
From my understanding, it's seems like something wrong to the connection and statement, but i do not know why this happen, it works fine previously. Do you have any idea why this happen and how to overcome this problem?
I tried to uninstall and install my DB2, but the same thing still occurs. Can you help???
Thanks a lot and hope to hear from you soon...
regards..
17 years ago
Not sure whether we are in the same situation. I'm printing the content of the JTable from JSP. What i did was I regenerate the records in the table and display out to the html table.
Hope this helps...
i've found the solution to my problem already.. thanks a lot..
Hi, I'm in a situation which I need to select rows from table in a range, let's say from record 3 to record 5. Is there any command in DB2 can do the job for me?
Thanks a lot and waiting for your reply..
Yes, the problem is after the file is downloaded. The file content is ok, it's just I can't visit to the other page anymore except if I refresh the page..
Any idea how to solve?
18 years ago
Thanks for the reply, but I'm not so understand about the reply, can you explain more details?
In my jsp, I'm using out.println to print out the file url for user to click and download. The following is my code in jsp:
out.println("<a href=servlet/download.downloadServlet?attachmentId=" +getAttachId() + "&filename="+URLEncoder.encode(getFName())+">" + getFName() + "</a>");

Tried to use response.encodeURL too, but i still have the same error..
String encodedurl = "servlet/download.downloadServlet?attachmentId=" +getAttachId() + "&filename="+getFName());
out.println("<a href="+response.encodeURL(encodedurl)+">"+ getFName() + "</a>");
Anything that i have missed out???
18 years ago
Hi, I'm currently working on file uploading and downloading from client site to the server's site. One problem that I'm facing currently is after I downloaded files from the jsp, I received an "Error on page" error. When I double click on the exclaimation icon at the bottom left corner, the message details says that "Access is denied". I managed to download the file to the any location i wish, but after download, i just can't navigate to other page even though i click at the link.
Any suggestion will be highly appreciated... Thank you very much
18 years ago
I'm using multipartRequest to upload the file to the directory in the server, and i have written a small program to upload the file from the server's directory to the Blob in the database. So after the database uploading is complete, i need to delete the files in the server's directory.
I went through the thread in the reply and try in on, when i check the existance of the files, those files are exist, file.delete() just can't delete the files. Do you have any idea why and how?
Thanks a lot...
18 years ago
Hi, I need to implement a print printer friendly version of the jsp pages. Some of the pages contain table. If my table has a lot of columns until I need to scroll to view the whole table, so how am I going to implement the printer friendly of the page?
Can you advice on how to implement this? Thanks a lot...
18 years ago
Thanks a lot Mario..
18 years ago
Hi, I need to delete files in certain folder in the server. File.delete() doesn't work for my case, do you have any idea how to do?
Thanks a lot...
18 years ago
Thanks a lot... now my problem solved...
There is another problem. When the download dialog box poped up, if I select to save the file, it works. The file is saved to the client side. But if i choose to open the file from the current location, I will receive another download dialog box, and i have to select open file from the current location again to open the file. Do you have any idea why and how to solve this problem?
Thanks a lot...
[ August 15, 2002: Message edited by: Conie Ooi ]
18 years ago
Hi, I'm trying to download files from the server side to the client. When the user click at the link to the file, I want the downloading dialog box to appear so that the user can save it to anywhere he/she likes. But my problme now is I can't.
the following is my coding:
String filename = request.getParameter("filename");
String folder = "C:\\test\\" + filename;
System.out.println("foder is " + folder);
response.setContentType("text/plain");
response.setHeader("Content-Disposition","attachment; filename=;");
ServletOutputStream stream = response.getOutputStream();
BufferedInputStream fif =
new BufferedInputStream(new FileInputStream(folder));
int data;
while((data = fif.read()) != -1) {
stream.write(data);
}
fif.close();
stream.close();

with the above code, the browser will open the file for me. When I hardcode the filename, let's say a.txt, the download dialog box appear...
I've stucked in this for quite sometime, do you know why this happen and how to relove it?
Any suggestion is highly appreciated...
regards
18 years ago
I came across this setMaxInactiveInterval in the API. I set session.setMaxInactiveInterval(60*15) in my application, but the session expired more than 15minutes, any idea to extend the session?
18 years ago