|
|
 |
| 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.
|
 |

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
|
|
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
|

February 19th, 2008, 11:37 PM
|
|
Friend of Wrox
|
|
Join Date: Aug 2005
Location: Cochin, Kerala, India.
Posts: 183
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
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.
|

February 19th, 2008, 11:49 PM
|
|
Friend of Wrox
|
|
Join Date: Aug 2005
Location: Cochin, Kerala, India.
Posts: 183
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
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.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |