p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Java > Java and JDK > JSP Basics
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 19th, 2008, 05:57 AM
Registered User
 
Join Date: Feb 2008
Location: Bangalore, Karnataka, India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Illegal operation on empty result set.

Hi all !!!
could you please tell me the solution why <b>"Illegal operation on empty result set."</b> is coming.

I have to display the images from the database Mysql dynamically by pssing parameter "chartid"

<%@ page import="java.sql.*" %>
<%@ page import= "java.io.*" %>
<%
String connectionURL = "jdbc:mysql://localhost:3306/modelval?user=modval;password=modval";
Connection connection = null;
Statement statement = null;
%>
<%
String Id=request.getParameter("chartid");
Class.forName("com.mysql.jdbc.Driver").newInstance ();
connection = DriverManager.getConnection(connectionURL, "modval", "modval");
statement = connection.createStatement();
ResultSet rs1 = statement.executeQuery( "SELECT * FROM tab_charts where chartid= ' " + Id + " ' ");
rs1.next();
byte [] barray = rs1.getBytes("chart");
rs1.close();
statement.close();
response.setContentType("image/jpeg");
response.getOutputStream().write(barray);
%>
================================================== =============
i am not getting the display of images on jsp page....the image is stored as a blob in table tab_charts with the column name "chart"
but not getting the images....

please help me .Its reallly urgent...
thanx in advance

Amit Srivastava
__________________
Amit Srivastava
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old February 19th, 2008, 11:37 PM
Friend of Wrox
Points: 601, Level: 9
Points: 601, Level: 9 Points: 601, Level: 9 Points: 601, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2005
Location: Cochin, Kerala, India.
Posts: 183
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Hi,

check whether your query returns something
is there exist some data in the table with this chartid etc.

SELECT * FROM tab_charts where chartid= ' " + Id + " '

how u inserted image data into db.
==================
other way to increase perfomance..

u have to upload images in to a folder
and store the file path in db

for displaying
retrieve the filepath
and display it using <img src="path">
buy doing this u can avoid the extra fetch from the db..

regds,


jomet.
---------------------------------------------
Once you start a working on something,
dont be afraid of failure and dont abandon it.
People who work sincerely are the happiest.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old February 19th, 2008, 11:49 PM
Friend of Wrox
Points: 601, Level: 9
Points: 601, Level: 9 Points: 601, Level: 9 Points: 601, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2005
Location: Cochin, Kerala, India.
Posts: 183
Thanks: 4
Thanked 0 Times in 0 Posts
Default

check the link
http://blogs.sun.com/sakthi/entry/ho...d_and_retrieve

jomet.
---------------------------------------------
Once you start a working on something,
dont be afraid of failure and dont abandon it.
People who work sincerely are the happiest.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
XPath: set operation with a disjoint node set rich_unger XSLT 7 May 6th, 2008 10:24 AM
"OPERATION NOT ALLOWED AFTERRESULT SET IS CLOSED" picky JSP Basics 3 October 12th, 2006 04:26 PM
OPERATION NOT ALLOWED AFTERRESULT SET IS CLOSED" picky Java Databases 0 October 4th, 2006 06:36 AM
PWS0007 - Operation result set not found tkwhk SQL Server 2000 0 August 14th, 2006 03:32 AM
SQL result returns nothing, but empty == false? barddzen Pro JSP 1 August 9th, 2004 01:52 AM



All times are GMT -4. The time now is 09:09 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc