Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
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 Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 19th, 2008, 05:57 AM
Registered User
 
Join Date: Feb 2008
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
 
Old February 19th, 2008, 11:37 PM
jomet
Guest
 
Posts: n/a
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.
 
Old February 19th, 2008, 11:49 PM
jomet
Guest
 
Posts: n/a
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.





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.